标签:遇到 .sh get mode 朋友 write rpc 无法 dll
获取很多人都会问我为什么要写这个博客,原因很简单,这次研发apk版本信息的时候网上查了很多的资料都没有这方面的信息,因此这次功能完了想写下方法,如果以后博友们遇到了可以直接copy,不用花很多的时间,至少有了方向。
下面我就来说下获取apk版本信息所需要调用的dll吧,该程序集的版本信息为:0.85.4.369,注意哦这个版本信息很重要的,因为可能你下的很多版本都是无法用的。
下面我就来说下研发代码吧:代码可能有不周全的地方:由于时间紧急没有做优化了:
using (ICSharpCode.SharpZipLib.Zip.ZipInputStream zip = new ICSharpCode.SharpZipLib.Zip.ZipInputStream(File.Open(apkPath, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)))//这里的后面连哥哥参数很重要哦,不然很有可能出现独占
{
using (var filestream = new FileStream(apkPath, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))//这里的后面连哥哥参数很重要哦,不然很有可能出现独占
{
using (ICSharpCode.SharpZipLib.Zip.ZipFile zipfile = new ICSharpCode.SharpZipLib.Zip.ZipFile(filestream))
{
ICSharpCode.SharpZipLib.Zip.ZipEntry item;
string content = string.Empty;
while ((item = zip.GetNextEntry()) != null)
{
if (item.Name == "AndroidManifest.xml")
{
byte[] bytes = new byte[50 * 1024];
using (Stream strm = zipfile.GetInputStream(item))
{
int size = strm.Read(bytes, 0, bytes.Length);
using (BinaryReader s = new BinaryReader(strm))
{
byte[] bytes2 = new byte[size];
Array.Copy(bytes, bytes2, size);
AndroidDecompress decompress = new AndroidDecompress();
content = decompress.decompressXML(bytes);
}
}
}
}
}
}
获取出来的信息content这里我就不作解析处理了哈,需要的朋友自己处理下咯哈。
标签:遇到 .sh get mode 朋友 write rpc 无法 dll
原文地址:http://www.cnblogs.com/lqLove/p/7873484.html