- Removed APK links that are no longer available
- Fixed icon not displaying. It will load icon from Play Store as a last resort
- Faster apk parsing
This commit is contained in:
AndnixSH
2025-03-17 17:33:47 +01:00
parent 8834cbcec2
commit b25fd6451b
7 changed files with 1118 additions and 3447 deletions
+89 -22
View File
@@ -1,4 +1,5 @@
using System;
using APKToolGUI.Web;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
@@ -66,10 +67,23 @@ namespace APKToolGUI.Utils
public string ApkDlLink;
public string AppIcon;
public string FullInfo;
internal string AppIcon = null;
internal string AppIcon120 = null;
internal string AppIcon160 = null;
internal string AppIcon240 = null;
internal string AppIcon320 = null;
internal string AppIcon480 = null;
internal string AppIcon640 = null;
internal string AppIcon65534 = null;
public bool Parse(string file)
{
@@ -110,9 +124,6 @@ namespace APKToolGUI.Utils
case "application-label":
AppName = StringExt.Regex(@"(?<=application-label:\')(.*?)(?=\')", line);
break;
case "application":
AppIcon = GetIcon(file, StringExt.Regex(@"(?<=icon=\')(.*?)(?=\')", line));
break;
case "launchable-activity":
LaunchableActivity = StringExt.Regex(@"(?<=name=\')(.*?)(?=\')", line);
break;
@@ -142,7 +153,17 @@ namespace APKToolGUI.Utils
PlayStoreLink = "https://play.google.com/store/apps/details?id=" + PackageName;
ApkComboLink = "https://apkcombo.com/a/" + PackageName;
ApkPureLink = "https://apkpure.com/a/" + PackageName;
ApkAioLink = "https://apkaio.com/app/" + PackageName;
ApkSupportLink = "https://apk.support/app/" + PackageName;
ApkMirrorLink = "https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=" + PackageName;
ApkGkLink = "https://apkgk.com/" + PackageName + "/download";
AppIcon120 = StringExt.Regex(@"(?<=application-icon-120:\')(.*?)(?=\')", FullInfo);
AppIcon160 = StringExt.Regex(@"(?<=application-icon-160:\')(.*?)(?=\')", FullInfo);
AppIcon240 = StringExt.Regex(@"(?<=application-icon-240:\')(.*?)(?=\')", FullInfo);
AppIcon320 = StringExt.Regex(@"(?<=application-icon-320:\')(.*?)(?=\')", FullInfo);
AppIcon480 = StringExt.Regex(@"(?<=application-icon-480:\')(.*?)(?=\')", FullInfo);
AppIcon640 = StringExt.Regex(@"(?<=application-icon-640:\')(.*?)(?=\')", FullInfo);
AppIcon65534 = StringExt.Regex(@"(?<=application-icon-65534:\')(.*?)(?=\')", FullInfo);
result = true;
}
@@ -170,31 +191,77 @@ namespace APKToolGUI.Utils
return apkinfo;
}
string[] iconFolder = { "mipmap-xxxhdpi-v4", "mipmap-xxhdpi-v4", "mipmap-xhdpi-v4", "mipmap-hdpi-v4", "mipmap-mdpi-v4", "mipmap-xhdpi", "mipmap-hdpi", "drawable-xxxhdpi-v4", "drawable-xxhdpi-v4", "drawable-xhdpi-v4", "drawable-hdpi-v4", "drawable-mdpi-v4" };
private string GetIcon(string apkPath, string iconPath)
public string GetIcon(string apkPath)
{
iconPath = iconPath.Replace(".xml", ".png");
string[] png = { "mipmap-xxxhdpi-v4", "mipmap-xxhdpi-v4", "mipmap-xhdpi-v4", "mipmap-hdpi-v4", "mipmap-mdpi-v4", "mipmap-xhdpi", "mipmap-hdpi", "drawable-xxxhdpi-v4", "drawable-xxhdpi-v4", "drawable-xhdpi-v4", "drawable-hdpi-v4", "drawable-mdpi-v4" };
string icon = "";
if (iconPath.Contains("anydpi-v26"))
if (!string.IsNullOrEmpty(AppIcon65534))
icon = AppIcon65534;
else if (!string.IsNullOrEmpty(AppIcon640))
icon = AppIcon640;
else if (!string.IsNullOrEmpty(AppIcon480))
icon = AppIcon480;
else if (!string.IsNullOrEmpty(AppIcon320))
icon = AppIcon320;
else if (!string.IsNullOrEmpty(AppIcon240))
icon = AppIcon240;
else if (!string.IsNullOrEmpty(AppIcon160))
icon = AppIcon160;
else if (!string.IsNullOrEmpty(AppIcon120))
icon = AppIcon120;
icon = icon.Replace(".xml", ".png");
Debug.WriteLine("Icon: " + icon);
string cacheDir = Path.Combine(Program.TEMP_PATH, PackageName);
string iconLocation = Path.Combine(cacheDir, Path.GetFileName(icon));
Directory.CreateDirectory(cacheDir);
if (icon.Contains("anydpi-v26"))
{
foreach (string folder in iconFolder)
foreach (string Png in png)
{
string icon = iconPath.Replace("mipmap-anydpi-v26", folder).Replace("drawable-anydpi-v26", folder);
if (ZipUtils.Exists(apkPath, icon))
string icon2 = icon.Replace("mipmap-anydpi-v26", Png).Replace("drawable-anydpi-v26", Png);
ZipUtils.ExtractFile(apkPath, icon2, cacheDir);
if (File.Exists(iconLocation))
{
Debug.WriteLine("Icon path " + icon);
return icon;
break;
}
}
return iconPath.Replace("mipmap-anydpi-v26", "mipmap-xhdpi").Replace(".xml", ".png");
}
else if (icon.Contains("v26"))
{
string icon2 = icon.Replace("v26", "v4");
ZipUtils.ExtractFile(apkPath, icon2, cacheDir);
icon2 = icon.Replace("-v26", "");
ZipUtils.ExtractFile(apkPath, icon2, cacheDir);
}
else
{
Debug.WriteLine("Icon path " + iconPath);
return iconPath;
ZipUtils.ExtractFile(apkPath, icon, cacheDir);
}
if (!File.Exists(iconLocation))
{
try
{
WebDownload w = new WebDownload();
string ps = w.DownloadString("https://play.google.com/store/apps/details?id=" + PackageName);
//File.WriteAllText("R:\\t.txt", ps);
string icondl = Path.Combine(cacheDir, "icon.png");
Directory.CreateDirectory(cacheDir);
w.DownloadFile(StringExt.Regex(@"(?<=\""image\"":\"")(.*?)(?=\"",\"")", ps), icondl);
iconLocation = icondl;
}
catch
{
}
}
return iconLocation;
}
//https://apilevels.com/
@@ -207,7 +274,7 @@ namespace APKToolGUI.Utils
case "34":
return sdk + ": Android 14";
case "33":
return sdk + ": Android 14";
return sdk + ": Android 13";
case "32":
return sdk + ": Android 12.0L";
case "31":
-27
View File
@@ -75,8 +75,6 @@
this.label31 = new System.Windows.Forms.Label();
this.archSdkTxtBox = new System.Windows.Forms.TextBox();
this.label30 = new System.Windows.Forms.Label();
this.apkDlLinkBtn = new System.Windows.Forms.Button();
this.apkSosLinkBtn = new System.Windows.Forms.Button();
this.apkMirrorLinkBtn = new System.Windows.Forms.Button();
this.apkSupportLinkBtn = new System.Windows.Forms.Button();
this.apkGkLinkBtn = new System.Windows.Forms.Button();
@@ -91,7 +89,6 @@
this.fileTxtBox = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
this.densityTxtBox = new System.Windows.Forms.TextBox();
this.apkAioLinkBtn = new System.Windows.Forms.Button();
this.packNameTxtBox = new System.Windows.Forms.TextBox();
this.apkPureLinkBtn = new System.Windows.Forms.Button();
this.verTxtBox = new System.Windows.Forms.TextBox();
@@ -610,8 +607,6 @@
this.basicInfoTabPage.Controls.Add(this.label31);
this.basicInfoTabPage.Controls.Add(this.archSdkTxtBox);
this.basicInfoTabPage.Controls.Add(this.label30);
this.basicInfoTabPage.Controls.Add(this.apkDlLinkBtn);
this.basicInfoTabPage.Controls.Add(this.apkSosLinkBtn);
this.basicInfoTabPage.Controls.Add(this.apkMirrorLinkBtn);
this.basicInfoTabPage.Controls.Add(this.apkSupportLinkBtn);
this.basicInfoTabPage.Controls.Add(this.apkGkLinkBtn);
@@ -626,7 +621,6 @@
this.basicInfoTabPage.Controls.Add(this.fileTxtBox);
this.basicInfoTabPage.Controls.Add(this.label14);
this.basicInfoTabPage.Controls.Add(this.densityTxtBox);
this.basicInfoTabPage.Controls.Add(this.apkAioLinkBtn);
this.basicInfoTabPage.Controls.Add(this.packNameTxtBox);
this.basicInfoTabPage.Controls.Add(this.apkPureLinkBtn);
this.basicInfoTabPage.Controls.Add(this.verTxtBox);
@@ -680,18 +674,6 @@
resources.ApplyResources(this.label30, "label30");
this.label30.Name = "label30";
//
// apkDlLinkBtn
//
resources.ApplyResources(this.apkDlLinkBtn, "apkDlLinkBtn");
this.apkDlLinkBtn.Name = "apkDlLinkBtn";
this.apkDlLinkBtn.UseVisualStyleBackColor = true;
//
// apkSosLinkBtn
//
resources.ApplyResources(this.apkSosLinkBtn, "apkSosLinkBtn");
this.apkSosLinkBtn.Name = "apkSosLinkBtn";
this.apkSosLinkBtn.UseVisualStyleBackColor = true;
//
// apkMirrorLinkBtn
//
resources.ApplyResources(this.apkMirrorLinkBtn, "apkMirrorLinkBtn");
@@ -772,12 +754,6 @@
this.densityTxtBox.Name = "densityTxtBox";
this.densityTxtBox.ReadOnly = true;
//
// apkAioLinkBtn
//
resources.ApplyResources(this.apkAioLinkBtn, "apkAioLinkBtn");
this.apkAioLinkBtn.Name = "apkAioLinkBtn";
this.apkAioLinkBtn.UseVisualStyleBackColor = true;
//
// packNameTxtBox
//
resources.ApplyResources(this.packNameTxtBox, "packNameTxtBox");
@@ -2423,7 +2399,6 @@
internal System.Windows.Forms.Button baksmaliBrowseOutputBtn;
internal System.Windows.Forms.TextBox baksmaliBrowseOutputTxtBox;
internal System.Windows.Forms.Button openApktoolYmlBtn;
internal System.Windows.Forms.Button apkAioLinkBtn;
private System.Windows.Forms.Label label29;
private System.Windows.Forms.Label label28;
internal System.Windows.Forms.Button signApkOpenDirBtn;
@@ -2435,8 +2410,6 @@
private System.Windows.Forms.RichTextBox fullInfoTextBox;
internal System.Windows.Forms.TabPage basicInfoTabPage;
internal System.Windows.Forms.Button apkMirrorLinkBtn;
internal System.Windows.Forms.Button apkDlLinkBtn;
internal System.Windows.Forms.Button apkSosLinkBtn;
internal System.Windows.Forms.Button apkSupportLinkBtn;
internal System.Windows.Forms.Button apkGkLinkBtn;
internal System.Windows.Forms.TextBox archSdkTxtBox;
+14 -19
View File
@@ -253,6 +253,8 @@ namespace APKToolGUI
string splitPath = Path.Combine(Program.TEMP_PATH, "SplitInfo");
string arch = "";
bool parsed = false;
await Task.Factory.StartNew(() =>
{
DirectoryUtils.Delete(splitPath);
@@ -295,13 +297,7 @@ namespace APKToolGUI
}
}
}
});
bool parsed = false;
string signature = null;
await Task.Factory.StartNew(() =>
{
signature = signapk.GetSignature(file);
aapt = new AaptParser();
parsed = aapt.Parse(file);
});
@@ -313,7 +309,6 @@ namespace APKToolGUI
apkIconPicBox.Image.Dispose();
apkIconPicBox.Image = null;
}
sigTxtBox.Text = signature;
fileTxtBox.Text = aapt.ApkFile;
appTxtBox.Text = aapt.AppName;
packNameTxtBox.Text = aapt.PackageName;
@@ -332,20 +327,20 @@ namespace APKToolGUI
archSdkTxtBox.Text = arch.RemoveLast(", ");
launchActivityTxtBox.Text = aapt.LaunchableActivity;
if (aapt.AppIcon != null)
{
await Task.Factory.StartNew(() =>
{
ZipUtils.ExtractFile(file, aapt.AppIcon, Path.Combine(Program.TEMP_PATH, aapt.PackageName));
});
string icon = Path.Combine(Program.TEMP_PATH, aapt.PackageName, Path.GetFileName(aapt.AppIcon));
if (File.Exists(icon))
{
apkIconPicBox.Image = BitmapUtils.LoadBitmap(icon);
}
}
apkIconPicBox.Image = BitmapUtils.LoadBitmap(aapt.GetIcon(file));
DirectoryUtils.Delete(splitPath);
}
string signature = null;
sigTxtBox.Text = "Loading...";
await Task.Factory.StartNew(() =>
{
signature = signapk.GetSignature(file);
});
sigTxtBox.Text = signature;
}
catch (Exception ex)
{
File diff suppressed because it is too large Load Diff
@@ -20,10 +20,7 @@ namespace APKToolGUI.Handlers
main.apkPureLinkBtn.Click += apkPureLinkBtn_Click;
main.apkGkLinkBtn.Click += apkGkLinkBtn_Click;
main.apkSupportLinkBtn.Click += apkSupportLinkBtn_Click;
main.apkSosLinkBtn.Click += apkSosLinkBtn_Click;
main.apkMirrorLinkBtn.Click += apkMirrorLinkBtn_Click;
main.apkAioLinkBtn.Click += apkAioLinkBtn_Click;
main.apkDlLinkBtn.Click += apkDlLinkBtn_Click;
}
private void selApkFileInfoBtn_Click(object sender, EventArgs e)
@@ -66,29 +63,11 @@ namespace APKToolGUI.Handlers
if (main.aapt != null)
Process.Start(main.aapt.ApkSupportLink);
}
private void apkSosLinkBtn_Click(object sender, EventArgs e)
{
if (main.aapt != null)
Process.Start(main.aapt.ApkSosLink);
}
private void apkMirrorLinkBtn_Click(object sender, EventArgs e)
{
if (main.aapt != null)
Process.Start(main.aapt.ApkMirrorLink);
}
private void apkAioLinkBtn_Click(object sender, EventArgs e)
{
if (main.aapt != null)
Process.Start(main.aapt.ApkAioLink);
}
private void apkDlLinkBtn_Click(object sender, EventArgs e)
{
if (main.aapt != null)
Process.Start(main.aapt.ApkDlLink);
}
}
}
-1
View File
@@ -28,7 +28,6 @@ namespace APKToolGUI.Utils
}
else
{
MessageBox.Show("Error Loading File.", "Error!", MessageBoxButtons.OK);
return null;
}
}
+4 -4
View File
@@ -13,13 +13,12 @@ namespace APKToolGUI.Utils
{
public class CMD
{
public static string output;
static public Process p = new Process();
public static string ProcessStartWithOutput(string FileName, string Arguments)
{
Log.d("CMD: " + FileName + " " + Arguments);
string result = string.Empty;
try
{
using (Process process = new Process())
@@ -33,13 +32,14 @@ namespace APKToolGUI.Utils
process.StartInfo.StandardOutputEncoding = Encoding.GetEncoding("utf-8");
process.Start();
result = process.StandardOutput.ReadToEnd().Trim();
process.WaitForExit(4000);
process.WaitForExit();
}
}
catch (Exception e)
{
Debug.WriteLine("Start", e);
}
return result;
}
}