Skip to content

Commit

Permalink
3.0.1.0
Browse files Browse the repository at this point in the history
See changelog.txt
  • Loading branch information
AndnixSH committed May 5, 2022
1 parent 25b1a40 commit 8e91716
Show file tree
Hide file tree
Showing 13 changed files with 917 additions and 787 deletions.
2 changes: 1 addition & 1 deletion APKToolGUI/ApkTool/AaptParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public bool Parse(string file)
Permissions += StringExt.Regex(@"(?<=name=\')(.*?)(?=\')", line) + "\n";
break;
case "sdkVersion":
SdkVersion += SdkToAndroidVer(StringExt.Regex(@"(?<=sdkVersion:\')(.*?)(?=\')", line));
SdkVersion = SdkToAndroidVer(StringExt.Regex(@"(?<=sdkVersion:\')(.*?)(?=\')", line));
break;
case "targetSdkVersion":
TargetSdkVersion = SdkToAndroidVer(StringExt.Regex(@"(?<=targetSdkVersion:\')(.*?)(?=\')", line));
Expand Down
21 changes: 9 additions & 12 deletions APKToolGUI/ApkTool/ApkFixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace APKToolGUI.ApkTool
Expand Down Expand Up @@ -42,20 +43,16 @@ public static bool ChangeSdkTo29(string path)
string ymlPath = Path.Combine(path, "apktool.yml");
if (File.Exists(ymlPath))
{
string[] Manifest = File.ReadAllLines(ymlPath);
string yml = "";
foreach (string s in Manifest)
string ymll = File.ReadAllText(ymlPath);

int sdk = 30;
int.TryParse(StringExt.Regex(@"(?<= targetSdkVersion: \')(.*?)(?=\')", ymll), out sdk);
if (sdk >= 30)
{
int sdk = 30;
int.TryParse(StringExt.Regex(@"(?<= targetSdkVersion: \')(.*?)(?=\')", s), out sdk);
if (sdk >= 30)
{
yml += " targetSdkVersion: '29'\n";
return true;
}
yml += s + "\n";
ymll = ymll.Replace("targetSdkVersion: '" + sdk + "'", "targetSdkVersion: '29'");
File.WriteAllText(ymlPath, ymll);
return true;
}
File.WriteAllText(ymlPath, yml);
}
return false;
}
Expand Down
11 changes: 7 additions & 4 deletions APKToolGUI/ApkTool/Apktool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static class BuildKeys
public const string OutputAppPath = " -o"; // The name of apk that gets written. Default is dist/name.apk
public const string NoCrunch = " -nc"; // Disable crunching of resource files during the build step.
public const string ApiLevel = " -api"; //The numeric api-level of the file to generate, e.g. 14 for ICS.
public const string UseAapt2 = " --use-aapt2"; //Upgrades apktool to use experimental aapt2 binary.
}

static class InstallFrameworkKeys
Expand Down Expand Up @@ -127,7 +128,7 @@ public int Decompile(string inputPath, string outputDir)
apiLevel = String.Format("{0} {1}", DecompileKeys.ApiLevel, Settings.Default.Decode_ApiLevel);
keyOutputDir = String.Format("{0} \"{1}\"", DecompileKeys.OutputDir, outputDir);

string args = String.Format("d{0}{1}{2}{3}{4}{5}{6}{7}{8}{9} \"{10}\"", keyNoSrc, keyNoRes, keyForce, onlyMainClasses, noDebugInfo, keyMatchOriginal, keyFramePath, keyKeepBrokenRes, keyOutputDir, apiLevel, inputPath);
string args = String.Format($"d{keyNoSrc}{keyNoRes}{keyForce}{onlyMainClasses}{noDebugInfo}{keyMatchOriginal}{keyFramePath}{keyKeepBrokenRes}{apiLevel}{keyOutputDir} \"{inputPath}\"");

Start(args);
BeginOutputReadLine();
Expand All @@ -140,7 +141,7 @@ public int Build(string outputFile)
{
string decApkDir = Settings.Default.Build_InputDir;

string keyForceAll = null, keyAapt = null, keyCopyOriginal = null, noCrunch = null, keyFramePath = null, keyOutputAppPath = null, apiLevel = null;
string keyForceAll = null, keyAapt = null, keyCopyOriginal = null, noCrunch = null, keyFramePath = null, keyOutputAppPath = null, apiLevel = null, useAapt2 = null;
if (Settings.Default.Build_ForceAll)
keyForceAll = BuildKeys.ForceAll;
if (Settings.Default.Build_CopyOriginal)
Expand All @@ -153,9 +154,11 @@ public int Build(string outputFile)
keyFramePath = String.Format("{0} \"{1}\"", BuildKeys.FrameworkPath, Settings.Default.Build_FrameDir);
if (Settings.Default.Build_SetApiLevel)
apiLevel = String.Format("{0} {1}", DecompileKeys.ApiLevel, Settings.Default.Build_ApiLevel);
if (Settings.Default.Build_UseAapt2)
useAapt2 = BuildKeys.UseAapt2;
keyOutputAppPath = String.Format("{0} \"{1}\"", BuildKeys.OutputAppPath, outputFile);

string args = String.Format("b{0}{1}{2}{3}{4}{5}{6} \"{7}\"", keyForceAll, keyAapt, keyCopyOriginal, noCrunch, keyFramePath, keyOutputAppPath, apiLevel, decApkDir);
string args = String.Format($"b{keyForceAll}{keyAapt}{keyCopyOriginal}{noCrunch}{keyFramePath}{apiLevel}{useAapt2}{keyOutputAppPath} \"{decApkDir}\"");

Start(args);
BeginOutputReadLine();
Expand All @@ -174,7 +177,7 @@ public int InstallFramework()
if (Settings.Default.InstallFramework_UseTag)
keyTag = String.Format("{0} \"{1}\"", InstallFrameworkKeys.Tag, Settings.Default.InstallFramework_Tag);

string args = String.Format("if{0}{1} \"{2}\"", keyFrameDir, keyTag, inputPath);
string args = String.Format($"if{keyFrameDir}{keyTag} \"{inputPath}\"");

Start(args);
BeginOutputReadLine();
Expand Down
Loading

0 comments on commit 8e91716

Please sign in to comment.