收集一个小工具,用来在本地解开zba打包的主题或者插件,无需在网站后台操作,直接在windows下即可解压zba打包的主题或者插件,使用方法: 把下载要解压的zba文件,直接拖放到zba.exe图标上,即可解开。示例图:
附上此程序的源代码,供大家学习,可以看下此程序编译方法,新建一个文本文件 zba.cs, 粘帖代码保存,在命令行窗口运行 C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe zba.cs即可得到zba.exe,如果csc.exe路径不对可以在C盘全盘搜索csc.exe文件,然后路径相应的替换下然后再编译。
Bash
using System;
using System.IO;
using System.Xml;
/// <summary>
/// 用来在本地解开zba打包的主题或者插件
/// www.qiquanji.com
/// </summary>
public class zba
{
public static void Main(string [] args)
{
if(args.Length > 0)
{
string filename = args[0];
if(File.Exists(filename))
{
unpackzba(filename);
}
else
{
Console.WriteLine("错误: {0} 不存在!",filename);
}
}
else
{
Console.WriteLine("错误: 没有指定zba文件!");
}
}
public static void unpackzba(string filename)
{
string unpackpath = Directory.GetCurrentDirectory();
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
try
{
xmlDoc.Load(filename);
foreach (System.Xml.XmlNode nfp in xmlDoc.DocumentElement.SelectNodes("folder/path"))
{
string fp = nfp.InnerText;
if (!System.IO.Directory.Exists(fp))
{
System.IO.Directory.CreateDirectory(fp);
Console.WriteLine("-建立文件夹:" + fp);
}
}
foreach (System.Xml.XmlNode nf in xmlDoc.DocumentElement.SelectNodes("file/path"))
{
string fp = nf.InnerText;
string fs = nf.NextSibling.InnerText;
System.IO.File.WriteAllBytes(fp, Convert.FromBase64String(fs));
Console.WriteLine("-解开文件:" + fp);
}
Console.WriteLine("解包完毕");
}
catch (Exception ex)
{
Console.WriteLine("解包文件出错:" + ex.Message);
}
}
}
原文链接:https://www.qiquanji.com/post/9315.html
本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

微信扫码关注
更新实时通知