/// <summary> /// 查看源码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBrowseSource_Click(object sender, EventArgs e) { if (mApkInfo == null) { return; } BrowseSourceBLL.OpenJadxGUI(mApkInfo.ApkFilePath); this.Dispose(); this.Close(); }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string filePath; // 读取文件路径 if (args != null && args.Length > 0) { filePath = args[0]; } else { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "打开(.apk|.jar|.dex|.jks|.keystore)文件"; ofd.Filter = "apk jar dex jks keystore|*.apk;*.jar;*.dex;*.jks;*.keystore"; DialogResult res = ofd.ShowDialog(); if (String.IsNullOrEmpty(ofd.FileName)) { return; } filePath = ofd.FileName; } // 处理文件 if (!File.Exists(filePath)) { MessageBox.Show("文件不存在:" + filePath); return; } string vExtension = Path.GetExtension(filePath); if (!".jar".Equals(vExtension) && !".dex".Equals(vExtension) && !".apk".Equals(vExtension) && !".jks".Equals(vExtension) && !".keystore".Equals(vExtension) ) { MessageBox.Show("文件格式错误(正确格式:.jar、.dex、.apk、.jks、.keystore)"); return; } if (".jar".Equals(vExtension)) { // 查看源码 BrowseSourceBLL.OpenJadxGUI(filePath); return; } if (".dex".Equals(vExtension)) { // 查看源码 BrowseSourceBLL.OpenJadxGUI(filePath); return; } if (".apk".Equals(vExtension)) { // 查看APK信息 ApkInfo apkInfo = BrowseApkInfoBLL.ReadApkInfo(filePath); ApkInfoForm apkInfoForm = new ApkInfoForm(apkInfo); apkInfoForm.ShowDialog(); } if (".jks".Equals(vExtension) || ".keystore".Equals(vExtension)) { BrowseCertForm browseCertForm = new BrowseCertForm(filePath, Constants.TYPE_CERT_FILE); browseCertForm.ShowDialog(); } //Application.Run(new Form1()); }