Fixed apktool version output

This commit is contained in:
AndnixSH
2025-08-02 10:30:43 +02:00
parent e2784ce65e
commit 5f242bca2f
2 changed files with 25 additions and 5 deletions
+12
View File
@@ -252,6 +252,18 @@ namespace APKToolGUI
}
public string GetVersion()
{
using (JarProcess apktoolJar = new JarProcess(JavaPath, JarPath))
{
apktoolJar.EnableRaisingEvents = false;
apktoolJar.Start("version");
string version = apktoolJar.StandardOutput.ReadToEnd();
apktoolJar.WaitForExit(3000);
return version.Replace("\r\n", "");
}
}
public string GetVersionOld()
{
using (JarProcess apktoolJar = new JarProcess(JavaPath, JarPath))
{
+13 -5
View File
@@ -16,6 +16,7 @@ using System.Media;
using System.Linq;
using APKToolGUI.Controls;
using Ionic.Zip;
using System.Text.RegularExpressions;
namespace APKToolGUI
{
@@ -668,8 +669,11 @@ namespace APKToolGUI
}
string apktoolVersion = apktool.GetVersion();
if (!String.IsNullOrWhiteSpace(apktoolVersion))
ToLog(ApktoolEventType.None, String.Format(Language.APKToolVersion + " \"{0}\"", apktoolVersion));
string apktoolVersionOld = apktool.GetVersionOld();
if (!String.IsNullOrWhiteSpace(apktoolVersion) && !Regex.IsMatch(apktoolVersion, @"\r\n?|\n"))
ToLog(ApktoolEventType.None, $"{Language.APKToolVersion} \"{apktoolVersion}\"");
else if (!String.IsNullOrWhiteSpace(apktoolVersionOld) && !Regex.IsMatch(apktoolVersionOld, @"\r\n?|\n"))
ToLog(ApktoolEventType.None, $"{Language.APKToolVersion} \"{apktoolVersionOld}\"");
else
ToLog(ApktoolEventType.Error, Language.CantDetectApktoolVersion);
@@ -1393,12 +1397,16 @@ namespace APKToolGUI
{
ToLog(ApktoolEventType.None, javaVersion);
string apktoolVersion = apktool.GetVersion();
string apkeditorVersion = apkeditor.GetVersion();
if (!String.IsNullOrWhiteSpace(apktoolVersion))
ToLog(ApktoolEventType.None, String.Format(Language.APKToolVersion + " {0}", apktoolVersion));
string apktoolVersionOld = apktool.GetVersionOld();
if (!String.IsNullOrWhiteSpace(apktoolVersion) && !Regex.IsMatch(apktoolVersion, @"\r\n?|\n"))
ToLog(ApktoolEventType.None, $"{Language.APKToolVersion} {apktoolVersion}");
else if (!String.IsNullOrWhiteSpace(apktoolVersionOld) && !Regex.IsMatch(apktoolVersionOld, @"\r\n?|\n"))
ToLog(ApktoolEventType.None, $"{Language.APKToolVersion} {apktoolVersionOld}");
else
ToLog(ApktoolEventType.Error, Language.CantDetectApktoolVersion);
string apkeditorVersion = apkeditor.GetVersion();
if (!String.IsNullOrWhiteSpace(apkeditorVersion))
ToLog(ApktoolEventType.None, apkeditorVersion);
else