From ab629c24f3e05d402a2b0d324a535bca1b715f66 Mon Sep 17 00:00:00 2001
From: AndnixSH <40742924+AndnixSH@users.noreply.github.com>
Date: Mon, 8 May 2023 15:28:24 +0200
Subject: [PATCH] Added View APK info in context menu #9
---
APKToolGUI/Forms/FormMain.Designer.cs | 1 +
APKToolGUI/Forms/FormMain.cs | 24 +++++++++++------------
APKToolGUI/Languages/Language.Designer.cs | 2 +-
APKToolGUI/Languages/Language.resx | 2 +-
APKToolGUI/Utils/ExplorerContextMenu.cs | 4 ++--
5 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/APKToolGUI/Forms/FormMain.Designer.cs b/APKToolGUI/Forms/FormMain.Designer.cs
index 8cb6bb9..9e9d53f 100644
--- a/APKToolGUI/Forms/FormMain.Designer.cs
+++ b/APKToolGUI/Forms/FormMain.Designer.cs
@@ -302,6 +302,7 @@ private void InitializeComponent()
this.tabControlMain.Controls.Add(this.tabPageAdb);
this.tabControlMain.Name = "tabControlMain";
this.tabControlMain.SelectedIndex = 0;
+ this.tabControlMain.SelectedIndexChanged += new System.EventHandler(this.tabControlMain_SelectedIndexChanged);
//
// tabPageMain
//
diff --git a/APKToolGUI/Forms/FormMain.cs b/APKToolGUI/Forms/FormMain.cs
index df85fab..f9f5166 100644
--- a/APKToolGUI/Forms/FormMain.cs
+++ b/APKToolGUI/Forms/FormMain.cs
@@ -19,6 +19,7 @@
using System.Linq;
using System.Windows.Interop;
using System.Security.Cryptography;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace APKToolGUI
{
@@ -155,10 +156,6 @@ await Task.Factory.StartNew(() =>
ToStatus(Language.Done, Resources.done);
- string decApkPath = Settings.Default.Decode_InputAppPath;
-
- await GetApkInfo(decApkPath);
-
RunCmdArgs();
await ListDevices();
@@ -217,11 +214,11 @@ private async void RunCmdArgs()
if (await Smali(file) == 0)
Close();
break;
- case "apkinfo":
- await GetApkInfo(file);
+ case "viewinfo":
tabControlMain.SelectedIndex = 1;
+ await GetApkInfo(file);
break;
- default: //Fix when running app as Release from Visual studio
+ default:
IgnoreOutputDirContextMenu = false;
break;
}
@@ -1423,11 +1420,15 @@ await Task.Factory.StartNew(() =>
}
#endregion
- #region Main menu event handlers
-
- #endregion
-
#region Form handlers
+ private async void tabControlMain_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (tabControlMain.SelectedIndex == 1 && String.IsNullOrEmpty(appTxtBox.Text) && Environment.GetCommandLineArgs().Length == 1)
+ {
+ await GetApkInfo(Settings.Default.Decode_InputAppPath);
+ }
+ }
+
private void FormMain_Activated(object sender, EventArgs e)
{
if (!isRunning)
@@ -1566,6 +1567,5 @@ private void CancelProcess()
}
}
#endregion
-
}
}
\ No newline at end of file
diff --git a/APKToolGUI/Languages/Language.Designer.cs b/APKToolGUI/Languages/Language.Designer.cs
index 6c3fe2a..42a2f3c 100644
--- a/APKToolGUI/Languages/Language.Designer.cs
+++ b/APKToolGUI/Languages/Language.Designer.cs
@@ -781,7 +781,7 @@ internal static string FrameworkInstalled {
}
///
- /// Looks up a localized string similar to Get APK Info.
+ /// Looks up a localized string similar to View APK Info.
///
internal static string GetApkInfo {
get {
diff --git a/APKToolGUI/Languages/Language.resx b/APKToolGUI/Languages/Language.resx
index a484ec4..2c74c44 100644
--- a/APKToolGUI/Languages/Language.resx
+++ b/APKToolGUI/Languages/Language.resx
@@ -373,7 +373,7 @@
Disassemble DEX
- Get APK Info
+ View APK Info
This folder is not a decompiled APK
diff --git a/APKToolGUI/Utils/ExplorerContextMenu.cs b/APKToolGUI/Utils/ExplorerContextMenu.cs
index 68a73b7..416a5ec 100644
--- a/APKToolGUI/Utils/ExplorerContextMenu.cs
+++ b/APKToolGUI/Utils/ExplorerContextMenu.cs
@@ -30,7 +30,7 @@ private static Status CreateContextMenu(string executablePath)
apkToolGUIFolderShell.SetValue("SubCommands", "APKToolGUI.Build;APKToolGUI.Smali");
apkToolGUIFolderShell.Close();
- CreateFileAssociationsSubKey(executablePath, ".apk", "APKToolGUI.Decompile;APKToolGUI.Sign;APKToolGUI.Zipalign");
+ CreateFileAssociationsSubKey(executablePath, ".apk", "APKToolGUI.Apkinfo;APKToolGUI.Decompile;APKToolGUI.Sign;APKToolGUI.Zipalign");
CreateFileAssociationsSubKey(executablePath, ".xapk", "APKToolGUI.Decompile");
CreateFileAssociationsSubKey(executablePath, ".apks", "APKToolGUI.Decompile");
CreateFileAssociationsSubKey(executablePath, ".zip", "APKToolGUI.Decompile");
@@ -85,7 +85,7 @@ private static Status CreateContextMenu(string executablePath)
RegistryKey apkinfo = shell.CreateSubKey("APKToolGUI.Apkinfo", RegistryKeyPermissionCheck.ReadWriteSubTree);
apkinfo.SetValue("", Language.GetApkInfo, RegistryValueKind.String);
apkinfo.SetValue("Icon", executablePath, RegistryValueKind.String);
- apkinfo.CreateSubKey("command").SetValue("", "\"" + executablePath + "\" \"apkinfo\" \"%1\"", RegistryValueKind.String);
+ apkinfo.CreateSubKey("command").SetValue("", "\"" + executablePath + "\" \"viewinfo\" \"%1\"", RegistryValueKind.String);
apkinfo.Close();
shell.Close();