c# 借助cmd命令解析apk文件信息

借助aapt.exe文件

aapt.exe 解析apk包信息cmd命令:

aapt dump badging *.apk
aapt d badging *.apk >1.txt(保存成1.txt文件)

ProcessStartInfo start = new ProcessStartInfo("cmd.exe");
start.CreateNoWindow = true;
start.RedirectStandardInput = true;
start.RedirectStandardOutput = true;
start.UseShellExecute = false;
Process process = Process.Start(start);
try
{
     var aaptFile = Server.MapPath("~/aaptFile/aapt.exe");
     //apkPath 安装包路径
     process.StandardInput.WriteLine(aaptFile + " d badging \"" + apkPath + "\"");
     StreamReader reader = process.StandardOutput;

     while (!reader.EndOfStream)
     {
         //解析所需要数据
         string output = reader.ReadLine();
     }
}
catch
{}    

  

posted @ 2016-02-03 10:55  随学·笔记  阅读(580)  评论(0编辑  收藏  举报