27 Commits

Author SHA1 Message Date
AndnixSH 8f72cf9dee Merge branch 'pr/48' 2026-05-03 13:17:37 +02:00
AndnixSH 79e8cd2ef9 Refactor + Add Apktool version checks 2026-05-03 11:56:56 +02:00
AndnixSH 5be8c9623a Merge branch 'pr/49' 2026-04-28 17:56:14 +02:00
backryun 08fb90285c ci: package artifact with exe/resources/changelog only 2026-03-05 20:56:43 +09:00
backryun e0e99c862f fix: correct signing/build option handling and drag-drop stability
Use Sign_UseOutputDir in signing flows instead of Zipalign_UseOutputDir
Fix apktool arg composition so -api and -j are both preserved
Fix JarProcess JVM arg order and default java executable handling
Replace non-functional splitTypes string replacement with Regex.Replace in ApkFixer
Remove duplicate private-key click handler registration
Fix APK info drag-drop target textbox and guard drag-drop helpers against empty drops
Keep DEBUG/RELEASE catch split to avoid CS0168 in Release
2026-03-05 20:37:17 +09:00
backryun cfb094a275 Update ADB, apktool, APKEditor 2026-03-05 20:11:35 +09:00
Aleksandr ca58db1975 Update Russian localization 2026-02-16 10:39:19 +03:00
AndnixSH 5e6eee2f5e Update README.md 2026-01-20 21:41:23 +01:00
AndnixSH eb39b5bf69 Update README.md 2026-01-20 21:23:08 +01:00
AndnixSH 8230d8239d Auto remove remaining split elements 2026-01-20 20:59:43 +01:00
AndnixSH 824aadbce1 Update changelog.txt 2025-11-26 17:39:45 +01:00
AndnixSH e12fc939b9 Change version to 3.3.2.1 2025-11-26 17:37:03 +01:00
AndnixSH 0b043a4a3b Merged some changes from #45
- Refactor language selection
- Export image when clicking on icon box in APK Info
- Build overflow
2025-11-25 21:48:22 +01:00
AndnixSH f974e198d5 Refactor 2025-11-17 19:52:36 +01:00
AndnixSH 8c43f59bd1 Fix *.zip and *.apkm not selectable for merging #43 2025-11-15 11:37:57 +01:00
backryun bd1dcf6f64 Refactoring Code(Last) 2025-11-05 01:01:37 +09:00
backryun e0018909dc Refactoring Code(Part 2) 2025-11-05 00:38:36 +09:00
backryun 580c49b59c Refactoring Code(Part 1) 2025-10-20 06:58:03 +09:00
backryun 328736bbab Add Android 36 string 2025-10-20 04:22:55 +09:00
backryun a294aa5a40 Update aapt, zipalign 2025-10-20 04:15:36 +09:00
backryun 17289ff3f3 Update APKEditor & apktool 2025-10-20 04:11:53 +09:00
backryun 4471de12d5 Update Dependencys 2025-10-20 04:08:35 +09:00
backryun 469ccb6c9c Fix build warning 2025-10-20 04:04:41 +09:00
AndnixSH bfd2f41c88 Update changelog.txt 2025-08-02 17:18:03 +02:00
AndnixSH 6cda22c47e Update AssemblyInfo.cs 2025-08-02 17:18:01 +02:00
AndnixSH 73dbd422a8 UI changes 2025-08-02 14:18:24 +02:00
AndnixSH 6411889613 Use aapt2 is false by default 2025-08-02 13:40:07 +02:00
53 changed files with 2518 additions and 1700 deletions
+47
View File
@@ -0,0 +1,47 @@
name: Build
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
name: Checkout Code
- name: Setup MSBuild Path
uses: microsoft/setup-msbuild@v1.3.1
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Restore NuGet Packages
run: nuget restore APKToolGUI.sln
- name: Build Application
run: msbuild APKToolGUI.sln /p:Configuration=Release
- name: Create package directory
run: mkdir package
- name: Copy essential files to package
shell: pwsh
run: |
Copy-Item APKToolGUI/bin/Release/APKToolGUI.exe package/
Copy-Item changelog.txt package/Changelog.txt
if (Test-Path APKToolGUI/bin/Release/Resources) {
Copy-Item APKToolGUI/bin/Release/Resources package/ -Recurse
}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: APKToolGUI
path: package/
+26 -25
View File
@@ -124,11 +124,11 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Collections.Immutable, Version=9.0.0.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.9.0.3\lib\net462\System.Collections.Immutable.dll</HintPath>
<Reference Include="System.Collections.Immutable, Version=9.0.0.10, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.9.0.10\lib\net462\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.configuration" />
@@ -140,8 +140,8 @@
<Reference Include="System.Core" />
<Reference Include="System.Data.OracleClient" />
<Reference Include="System.Design" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=9.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.9.0.3\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
<Reference Include="System.Diagnostics.DiagnosticSource, Version=9.0.0.10, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.9.0.10\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.Tracing, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.Tracing.4.3.0\lib\net462\System.Diagnostics.Tracing.dll</HintPath>
@@ -149,8 +149,8 @@
<Private>True</Private>
</Reference>
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Formats.Nrbf, Version=9.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Formats.Nrbf.9.0.3\lib\net462\System.Formats.Nrbf.dll</HintPath>
<Reference Include="System.Formats.Nrbf, Version=9.0.0.10, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Formats.Nrbf.9.0.10\lib\net462\System.Formats.Nrbf.dll</HintPath>
</Reference>
<Reference Include="System.Globalization.Calendars, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll</HintPath>
@@ -184,8 +184,8 @@
<Private>True</Private>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.1\lib\net462\System.Memory.dll</HintPath>
<Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@@ -199,27 +199,27 @@
<Private>True</Private>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
<Reference Include="System.Numerics.Vectors, Version=4.1.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Reflection, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Reflection.Metadata, Version=9.0.0.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.9.0.3\lib\net462\System.Reflection.Metadata.dll</HintPath>
<Reference Include="System.Reflection.Metadata, Version=9.0.0.10, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.9.0.10\lib\net462\System.Reflection.Metadata.dll</HintPath>
</Reference>
<Reference Include="System.Resources.Extensions, Version=9.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Resources.Extensions.9.0.3\lib\net462\System.Resources.Extensions.dll</HintPath>
<Reference Include="System.Resources.Extensions, Version=9.0.0.10, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Resources.Extensions.9.0.10\lib\net462\System.Resources.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Runtime, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.4.3.1\lib\net462\System.Runtime.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.1\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Extensions, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.Extensions.4.3.1\lib\net462\System.Runtime.Extensions.dll</HintPath>
@@ -260,15 +260,15 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Permissions, Version=9.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Permissions.9.0.3\lib\net462\System.Security.Permissions.dll</HintPath>
<Reference Include="System.Security.Permissions, Version=9.0.0.10, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Permissions.9.0.10\lib\net462\System.Security.Permissions.dll</HintPath>
</Reference>
<Reference Include="System.Security.Principal.Windows, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Principal.Windows.5.0.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
</Reference>
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Text.Encoding.CodePages, Version=9.0.0.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encoding.CodePages.9.0.3\lib\net462\System.Text.Encoding.CodePages.dll</HintPath>
<Reference Include="System.Text.Encoding.CodePages, Version=9.0.0.10, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encoding.CodePages.9.0.10\lib\net462\System.Text.Encoding.CodePages.dll</HintPath>
</Reference>
<Reference Include="System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.RegularExpressions.4.3.1\lib\net463\System.Text.RegularExpressions.dll</HintPath>
@@ -454,7 +454,6 @@
</ItemGroup>
<ItemGroup>
<Content Include="android-thin.ico" />
<Content Include="ILLink\ILLink.Descriptors.LibraryBuild.xml" />
<None Include="Resources\info.png" />
<None Include="Resources\waiting.png" />
<None Include="Resources\warning.png" />
@@ -498,7 +497,8 @@
<Error Condition="!Exists('..\packages\Resource.Embedder.2.2.0\build\Resource.Embedder.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Resource.Embedder.2.2.0\build\Resource.Embedder.props'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.6.0.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.6.0.0\build\Costura.Fody.props'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.6.0.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.6.0.0\build\Costura.Fody.targets'))" />
<Error Condition="!Exists('..\packages\Fody.6.9.2\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.9.2\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Fody.6.9.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.9.3\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets'))" />
</Target>
<Import Project="..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
<PropertyGroup>
@@ -506,7 +506,6 @@
</PostBuildEvent>
</PropertyGroup>
<Import Project="..\packages\Costura.Fody.6.0.0\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.6.0.0\build\Costura.Fody.targets')" />
<Import Project="..\packages\Fody.6.9.2\build\Fody.targets" Condition="Exists('..\packages\Fody.6.9.2\build\Fody.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@@ -514,4 +513,6 @@
<Target Name="AfterBuild">
</Target>
-->
<Import Project="..\packages\Fody.6.9.3\build\Fody.targets" Condition="Exists('..\packages\Fody.6.9.3\build\Fody.targets')" />
<Import Project="..\packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets" Condition="Exists('..\packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets')" />
</Project>
+35 -20
View File
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
@@ -101,31 +102,32 @@ namespace APKToolGUI.Utils
List<string> nativecode = new List<string> { };
List<string> nativecode2 = new List<string> { };
StringBuilder permissionsBuilder = new StringBuilder();
foreach (string line in lines)
{
switch (line.Split(':')[0])
{
case "package":
PackageName = StringExt.Regex(@"(?<=package: name=\')(.*?)(?=\')", line);
VersionName = StringExt.Regex(@"(?<=versionName=\')(.*?)(?=\')", line);
VersionCode = StringExt.Regex(@"(?<=versionCode=\')(.*?)(?=\')", line);
PackageName = StringExt.RegexExtract(@"(?<=package: name=\')(.*?)(?=\')", line);
VersionName = StringExt.RegexExtract(@"(?<=versionName=\')(.*?)(?=\')", line);
VersionCode = StringExt.RegexExtract(@"(?<=versionCode=\')(.*?)(?=\')", line);
break;
case "uses-permission":
Permissions += StringExt.Regex(@"(?<=name=\')(.*?)(?=\')", line) + "\n";
permissionsBuilder.AppendLine(StringExt.RegexExtract(@"(?<=name=\')(.*?)(?=\')", line));
break;
case "sdkVersion":
MinSdkVersionDetailed = SdkToAndroidVer(StringExt.Regex(@"(?<=sdkVersion:\')(.*?)(?=\')", line));
MinSdkVersion = StringExt.Regex(@"(?<=sdkVersion:\')(.*?)(?=\')", line);
MinSdkVersionDetailed = SdkToAndroidVer(StringExt.RegexExtract(@"(?<=sdkVersion:\')(.*?)(?=\')", line));
MinSdkVersion = StringExt.RegexExtract(@"(?<=sdkVersion:\')(.*?)(?=\')", line);
break;
case "targetSdkVersion":
TargetSdkVersionDetailed = SdkToAndroidVer(StringExt.Regex(@"(?<=targetSdkVersion:\')(.*?)(?=\')", line));
TargetSdkVersion = StringExt.Regex(@"(?<=targetSdkVersion:\')(.*?)(?=\')", line);
TargetSdkVersionDetailed = SdkToAndroidVer(StringExt.RegexExtract(@"(?<=targetSdkVersion:\')(.*?)(?=\')", line));
TargetSdkVersion = StringExt.RegexExtract(@"(?<=targetSdkVersion:\')(.*?)(?=\')", line);
break;
case "application-label":
AppName = StringExt.Regex(@"(?<=application-label:\')(.*?)(?=\')", line);
AppName = StringExt.RegexExtract(@"(?<=application-label:\')(.*?)(?=\')", line);
break;
case "launchable-activity":
LaunchableActivity = StringExt.Regex(@"(?<=name=\')(.*?)(?=\')", line);
LaunchableActivity = StringExt.RegexExtract(@"(?<=name=\')(.*?)(?=\')", line);
break;
case "supports-screens":
var screens = Regex.Matches(line.Split(':')[1], @"(?<= \')(.*?)(?=\')").Cast<Match>().Select(m => m.Value).ToList();
@@ -147,6 +149,8 @@ namespace APKToolGUI.Utils
break;
}
}
Permissions = permissionsBuilder.ToString();
List<string> combinedList = nativecode2.Concat(nativecode).ToList();
NativeCode += string.Join(", ", combinedList);
ApkFile = file;
@@ -157,13 +161,13 @@ namespace APKToolGUI.Utils
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);
AppIcon120 = StringExt.RegexExtract(@"(?<=application-icon-120:\')(.*?)(?=\')", FullInfo);
AppIcon160 = StringExt.RegexExtract(@"(?<=application-icon-160:\')(.*?)(?=\')", FullInfo);
AppIcon240 = StringExt.RegexExtract(@"(?<=application-icon-240:\')(.*?)(?=\')", FullInfo);
AppIcon320 = StringExt.RegexExtract(@"(?<=application-icon-320:\')(.*?)(?=\')", FullInfo);
AppIcon480 = StringExt.RegexExtract(@"(?<=application-icon-480:\')(.*?)(?=\')", FullInfo);
AppIcon640 = StringExt.RegexExtract(@"(?<=application-icon-640:\')(.*?)(?=\')", FullInfo);
AppIcon65534 = StringExt.RegexExtract(@"(?<=application-icon-65534:\')(.*?)(?=\')", FullInfo);
result = true;
}
@@ -252,12 +256,21 @@ namespace APKToolGUI.Utils
//File.WriteAllText("R:\\t.txt", ps);
string icondl = Path.Combine(cacheDir, "icon.png");
Directory.CreateDirectory(cacheDir);
w.DownloadFile(StringExt.Regex(@"(?<=\""image\"":\"")(.*?)(?=\"",\"")", ps), icondl);
w.DownloadFile(StringExt.RegexExtract(@"(?<=\""image\"":\"")(.*?)(?=\"",\"")", ps), icondl);
iconLocation = icondl;
}
catch
catch (System.Net.WebException ex)
{
Debug.WriteLine($"[AaptParser] Failed to download icon from web: {ex.Message}");
// Icon download failure is not critical, use default value
}
catch (IOException ex)
{
Debug.WriteLine($"[AaptParser] Failed to save icon file: {ex.Message}");
}
catch (Exception ex)
{
Debug.WriteLine($"[AaptParser] Unexpected error getting icon: {ex.Message}");
}
}
@@ -269,6 +282,8 @@ namespace APKToolGUI.Utils
{
switch (sdk)
{
case "36":
return sdk + ": Android 16";
case "35":
return sdk + ": Android 15";
case "34":
+78 -23
View File
@@ -10,9 +10,11 @@ using System.Windows.Shapes;
namespace APKToolGUI
{
public class Adb
public class Adb : IDisposable
{
Process processAdb;
private bool disposed = false;
static class Keys
{
public const string Devices = " devices -l"; //list connected devices (-l for long output)
@@ -43,10 +45,10 @@ namespace APKToolGUI
processAdb = new Process();
processAdb.EnableRaisingEvents = true;
processAdb.StartInfo.FileName = AdbFileName;
processAdb.StartInfo.UseShellExecute = false; //отключаем использование оболочки, чтобы можно было читать данные вывода
processAdb.StartInfo.RedirectStandardOutput = true; // разрешаем перенаправление данных вывода
processAdb.StartInfo.RedirectStandardError = true; // разрешаем перенаправление данных вывода
processAdb.StartInfo.CreateNoWindow = true; //запрещаем создавать окно для запускаемой программы
processAdb.StartInfo.UseShellExecute = false; // Disable shell execution to read output data
processAdb.StartInfo.RedirectStandardOutput = true; // Allow output redirection
processAdb.StartInfo.RedirectStandardError = true; // Allow error redirection
processAdb.StartInfo.CreateNoWindow = true; // Do not create window for the launched program
processAdb.Exited += processAdb_Exited;
}
@@ -64,14 +66,62 @@ namespace APKToolGUI
{
foreach (var process in Process.GetProcessesByName("adb"))
{
if (process.Id == processAdb.Id)
using (process)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)processAdb.Id);
process.Kill();
if (process.Id == processAdb.Id)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)processAdb.Id);
process.Kill();
}
}
}
}
catch { }
catch (Exception ex)
{
Debug.WriteLine($"[Adb] Cancel failed: {ex.Message}");
// Process termination failure is not critical, so continue
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if (processAdb != null)
{
try
{
if (!processAdb.HasExited)
{
processAdb.Kill();
}
}
catch (Exception ex)
{
Debug.WriteLine($"[Adb] Error disposing process: {ex.Message}");
}
finally
{
processAdb.Dispose();
processAdb = null;
}
}
}
disposed = true;
}
}
~Adb()
{
Dispose(false);
}
public int Install(string device, string inputApk)
@@ -120,26 +170,31 @@ namespace APKToolGUI
{
Log.d("ADB: " + adbFileName + " " + Keys.Devices);
Process process = new Process();
process.EnableRaisingEvents = true;
process.StartInfo.FileName = adbFileName;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
process.EnableRaisingEvents = false;
process.StartInfo.Arguments = Keys.Devices;
process.Start();
string devices = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return devices;
using (Process process = new Process())
{
process.EnableRaisingEvents = true;
process.StartInfo.FileName = adbFileName;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
process.EnableRaisingEvents = false;
process.StartInfo.Arguments = Keys.Devices;
process.Start();
string devices = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return devices;
}
}
public void KillProcess()
{
foreach (var process in Process.GetProcessesByName("adb"))
{
process.Kill();
using (process)
{
process.Kill();
}
}
}
}
+55 -5
View File
@@ -8,8 +8,10 @@ using System.Windows.Forms;
namespace APKToolGUI
{
public class ApkEditor : JarProcess
public class ApkEditor : JarProcess, IDisposable
{
private bool disposed = false;
public new event ApkEditorExitedEventHandler Exited;
string _jarPath;
@@ -72,14 +74,28 @@ namespace APKToolGUI
{
foreach (var process in Process.GetProcessesByName("java"))
{
if (process.Id == Id)
using (process)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)Id);
process.Kill();
if (process.Id == Id)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)Id);
process.Kill();
}
}
}
}
catch { }
catch (InvalidOperationException ex)
{
Debug.WriteLine($"[ApkEditor] Process already exited: {ex.Message}");
}
catch (System.ComponentModel.Win32Exception ex)
{
Debug.WriteLine($"[ApkEditor] Failed to access process: {ex.Message}");
}
catch (Exception ex)
{
Debug.WriteLine($"[ApkEditor] Failed to cancel process: {ex.Message}");
}
}
public int Merge(string input, string output)
@@ -158,6 +174,40 @@ namespace APKToolGUI
return version.Replace("\r\n", "");
}
}
public new void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected new virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
try
{
Cancel();
}
catch (Exception ex)
{
Debug.WriteLine($"[ApkEditor] Error during disposal: {ex.Message}");
}
finally
{
base.Dispose();
}
}
disposed = true;
}
}
~ApkEditor()
{
Dispose(false);
}
}
public class ApkEditorExitedEventArgs : EventArgs
+70 -16
View File
@@ -1,7 +1,9 @@
using APKToolGUI.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
@@ -15,28 +17,49 @@ namespace APKToolGUI.ApkTool
public static bool FixAndroidManifest(string decompilePath)
{
string manifestPath = Path.Combine(decompilePath, "AndroidManifest.xml");
if (File.Exists(manifestPath))
if (!File.Exists(manifestPath))
return false;
try
{
string maniFestText = File.ReadAllText(manifestPath);
maniFestText = maniFestText.Replace("\\ ", "\\u003");
maniFestText = maniFestText.Replace("android:isSplitRequired=\"true\"", "");
maniFestText = maniFestText.Replace("android:extractNativeLibs=\"false\"", "");
maniFestText = maniFestText.Replace("android:useEmbeddedDex=\"true\"", "");
maniFestText = maniFestText.Replace("android:manageSpace=\"true\"", "");
maniFestText = maniFestText.Replace("android:localeConfig=\"@xml/locales_config\"", "");
maniFestText = maniFestText.Replace("STAMP_TYPE_DISTRIBUTION_APK", "STAMP_TYPE_STANDALONE_APK");
File.WriteAllText(manifestPath, maniFestText);
string manifestText = File.ReadAllText(manifestPath);
manifestText = manifestText.Replace("\\ ", "\\u003");
manifestText = manifestText.Replace("android:isSplitRequired=\"true\"", "");
manifestText = manifestText.Replace("android:extractNativeLibs=\"false\"", "");
manifestText = manifestText.Replace("android:useEmbeddedDex=\"true\"", "");
manifestText = manifestText.Replace("android:manageSpace=\"true\"", "");
manifestText = manifestText.Replace("android:localeConfig=\"@xml/locales_config\"", "");
manifestText = manifestText.Replace("STAMP_TYPE_DISTRIBUTION_APK", "STAMP_TYPE_STANDALONE_APK");
manifestText = Regex.Replace(manifestText, @"\s*android:requiredSplitTypes=""[^""]*""", "");
manifestText = Regex.Replace(manifestText, @"\s*android:splitTypes=""[^""]*""", "");
File.WriteAllText(manifestPath, manifestText);
return true;
}
return false;
catch (IOException ex)
{
System.Diagnostics.Debug.WriteLine($"[ApkFixer] Failed to fix AndroidManifest.xml: {ex.Message}");
return false;
}
catch (UnauthorizedAccessException ex)
{
System.Diagnostics.Debug.WriteLine($"[ApkFixer] Access denied to AndroidManifest.xml: {ex.Message}");
return false;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"[ApkFixer] Unexpected error fixing AndroidManifest.xml: {ex.Message}");
return false;
}
}
public static bool FixApktoolYml(string decompilePath)
{
string ymlPath = Path.Combine(decompilePath, "apktool.yml");
if (File.Exists(ymlPath))
if (!File.Exists(ymlPath))
return false;
try
{
string yml = File.ReadAllText(ymlPath);
yml = yml.Replace("sparseResources: true", "sparseResources: false");
@@ -44,18 +67,49 @@ namespace APKToolGUI.ApkTool
File.WriteAllText(ymlPath, yml);
return true;
}
return false;
catch (IOException ex)
{
System.Diagnostics.Debug.WriteLine($"[ApkFixer] Failed to fix apktool.yml: {ex.Message}");
return false;
}
catch (UnauthorizedAccessException ex)
{
System.Diagnostics.Debug.WriteLine($"[ApkFixer] Access denied to apktool.yml: {ex.Message}");
return false;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"[ApkFixer] Unexpected error fixing apktool.yml: {ex.Message}");
return false;
}
}
public static bool RemoveApkToolDummies(string path)
{
string resPath = Path.Combine(path, "res", "values");
if (Directory.Exists(resPath))
if (!Directory.Exists(resPath))
return false;
try
{
DirectoryUtils.ReplaceinFilesRegex(resPath, "(.*(?:APKTOOL_DUMMY).*)", "");
return true;
}
return false;
catch (IOException ex)
{
System.Diagnostics.Debug.WriteLine($"[ApkFixer] Failed to remove APKTOOL_DUMMY: {ex.Message}");
return false;
}
catch (UnauthorizedAccessException ex)
{
System.Diagnostics.Debug.WriteLine($"[ApkFixer] Access denied while removing APKTOOL_DUMMY: {ex.Message}");
return false;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"[ApkFixer] Unexpected error removing APKTOOL_DUMMY: {ex.Message}");
return false;
}
}
}
}
+218 -71
View File
@@ -11,56 +11,121 @@ using Java;
namespace APKToolGUI
{
public class Apktool : JarProcess
public class Apktool : JarProcess, IDisposable
{
enum ApktoolActionType
private bool disposed = false;
private static readonly Regex ApktoolVersionRegex = new Regex(@"v?(?<version>\d+\.\d+\.\d+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public Version ParsedVersion { get; private set; }
public string Version { get; private set; }
public Apktool(string javaPath, string jarPath) : base(javaPath, jarPath)
{
Decompile,
Build,
InstallFramework,
ClearFramework,
Null
Exited += Apktool_Exited;
OutputDataReceived += Apktool_OutputDataReceived;
ErrorDataReceived += Apktool_ErrorDataReceived;
string apktoolVersion = GetVersion();
string apktoolVersionOld = GetVersionOld();
if (!String.IsNullOrWhiteSpace(apktoolVersion) && !Regex.IsMatch(apktoolVersion, @"\r\n?|\n"))
Version = apktoolVersion;
else if (!String.IsNullOrWhiteSpace(apktoolVersionOld) && !Regex.IsMatch(apktoolVersionOld, @"\r\n?|\n"))
Version = apktoolVersionOld;
ParsedVersion = ParseVersion(Version);
Debug.WriteLine($"[Apktool] Parsed version: {ParsedVersion}");
}
static class DecompileKeys
{
public const string NoSource = " -s"; //Do not decode sources.
public const string NoResource = " -r"; //Do not decode resources.
public const string NoDebugInfo = " -b"; //don't write out debug info (.local, .param, .line, etc.)
public const string Force = " -f"; //Skip changes detection and build all files.
public const string FrameworkPath = " -p"; //Uses framework files located in <dir>.
public const string KeepBrokenResource = " -k"; //Use if there was an error and some resources were dropped
public const string MatchOriginal = " -m"; //Keeps files to closest to original as possible. Prevents rebuild.
public const string OutputDir = " -o"; //The name of folder that gets written. Default is apk.out
public const string OnlyMainClasses = " -only-main-classes"; //Only disassemble the main dex classes (classes[0-9]*.dex) in the root.
public const string ApiLevel = " -api"; //The numeric api-level of the file to generate, e.g. 14 for ICS.
public const string Jobs = " -j"; // Sets the number of threads to use.
//Do not decode sources.
public const string NoSource = " -s";
//Do not decode resources.
public const string NoResource = " -r";
//don't write out debug info (.local, .param, .line, etc.)
//The -b flag has been removed from APKtool 3.0.1 and later versions,
//but the --no-debug-info flag is supported in all versions.
public const string NoDebugInfo = " --no-debug-info";
//Skip changes detection and build all files.
public const string Force = " -f";
//Uses framework files located in <dir>.
public const string FrameworkPath = " -p";
//Use if there was an error and some resources were dropped
public const string KeepBrokenResource = " -k";
//Keeps files to closest to original as possible. Prevents rebuild.
public const string MatchOriginal = " -m";
//The name of folder that gets written. Default is apk.out
public const string OutputDir = " -o";
//Only disassemble the main dex classes (classes[0-9]*.dex) in the root.
public const string OnlyMainClasses = " --only-main-classes";
//The numeric api-level of the file to generate, e.g. 14 for ICS.
public const string ApiLevel = " -api";
// Sets the number of threads to use.
public const string Jobs = " -j";
}
static class BuildKeys
{
public const string ForceAll = " -f"; //Skip changes detection and build all files.
public const string CopyOriginal = " -c"; //opies original AndroidManifest.xml and META-INF. See project page for more info.
public const string Aapt = " -a"; //Loads aapt from specified location.
public const string FrameworkPath = " -p"; //Uses framework files located in <dir>.
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.
public const string NetSecConf = " --net-sec-conf"; //Add a generic Network Security Configuration file in the output APK
public const string Jobs = " -j"; // Sets the number of threads to use.
//Skip changes detection and build all files.
public const string ForceAll = " -f";
//opies original AndroidManifest.xml and META-INF. See project page for more info.
public const string CopyOriginal = " -c";
//Loads aapt from specified location.
public const string Aapt = " -a";
//Uses framework files located in <dir>.
public const string FrameworkPath = " -p";
// The name of apk that gets written. Default is dist/name.apk
public const string OutputAppPath = " -o";
// Disable crunching of resource files during the build step.
public const string NoCrunch = " -nc";
//The numeric api-level of the file to generate, e.g. 14 for ICS.
public const string ApiLevel = " -api";
//Upgrades apktool to use experimental aapt2 binary.
public const string UseAapt2 = " --use-aapt2";
//Add a generic Network Security Configuration file in the output APK
public const string NetSecConf = " --net-sec-conf";
// Sets the number of threads to use.
public const string Jobs = " -j";
}
static class InstallFrameworkKeys
{
public const string FrameDir = " -p"; //Stores framework files into <dir>.
public const string Tag = " -t"; //Tag frameworks using <tag>.
//Stores framework files into <dir>.
public const string FrameDir = " -p";
//Tag frameworks using <tag>.
public const string Tag = " -t";
}
static class EmptyFrameworkKeys
{
public const string FrameDir = " -p"; //Stores framework files into <dir>.
public const string ForceDelete = " -f"; //Force delete destination directory.
//Stores framework files into <dir>.
public const string FrameDir = " -p";
//Force delete destination directory.
public const string ForceDelete = " -f";
//Include all framework files regardless of tag. (3.0.1+)
public const string All = " -a";
}
ApktoolDataReceivedEventHandler onApktoolOutputDataRecieved;
@@ -89,15 +154,6 @@ namespace APKToolGUI
}
}
string _jarPath;
public Apktool(string javaPath, string jarPath) : base(javaPath, jarPath)
{
_jarPath = jarPath;
Exited += Apktool_Exited;
OutputDataReceived += Apktool_OutputDataReceived;
ErrorDataReceived += Apktool_ErrorDataReceived;
}
private void Apktool_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
if (onApktoolErrorDataRecieved != null && e.Data != null)
@@ -118,7 +174,7 @@ namespace APKToolGUI
public int Decompile(string inputPath, string outputDir)
{
string keyNoSrc = null, keyNoRes = null, keyForce = null, keyFramePath = null, keyMatchOriginal = null, keyOutputDir = null, onlyMainClasses = null, noDebugInfo = null, keyKeepBrokenRes = null, apiLevel = null;
string keyNoSrc = null, keyNoRes = null, keyForce = null, keyFramePath = null, keyMatchOriginal = null, keyOutputDir = null, onlyMainClasses = null, noDebugInfo = null, keyKeepBrokenRes = null, apiLevel = null, jobs = null;
if (Settings.Default.Decode_NoSrc)
keyNoSrc = DecompileKeys.NoSource;
@@ -130,7 +186,7 @@ namespace APKToolGUI
keyKeepBrokenRes = DecompileKeys.KeepBrokenResource;
if (Settings.Default.Decode_MatchOriginal)
keyMatchOriginal = DecompileKeys.MatchOriginal;
if (Settings.Default.Decode_OnlyMainClasses && !Settings.Default.Decode_NoSrc)
if (Settings.Default.Decode_OnlyMainClasses && !Settings.Default.Decode_NoSrc && IsVersionAtMost("2.12.1"))
onlyMainClasses = DecompileKeys.OnlyMainClasses;
if (Settings.Default.Decode_NoDebugInfo)
noDebugInfo = DecompileKeys.NoDebugInfo;
@@ -141,12 +197,12 @@ namespace APKToolGUI
if (Settings.Default.Decode_SetApiLevel)
apiLevel = String.Format("{0} {1}", DecompileKeys.ApiLevel, Settings.Default.Decode_ApiLevel);
if (Settings.Default.Decode_SetJobs)
apiLevel = String.Format("{0} {1}", DecompileKeys.Jobs, Settings.Default.Decode_Jobs);
jobs = String.Format("{0} {1}", DecompileKeys.Jobs, Settings.Default.Decode_Jobs);
keyOutputDir = String.Format("{0} \"{1}\"", DecompileKeys.OutputDir, outputDir);
string args = String.Format($"d{keyNoSrc}{keyNoRes}{keyForce}{onlyMainClasses}{noDebugInfo}{keyMatchOriginal}{keyFramePath}{keyKeepBrokenRes}{apiLevel}{keyOutputDir} \"{inputPath}\"");
string args = String.Format($"d{keyNoSrc}{keyNoRes}{keyForce}{onlyMainClasses}{noDebugInfo}{keyMatchOriginal}{keyFramePath}{keyKeepBrokenRes}{apiLevel}{jobs}{keyOutputDir} \"{inputPath}\"");
Log.d("Apktool CMD: " + _jarPath + " " + args);
Log.d("Apktool CMD: " + JarPath + " " + args);
Start(args);
BeginOutputReadLine();
@@ -155,28 +211,9 @@ namespace APKToolGUI
return ExitCode;
}
public void Cancel()
{
try
{
foreach (var process in Process.GetProcessesByName("java"))
{
if (process.Id == Id)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)Id);
process.Kill();
}
}
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
public int Build(string inputFolder, string outputFile)
{
string keyForceAll = null, keyAapt = null, keyCopyOriginal = null, noCrunch = null, keyFramePath = null, keyOutputAppPath = null, apiLevel = null, useAapt2 = null, netSecConf = null;
string keyForceAll = null, keyAapt = null, keyCopyOriginal = null, noCrunch = null, keyFramePath = null, keyOutputAppPath = null, apiLevel = null, jobs = null, useAapt2 = null, netSecConf = null;
if (Settings.Default.Build_ForceAll)
keyForceAll = BuildKeys.ForceAll;
@@ -193,16 +230,16 @@ namespace APKToolGUI
if (Settings.Default.Build_SetApiLevel)
apiLevel = String.Format("{0} {1}", BuildKeys.ApiLevel, Settings.Default.Build_ApiLevel);
if (Settings.Default.Build_SetJobs)
apiLevel = String.Format("{0} {1}", BuildKeys.Jobs, Settings.Default.Build_Jobs);
jobs = String.Format("{0} {1}", BuildKeys.Jobs, Settings.Default.Build_Jobs);
if (Settings.Default.Build_UseAapt2)
useAapt2 = BuildKeys.UseAapt2;
if (Settings.Default.Build_NetSecConf)
netSecConf = BuildKeys.NetSecConf;
keyOutputAppPath = String.Format("{0} \"{1}\"", BuildKeys.OutputAppPath, outputFile);
string args = String.Format($"b{keyForceAll}{keyAapt}{keyCopyOriginal}{noCrunch}{keyFramePath}{apiLevel}{useAapt2}{netSecConf}{keyOutputAppPath} \"{inputFolder}\"");
string args = String.Format($"b{keyForceAll}{keyAapt}{keyCopyOriginal}{noCrunch}{keyFramePath}{apiLevel}{jobs}{useAapt2}{netSecConf}{keyOutputAppPath} \"{inputFolder}\"");
Log.d("Apktool CMD: " + _jarPath + " " + args);
Log.d("Apktool CMD: " + JarPath + " " + args);
Start(args);
BeginOutputReadLine();
@@ -223,7 +260,7 @@ namespace APKToolGUI
string args = String.Format($"if{keyFrameDir}{keyTag} \"{inputPath}\"");
Log.d("Apktool CMD: " + _jarPath + " " + args);
Log.d("Apktool CMD: " + JarPath + " " + args);
Start(args);
BeginOutputReadLine();
@@ -241,8 +278,10 @@ namespace APKToolGUI
keyFramePath = String.Format("{0} \"{1}\"", DecompileKeys.FrameworkPath, Program.STANDALONE_FRAMEWORK_DIR);
string args = String.Format($"empty-framework-dir {EmptyFrameworkKeys.ForceDelete} {keyFramePath}");
if (IsVersionAtLeast("3.0.1"))
args = String.Format($"clean-frameworks {EmptyFrameworkKeys.All} {keyFramePath}");
Log.d("Apktool CMD: " + _jarPath + " " + args);
Log.d("Apktool CMD: " + JarPath + " " + args);
Start(args);
BeginOutputReadLine();
@@ -251,6 +290,41 @@ namespace APKToolGUI
return ExitCode;
}
public bool IsVersionAtLeast(string minimumVersion)
{
if (String.IsNullOrWhiteSpace(minimumVersion))
throw new ArgumentException("Minimum version cannot be null or empty.", nameof(minimumVersion));
return ParsedVersion.CompareTo(new Version(minimumVersion)) >= 0;
}
public bool IsVersionAtMost(string maximumVersion)
{
if (String.IsNullOrWhiteSpace(maximumVersion))
throw new ArgumentException("Maximum version cannot be null or empty.", nameof(maximumVersion));
return ParsedVersion.CompareTo(new Version(maximumVersion)) <= 0;
}
private static Version ParseVersion(string rawVersion)
{
if (String.IsNullOrWhiteSpace(rawVersion))
return null;
Match match = ApktoolVersionRegex.Match(rawVersion.Trim());
if (!match.Success)
return null;
try
{
return new Version(match.Groups["version"].Value);
}
catch (Exception)
{
return null;
}
}
public string GetVersion()
{
using (JarProcess apktoolJar = new JarProcess(JavaPath, JarPath))
@@ -274,6 +348,70 @@ namespace APKToolGUI
return version.Replace("\r\n", "");
}
}
public void Cancel()
{
try
{
foreach (var process in Process.GetProcessesByName("java"))
{
using (process)
{
if (process.Id == Id)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)Id);
process.Kill();
}
}
}
}
catch (InvalidOperationException ex)
{
Debug.WriteLine($"[Apktool] Process already exited: {ex.Message}");
}
catch (System.ComponentModel.Win32Exception ex)
{
Debug.WriteLine($"[Apktool] Failed to access process: {ex.Message}");
}
catch (Exception ex)
{
Debug.WriteLine($"[Apktool] Failed to cancel process: {ex.Message}");
}
}
public new void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected new virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
try
{
Cancel();
}
catch (Exception ex)
{
Debug.WriteLine($"[Apktool] Error during disposal: {ex.Message}");
}
finally
{
base.Dispose();
}
}
disposed = true;
}
}
~Apktool()
{
Dispose(false);
}
}
public delegate void ApktoolDataReceivedEventHandler(Object sender, ApktoolDataReceivedEventArgs e);
@@ -354,4 +492,13 @@ namespace APKToolGUI
Error,
Unknown
}
enum ApktoolActionType
{
Decompile,
Build,
InstallFramework,
ClearFramework,
Null
}
}
+55 -5
View File
@@ -7,8 +7,10 @@ using APKToolGUI.Utils;
namespace APKToolGUI
{
public class Baksmali : JarProcess
public class Baksmali : JarProcess, IDisposable
{
private bool disposed = false;
public new event BaksmaliExitedEventHandler Exited;
string _jarPath;
@@ -72,14 +74,28 @@ namespace APKToolGUI
{
foreach (var process in Process.GetProcessesByName("java"))
{
if (process.Id == Id)
using (process)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)Id);
process.Kill();
if (process.Id == Id)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)Id);
process.Kill();
}
}
}
}
catch { }
catch (InvalidOperationException ex)
{
Debug.WriteLine($"[Baksmali] Process already exited: {ex.Message}");
}
catch (System.ComponentModel.Win32Exception ex)
{
Debug.WriteLine($"[Baksmali] Failed to access process: {ex.Message}");
}
catch (Exception ex)
{
Debug.WriteLine($"[Baksmali] Failed to cancel process: {ex.Message}");
}
}
public int Disassemble(string input, string output)
@@ -99,6 +115,40 @@ namespace APKToolGUI
CancelErrorRead();
return ExitCode;
}
public new void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected new virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
try
{
Cancel();
}
catch (Exception ex)
{
Debug.WriteLine($"[Baksmali] Error during disposal: {ex.Message}");
}
finally
{
base.Dispose();
}
}
disposed = true;
}
}
~Baksmali()
{
Dispose(false);
}
}
public class BaksmaliExitedEventArgs : EventArgs
+55 -5
View File
@@ -7,8 +7,10 @@ using System.IO.Packaging;
namespace APKToolGUI
{
public class Signapk : JarProcess
public class Signapk : JarProcess, IDisposable
{
private bool disposed = false;
public new event SignapkExitedEventHandler Exited;
private string lastSourceApk;
@@ -75,14 +77,28 @@ namespace APKToolGUI
{
foreach (var process in Process.GetProcessesByName("java"))
{
if (process.Id == Id)
using (process)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)Id);
process.Kill();
if (process.Id == Id)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)Id);
process.Kill();
}
}
}
}
catch { }
catch (InvalidOperationException ex)
{
Debug.WriteLine($"[Signapk] Process already exited: {ex.Message}");
}
catch (System.ComponentModel.Win32Exception ex)
{
Debug.WriteLine($"[Signapk] Failed to access process: {ex.Message}");
}
catch (Exception ex)
{
Debug.WriteLine($"[Signapk] Failed to cancel process: {ex.Message}");
}
}
public int Sign(string input, string output)
@@ -152,6 +168,40 @@ namespace APKToolGUI
return version;
}
}
public new void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected new virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
try
{
Cancel();
}
catch (Exception ex)
{
Debug.WriteLine($"[Signapk] Error during disposal: {ex.Message}");
}
finally
{
base.Dispose();
}
}
disposed = true;
}
}
~Signapk()
{
Dispose(false);
}
}
public delegate void SignapkExitedEventHandler(object sender, SignapkExitedEventArgs e);
+55 -5
View File
@@ -7,8 +7,10 @@ using APKToolGUI.Utils;
namespace APKToolGUI
{
public class Smali : JarProcess
public class Smali : JarProcess, IDisposable
{
private bool disposed = false;
public new event SmaliExitedEventHandler Exited;
string _jarPath;
@@ -69,14 +71,28 @@ namespace APKToolGUI
{
foreach (var process in Process.GetProcessesByName("java"))
{
if (process.Id == Id)
using (process)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)Id);
process.Kill();
if (process.Id == Id)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)Id);
process.Kill();
}
}
}
}
catch { }
catch (InvalidOperationException ex)
{
Debug.WriteLine($"[Smali] Process already exited: {ex.Message}");
}
catch (System.ComponentModel.Win32Exception ex)
{
Debug.WriteLine($"[Smali] Failed to access process: {ex.Message}");
}
catch (Exception ex)
{
Debug.WriteLine($"[Smali] Failed to cancel process: {ex.Message}");
}
}
public int Assemble(string input, string output)
@@ -96,6 +112,40 @@ namespace APKToolGUI
CancelErrorRead();
return ExitCode;
}
public new void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected new virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
try
{
Cancel();
}
catch (Exception ex)
{
Debug.WriteLine($"[Smali] Error during disposal: {ex.Message}");
}
finally
{
base.Dispose();
}
}
disposed = true;
}
}
~Smali()
{
Dispose(false);
}
}
public class SmaliExitedEventArgs : EventArgs
+116 -14
View File
@@ -6,9 +6,11 @@ using System.IO;
namespace APKToolGUI
{
public class Zipalign
public class Zipalign : IDisposable
{
Process processZipalign;
private bool disposed = false;
static class Keys
{
public const string CheckOnly = " -c";
@@ -37,10 +39,10 @@ namespace APKToolGUI
processZipalign = new Process();
processZipalign.EnableRaisingEvents = true;
processZipalign.StartInfo.FileName = zipalignFileName;
processZipalign.StartInfo.UseShellExecute = false; //отключаем использование оболочки, чтобы можно было читать данные вывода
processZipalign.StartInfo.RedirectStandardOutput = true; // разрешаем перенаправление данных вывода
processZipalign.StartInfo.RedirectStandardError = true; // разрешаем перенаправление данных вывода
processZipalign.StartInfo.CreateNoWindow = true; //запрещаем создавать окно для запускаемой программы
processZipalign.StartInfo.UseShellExecute = false; // Disable shell execution to read output data
processZipalign.StartInfo.RedirectStandardOutput = true; // Allow output redirection
processZipalign.StartInfo.RedirectStandardError = true; // Allow error redirection
processZipalign.StartInfo.CreateNoWindow = true; // Do not create window for the launched program
processZipalign.Exited += processZipalign_Exited;
}
@@ -58,14 +60,62 @@ namespace APKToolGUI
{
foreach (var process in Process.GetProcessesByName("zipalign"))
{
if (process.Id == processZipalign.Id)
using (process)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)processZipalign.Id);
process.Kill();
if (process.Id == processZipalign.Id)
{
ProcessUtils.KillAllProcessesSpawnedBy((uint)processZipalign.Id);
process.Kill();
}
}
}
}
catch { }
catch (Exception ex)
{
Debug.WriteLine($"[Zipalign] Cancel failed: {ex.Message}");
// Process termination failure is not critical, so continue
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if (processZipalign != null)
{
try
{
if (!processZipalign.HasExited)
{
processZipalign.Kill();
}
}
catch (Exception ex)
{
Debug.WriteLine($"[Zipalign] Error disposing process: {ex.Message}");
}
finally
{
processZipalign.Dispose();
processZipalign = null;
}
}
}
disposed = true;
}
}
~Zipalign()
{
Dispose(false);
}
public int Align(string input, string output)
@@ -102,11 +152,63 @@ namespace APKToolGUI
processZipalign.BeginErrorReadLine();
processZipalign.WaitForExit();
//if (!Settings.Default.Zipalign_CheckOnly && Settings.Default.Zipalign_OverwriteOutputFile)
//{
File.Delete(output);
File.Move(PathUtils.GetDirectoryNameWithoutExtension(output) + "_align_temp.apk", output);
//}
// Handle temp file (only when not in CheckOnly mode)
if (!Settings.Default.Zipalign_CheckOnly)
{
string tempFile = PathUtils.GetDirectoryNameWithoutExtension(output) + "_align_temp.apk";
try
{
// 1. Delete output file
if (File.Exists(output))
{
File.Delete(output);
Debug.WriteLine($"[Zipalign] Deleted existing output: {output}");
}
// 2. Check temp file existence and move
if (File.Exists(tempFile))
{
File.Move(tempFile, output);
Debug.WriteLine($"[Zipalign] Moved temp file to output: {tempFile} -> {output}");
}
else
{
Debug.WriteLine($"[Zipalign] Warning: Temp file not found: {tempFile}");
return 1; // Return failure code
}
}
catch (IOException ex)
{
Debug.WriteLine($"[Zipalign] Failed to process output file: {ex.Message}");
// Attempt to cleanup temp file
try
{
if (File.Exists(tempFile))
{
File.Delete(tempFile);
Debug.WriteLine($"[Zipalign] Cleaned up temp file: {tempFile}");
}
}
catch (Exception cleanupEx)
{
Debug.WriteLine($"[Zipalign] Failed to cleanup temp file: {cleanupEx.Message}");
}
return 1;
}
catch (UnauthorizedAccessException ex)
{
Debug.WriteLine($"[Zipalign] Access denied: {ex.Message}");
return 1;
}
catch (Exception ex)
{
Debug.WriteLine($"[Zipalign] Unexpected error processing output: {ex.Message}");
return 1;
}
}
return ExitCode;
}
+1
View File
@@ -828,6 +828,7 @@
resources.ApplyResources(this.apkIconPicBox, "apkIconPicBox");
this.apkIconPicBox.Name = "apkIconPicBox";
this.apkIconPicBox.TabStop = false;
this.apkIconPicBox.Click += new System.EventHandler(this.apkIconPicBox_Click);
//
// label11
//
+294 -215
View File
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
@@ -40,6 +41,8 @@ namespace APKToolGUI
private Stopwatch stopwatch = new Stopwatch();
private string lastStartedDate;
private Image previousApkIcon;
internal static FormMain Instance { get; private set; }
public FormMain()
@@ -56,6 +59,8 @@ namespace APKToolGUI
Text += " - v" + ProductVersion;
Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
aapt = new AaptParser();
if (!File.Exists(Settings.Default.Decode_InputAppPath))
Settings.Default.Decode_InputAppPath = "";
if (!Directory.Exists(Settings.Default.Build_InputDir))
@@ -172,116 +177,159 @@ namespace APKToolGUI
#region Get APK Info
internal async Task GetApkInfo(string file)
{
if (File.Exists(file))
if (!File.Exists(file))
return;
ToLog(ApktoolEventType.None, Language.ParsingApkInfo);
ToStatus(Language.ParsingApkInfo, Resources.waiting);
try
{
ToLog(ApktoolEventType.None, Language.ParsingApkInfo);
ToStatus(Language.ParsingApkInfo, Resources.waiting);
string splitPath = Path.Combine(Program.TEMP_PATH, "SplitInfo");
// Parse APK in background
var parseResult = await ParseApkInBackgroundAsync(file, splitPath);
try
if (parseResult.Success)
{
string splitPath = Path.Combine(Program.TEMP_PATH, "SplitInfo");
string arch = "";
bool parsed = false;
await Task.Factory.StartNew(() =>
{
DirectoryUtils.Delete(splitPath);
if (file.ContainsAny(".xapk", ".zip", ".apks", ".apkm"))
{
Directory.CreateDirectory(splitPath);
using (ZipFile zipDest = ZipFile.Read(file))
{
bool mainApkFound = false;
foreach (ZipEntry entry in zipDest.Entries)
{
if (!mainApkFound && !entry.FileName.Contains("config.") && entry.FileName.EndsWith(".apk"))
{
Debug.WriteLine("Found main APK: " + entry.FileName);
string extractPath = Path.Combine(splitPath, entry.FileName);
Directory.CreateDirectory(Path.GetDirectoryName(extractPath));
entry.Extract(splitPath, ExtractExistingFileAction.OverwriteSilently);
file = extractPath;
mainApkFound = true;
}
if (entry.FileName.Contains("lib/armeabi-v7a"))
{
arch += "armeabi-v7a, ";
}
if (entry.FileName.Contains("lib/arm64-v8a"))
{
arch += "arm64-v8a, ";
}
if (entry.FileName.Contains("lib/x86"))
{
arch += "x86, ";
}
if (entry.FileName.Contains("lib/x86_64"))
{
arch += "x86_64, ";
}
}
}
}
aapt = new AaptParser();
parsed = aapt.Parse(file);
});
if (parsed)
{
if (apkIconPicBox.Image != null)
{
apkIconPicBox.Image.Dispose();
apkIconPicBox.Image = null;
}
fileTxtBox.Text = aapt.ApkFile;
appTxtBox.Text = aapt.AppName;
packNameTxtBox.Text = aapt.PackageName;
verTxtBox.Text = aapt.VersionName;
buildTxtBox.Text = aapt.VersionCode;
minSdkTxtBox.Text = aapt.MinSdkVersionDetailed;
targetSdkTxtBox.Text = aapt.TargetSdkVersionDetailed;
screenTxtBox.Text = aapt.Screens;
densityTxtBox.Text = aapt.Densities;
permTxtBox.Text = aapt.Permissions;
localsTxtBox.Text = aapt.Locales;
fullInfoTextBox.Text = aapt.FullInfo;
if (!String.IsNullOrEmpty(aapt.NativeCode))
archSdkTxtBox.Text = aapt.NativeCode;
else
archSdkTxtBox.Text = arch.RemoveLast(", ");
launchActivityTxtBox.Text = aapt.LaunchableActivity;
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)
{
#if DEBUG
ToLog(ApktoolEventType.Warning, Language.ErrorGettingApkInfo + "\n" + ex.ToString());
#else
ToLog(ApktoolEventType.Warning, Language.ErrorGettingApkInfo);
#endif
// UI update is automatically executed on UI thread
UpdateApkInfoUI(parseResult);
// Get signature info in background
var signature = await Task.Run(() => signapk.GetSignature(parseResult.ActualFilePath));
// Update signature info UI
InvokeOnUIThread(() => sigTxtBox.Text = signature);
}
ToLog(ApktoolEventType.Success, Language.Done);
ToStatus(Language.Done, Resources.done);
}
#if DEBUG
catch (Exception ex)
{
ToLog(ApktoolEventType.Warning, Language.ErrorGettingApkInfo + "\n" + ex.ToString());
}
#else
catch (Exception)
{
ToLog(ApktoolEventType.Warning, Language.ErrorGettingApkInfo);
}
#endif
}
private async Task<ApkParseResult> ParseApkInBackgroundAsync(string file, string splitPath)
{
return await Task.Run(() =>
{
try
{
DirectoryUtils.Delete(splitPath);
List<string> archList = new List<string>();
string actualFile = file;
if (file.ContainsAny(".xapk", ".zip", ".apks", ".apkm"))
{
Directory.CreateDirectory(splitPath);
using (ZipFile zipDest = ZipFile.Read(file))
{
bool mainApkFound = false;
foreach (ZipEntry entry in zipDest.Entries)
{
if (!mainApkFound && !entry.FileName.Contains("config.") && entry.FileName.EndsWith(".apk"))
{
Debug.WriteLine("Found main APK: " + entry.FileName);
string extractPath = Path.Combine(splitPath, entry.FileName);
Directory.CreateDirectory(Path.GetDirectoryName(extractPath));
entry.Extract(splitPath, ExtractExistingFileAction.OverwriteSilently);
actualFile = extractPath;
mainApkFound = true;
}
if (entry.FileName.Contains("lib/armeabi-v7a") && !archList.Contains("armeabi-v7a"))
archList.Add("armeabi-v7a");
if (entry.FileName.Contains("lib/arm64-v8a") && !archList.Contains("arm64-v8a"))
archList.Add("arm64-v8a");
if (entry.FileName.Contains("lib/x86") && !archList.Contains("x86"))
archList.Add("x86");
if (entry.FileName.Contains("lib/x86_64") && !archList.Contains("x86_64"))
archList.Add("x86_64");
}
}
}
var aaptParser = new AaptParser();
var parsed = aaptParser.Parse(actualFile);
DirectoryUtils.Delete(splitPath);
return new ApkParseResult
{
Success = parsed,
Aapt = aaptParser,
Architecture = string.Join(", ", archList),
ActualFilePath = actualFile
};
}
catch (Exception ex)
{
Debug.WriteLine($"Error parsing APK: {ex.Message}");
DirectoryUtils.Delete(splitPath);
return new ApkParseResult { Success = false };
}
});
}
private void UpdateApkInfoUI(ApkParseResult result)
{
// Explicitly dispose previous image
if (previousApkIcon != null)
{
previousApkIcon.Dispose();
previousApkIcon = null;
Debug.WriteLine("[FormMain] Disposed previous APK icon");
}
// Remove PictureBox image reference
if (apkIconPicBox.Image != null)
{
apkIconPicBox.Image = null;
}
fileTxtBox.Text = result.Aapt.ApkFile;
appTxtBox.Text = result.Aapt.AppName;
packNameTxtBox.Text = result.Aapt.PackageName;
verTxtBox.Text = result.Aapt.VersionName;
buildTxtBox.Text = result.Aapt.VersionCode;
minSdkTxtBox.Text = result.Aapt.MinSdkVersionDetailed;
targetSdkTxtBox.Text = result.Aapt.TargetSdkVersionDetailed;
screenTxtBox.Text = result.Aapt.Screens;
densityTxtBox.Text = result.Aapt.Densities;
permTxtBox.Text = result.Aapt.Permissions;
localsTxtBox.Text = result.Aapt.Locales;
fullInfoTextBox.Text = result.Aapt.FullInfo;
launchActivityTxtBox.Text = result.Aapt.LaunchableActivity;
if (!String.IsNullOrEmpty(result.Aapt.NativeCode))
archSdkTxtBox.Text = result.Aapt.NativeCode;
else
archSdkTxtBox.Text = result.Architecture;
// Load new image and save reference
previousApkIcon = BitmapUtils.LoadBitmap(result.Aapt.GetIcon(result.ActualFilePath));
apkIconPicBox.Image = previousApkIcon;
sigTxtBox.Text = "Loading...";
}
private class ApkParseResult
{
public bool Success { get; set; }
public AaptParser Aapt { get; set; }
public string Architecture { get; set; }
public string ActualFilePath { get; set; }
}
#endregion
@@ -322,29 +370,22 @@ namespace APKToolGUI
#region Log & Status
internal void ToStatus(string message, Image statusImage)
{
BeginInvoke(new MethodInvoker(delegate
BeginInvokeOnUIThread(() =>
{
toolStripStatusLabelStateText.Text = message.Replace("\n", "").Replace("\r", "");
toolStripStatusLabelStateImage.Image = statusImage;
}));
});
}
internal void ToLog(string time, string message, Color backColor)
{
Debug.WriteLine(time + " " + message);
if (logTxtBox.InvokeRequired)
Invoke(new Action(delegate ()
{
//richTextBox1.SelectionColor = color ?? Color.Black;
logTxtBox.SelectionColor = backColor;
logTxtBox.AppendText(time + " " + message + Environment.NewLine);
}));
else
InvokeOnUIThread(() =>
{
logTxtBox.SelectionColor = backColor;
logTxtBox.AppendText(time + " " + message + Environment.NewLine);
}
});
}
internal void ToLog(ApktoolEventType eventType, string message)
@@ -383,6 +424,7 @@ namespace APKToolGUI
color = Color.DarkOrange;
else
color = Color.Orange;
color = Color.White;
break;
case ApktoolEventType.Unknown:
if (Program.IsDarkTheme())
@@ -537,7 +579,7 @@ namespace APKToolGUI
DirectoryUtils.Delete(splitDir);
Directory.CreateDirectory(splitDir);
await Task.Factory.StartNew(() =>
await Task.Run(() =>
{
if (Settings.Default.Framework_ClearBeforeDecode)
{
@@ -574,10 +616,10 @@ namespace APKToolGUI
DirectoryUtils.Delete(outputDir);
DirectoryUtils.Copy(tempDecApk, outputDir);
textBox_BUILD_InputProjectDir.BeginInvoke(new Action(delegate
BeginInvokeOnUIThread(() =>
{
textBox_BUILD_InputProjectDir.Text = outputDir;
}));
});
ToLog(ApktoolEventType.None, String.Format(Language.DecompilingSuccessfullyCompleted, outputDir));
if (Settings.Default.Decode_FixError)
@@ -627,7 +669,7 @@ namespace APKToolGUI
try
{
await Task.Factory.StartNew(() =>
await Task.Run(() =>
{
ToLog(ApktoolEventType.None, String.Format(Language.InputFile, inputSplitApk));
@@ -662,18 +704,10 @@ namespace APKToolGUI
#region Apktool
public async void SetApktoolPath()
{
apktool.JarPath = Program.APKTOOL_PATH;
if (Settings.Default.UseCustomApktool)
{
apktool.JarPath = Settings.Default.ApktoolPath;
}
InitializeAPKTool();
string apktoolVersion = apktool.GetVersion();
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}\"");
if (!String.IsNullOrWhiteSpace(apktool.Version))
ToLog(ApktoolEventType.None, $"{Language.APKToolVersion} \"{apktool.Version}\"");
else
ToLog(ApktoolEventType.Error, Language.CantDetectApktoolVersion);
@@ -717,7 +751,7 @@ namespace APKToolGUI
try
{
await Task.Factory.StartNew(() =>
await Task.Run(() =>
{
if (apktool.ClearFramework() == 0)
{
@@ -762,7 +796,7 @@ namespace APKToolGUI
ToLog(ApktoolEventType.Error, String.Format(Language.DecodeDesDirExists, outputDir));
return 1;
}
await Task.Factory.StartNew(() =>
await Task.Run(() =>
{
if (Settings.Default.Framework_ClearBeforeDecode && !Settings.Default.UseApkeditor)
{
@@ -801,10 +835,10 @@ namespace APKToolGUI
DirectoryUtils.Copy(outputTempDir, outputDir);
}
textBox_BUILD_InputProjectDir.BeginInvoke(new Action(delegate
BeginInvokeOnUIThread(() =>
{
textBox_BUILD_InputProjectDir.Text = outputDir;
}));
});
ToLog(ApktoolEventType.None, String.Format(Language.DecompilingSuccessfullyCompleted, outputDir));
if (Settings.Default.Decode_FixError && !useAPKEditorForDecompilingItem.Checked)
@@ -1002,7 +1036,7 @@ namespace APKToolGUI
Running(Language.DecompilingDex);
ToLog(ApktoolEventType.None, String.Format(Language.InputFile, inputFile));
await Task.Factory.StartNew(() =>
await Task.Run(() =>
{
string outputDir = String.Format("{0}", Path.Combine(Path.GetDirectoryName(inputFile), "dexout", Path.GetFileNameWithoutExtension(inputFile)));
if (Settings.Default.Baksmali_UseOutputDir && !IgnoreOutputDirContextMenu)
@@ -1011,10 +1045,10 @@ namespace APKToolGUI
code = baksmali.Disassemble(inputFile, outputDir);
if (code == 0)
{
textBox_BUILD_InputProjectDir.BeginInvoke(new Action(delegate
BeginInvokeOnUIThread(() =>
{
smaliBrowseInputDirTxtBox.Text = outputDir;
}));
});
Done(String.Format(Language.DecompilingSuccessfullyCompleted, outputDir));
}
else
@@ -1058,7 +1092,7 @@ namespace APKToolGUI
ToLog(ApktoolEventType.None, String.Format(Language.InputDirectory, inputDir));
await Task.Factory.StartNew(() =>
await Task.Run(() =>
{
string outputDir = String.Format("{0}.dex", inputDir);
if (Settings.Default.Smali_UseOutputDir && !IgnoreOutputDirContextMenu)
@@ -1115,7 +1149,7 @@ namespace APKToolGUI
try
{
await Task.Factory.StartNew(() =>
await Task.Run(() =>
{
string tempApk = Path.Combine(Program.TEMP_PATH, "tempapk.apk");
string outputApkFile = outputDir;
@@ -1196,7 +1230,7 @@ namespace APKToolGUI
Running(Language.Signing);
string outputFile = input;
if (Settings.Default.Zipalign_UseOutputDir && !IgnoreOutputDirContextMenu)
if (Settings.Default.Sign_UseOutputDir && !IgnoreOutputDirContextMenu)
outputFile = Path.Combine(Settings.Default.Sign_OutputDir, Path.GetFileName(input));
if (!Settings.Default.Sign_OverwriteInputFile)
outputFile = PathUtils.GetDirectoryNameWithoutExtension(outputFile) + "_signed.apk";
@@ -1208,7 +1242,7 @@ namespace APKToolGUI
try
{
await Task.Factory.StartNew(() =>
await Task.Run(() =>
{
if (Settings.Default.Utf8FilenameSupport)
{
@@ -1302,7 +1336,7 @@ namespace APKToolGUI
{
devicesListBox.Items.Clear();
await Task.Factory.StartNew(() =>
await Task.Run(() =>
{
devices = adb.GetDevices();
});
@@ -1352,7 +1386,7 @@ namespace APKToolGUI
try
{
await Task.Factory.StartNew(() =>
await Task.Run(() =>
{
code = adb.Install(device, inputApk);
if (code == 0)
@@ -1378,7 +1412,7 @@ namespace APKToolGUI
#region Form handlers
private async void FormMain_Shown(object sender, EventArgs e)
{
await Task.Factory.StartNew(() =>
await Task.Run(() =>
{
InitializeUpdateChecker();
InitializeZipalign();
@@ -1396,13 +1430,9 @@ namespace APKToolGUI
if (javaVersion != null)
{
ToLog(ApktoolEventType.None, javaVersion);
string apktoolVersion = apktool.GetVersion();
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}");
if (!String.IsNullOrWhiteSpace(apktool.Version) && !Regex.IsMatch(apktool.Version, @"\r\n?|\n"))
ToLog(ApktoolEventType.None, $"{Language.APKToolVersion} {apktool.Version}");
else
ToLog(ApktoolEventType.Error, Language.CantDetectApktoolVersion);
@@ -1451,7 +1481,7 @@ namespace APKToolGUI
Running(Language.ClearTempFolder);
try
{
await Task.Factory.StartNew(() =>
await Task.Run(() =>
{
foreach (var subDir in new DirectoryInfo(Program.TEMP_MAIN).EnumerateDirectories())
{
@@ -1486,6 +1516,39 @@ namespace APKToolGUI
{
Save();
// Dispose APK icon image
try
{
if (previousApkIcon != null)
{
previousApkIcon.Dispose();
previousApkIcon = null;
Debug.WriteLine("[FormMain] Cleaned up APK icon on exit");
}
}
catch (Exception ex)
{
Debug.WriteLine($"[FormMain] Error disposing APK icon: {ex.Message}");
}
// Dispose all tool instances
try
{
adb?.Dispose();
zipalign?.Dispose();
apktool?.Dispose();
signapk?.Dispose();
baksmali?.Dispose();
smali?.Dispose();
apkeditor?.Dispose();
Debug.WriteLine("[FormMain] All tool instances disposed successfully");
}
catch (Exception ex)
{
Debug.WriteLine($"[FormMain] Error disposing resources: {ex.Message}");
}
DirectoryUtils.Delete(Program.TEMP_PATH);
}
@@ -1493,69 +1556,17 @@ namespace APKToolGUI
{
set
{
if (button_BUILD_Build.InvokeRequired)
button_BUILD_Build.BeginInvoke(new Action(delegate
{
button_BUILD_Build.Enabled = value;
}));
else
BeginInvokeOnUIThread(() =>
{
button_BUILD_Build.Enabled = value;
if (button_DECODE_Decode.InvokeRequired)
button_DECODE_Decode.BeginInvoke(new Action(delegate
{
button_DECODE_Decode.Enabled = value;
}));
else
button_DECODE_Decode.Enabled = value;
if (button_IF_InstallFramework.InvokeRequired)
button_IF_InstallFramework.BeginInvoke(new Action(delegate
{
button_IF_InstallFramework.Enabled = value;
}));
else
button_IF_InstallFramework.Enabled = value;
if (button_ZIPALIGN_Align.InvokeRequired)
button_ZIPALIGN_Align.BeginInvoke(new Action(delegate
{
button_ZIPALIGN_Align.Enabled = value;
}));
else
button_ZIPALIGN_Align.Enabled = value;
if (button_SIGN_Sign.InvokeRequired)
button_SIGN_Sign.BeginInvoke(new Action(delegate
{
button_SIGN_Sign.Enabled = value;
}));
else
button_SIGN_Sign.Enabled = value;
if (decSmaliBtn.InvokeRequired)
decSmaliBtn.BeginInvoke(new Action(delegate
{
decSmaliBtn.Enabled = value;
}));
else
decSmaliBtn.Enabled = value;
if (comSmaliBtn.InvokeRequired)
comSmaliBtn.BeginInvoke(new Action(delegate
{
comSmaliBtn.Enabled = value;
}));
else
comSmaliBtn.Enabled = value;
if (mergeApkBtn.InvokeRequired)
mergeApkBtn.BeginInvoke(new Action(delegate
{
mergeApkBtn.Enabled = value;
}));
else
mergeApkBtn.Enabled = value;
});
}
}
@@ -1563,15 +1574,18 @@ namespace APKToolGUI
{
set
{
killAdbBtn.Enabled = value;
refreshDevicesBtn.Enabled = value;
installApkBtn.Enabled = value;
devicesListBox.Enabled = value;
apkPathAdbTxtBox.Enabled = value;
selApkAdbBtn.Enabled = value;
setVendorChkBox.Enabled = value;
overrideAbiCheckBox.Enabled = value;
overrideAbiComboBox.Enabled = value;
InvokeOnUIThread(() =>
{
killAdbBtn.Enabled = value;
refreshDevicesBtn.Enabled = value;
installApkBtn.Enabled = value;
devicesListBox.Enabled = value;
apkPathAdbTxtBox.Enabled = value;
selApkAdbBtn.Enabled = value;
setVendorChkBox.Enabled = value;
overrideAbiCheckBox.Enabled = value;
overrideAbiComboBox.Enabled = value;
});
}
}
@@ -1579,6 +1593,53 @@ namespace APKToolGUI
{
MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OK, status);
}
#region UI Thread Helpers
/// <summary>
/// Execute action synchronously on UI thread
/// </summary>
private void InvokeOnUIThread(Action action)
{
if (InvokeRequired)
{
Invoke(action);
}
else
{
action();
}
}
/// <summary>
/// Execute action asynchronously on UI thread (Fire and forget)
/// </summary>
private void BeginInvokeOnUIThread(Action action)
{
if (InvokeRequired)
{
BeginInvoke(action);
}
else
{
action();
}
}
/// <summary>
/// Execute function on UI thread and return result
/// </summary>
private T InvokeOnUIThread<T>(Func<T> func)
{
if (InvokeRequired)
{
return (T)Invoke(func);
}
else
{
return func();
}
}
#endregion
#endregion
#region Config
@@ -1627,5 +1688,23 @@ namespace APKToolGUI
}
}
#endregion
private void apkIconPicBox_Click(object sender, EventArgs e)
{
if (apkIconPicBox.Image != null)
{
using (SaveFileDialog saveFile = new SaveFileDialog())
{
saveFile.Filter = "PNG Image|*.png";
saveFile.Title = "Save an Image File";
saveFile.FileName = appTxtBox.Text; // Set default filename to app name
if (saveFile.ShowDialog() == DialogResult.OK && !String.IsNullOrEmpty(saveFile.FileName))
{
apkIconPicBox.Image.Save(saveFile.FileName, System.Drawing.Imaging.ImageFormat.Png);
}
}
}
}
}
}
}
File diff suppressed because it is too large Load Diff
+75
View File
@@ -275,4 +275,79 @@
<data name="label_SIGN_PublicKey.Text" xml:space="preserve">
<value>Открытый ключ</value>
</data>
<data name="tabPageMain.Text" xml:space="preserve">
<value>Главная</value>
</data>
<data name="tabPageApkInfo.Text" xml:space="preserve">
<value>Инфо APK</value>
</data>
<data name="checkBox4.Text" xml:space="preserve">
<value>Количество потоков:</value>
</data>
<data name="checkBox_BUILD_NetSecConf.Text" xml:space="preserve">
<value>Добавить файл конфигурации сетевой безопасности (Network Security Configuration)</value>
</data>
<data name="useAapt2ChkBox.Text" xml:space="preserve">
<value>Использовать aapt2 (для версий apktool &lt; 2.11.1)</value>
</data>
<data name="buildSetApiLvlChkBox.Text" xml:space="preserve">
<value>Установить уровень API (напр. 14 для ICS)</value>
</data>
<data name="createUnsignApkChkBox.Text" xml:space="preserve">
<value>Создать неподписанный APK с оригинальной подписью (Core Patch)</value>
</data>
<data name="signAfterBuildChkBox.Text" xml:space="preserve">
<value>Подписать после сборки / выравнивания</value>
</data>
<data name="zipalignAfterBuildChkBox.Text" xml:space="preserve">
<value>Выровнять после сборки</value>
</data>
<data name="checkBox_BUILD_NoCrunch.Text" xml:space="preserve">
<value>Отключить сжатие ресурсов</value>
</data>
<data name="tabPageBaksmali.Text" xml:space="preserve">
<value>Baksmali / Smali</value>
</data>
<data name="tabPageAdb.Text" xml:space="preserve">
<value>ADB</value>
</data>
<data name="mergeApkBtn.Text" xml:space="preserve">
<value>Слияние APK</value>
</data>
<data name="selSplitApkBtn.Text" xml:space="preserve">
<value>Выбрать Split APK</value>
</data>
<data name="baksmaliUseOutputChkBox.Text" xml:space="preserve">
<value>Свой каталог вывода:</value>
</data>
<data name="smaliUseOutputChkBox.Text" xml:space="preserve">
<value>Свой каталог вывода:</value>
</data>
<data name="killAdbBtn.Text" xml:space="preserve">
<value>Перезапустить ADB</value>
</data>
<data name="installApkBtn.Text" xml:space="preserve">
<value>Установить APK</value>
</data>
<data name="refreshDevicesBtn.Text" xml:space="preserve">
<value>Обновить список</value>
</data>
<data name="selApkAdbBtn.Text" xml:space="preserve">
<value>Выбрать APK</value>
</data>
<data name="overrideAbiCheckBox.Text" xml:space="preserve">
<value>Переопределить ABI:</value>
</data>
<data name="bakSmaliGroupBox.Text" xml:space="preserve">
<value>Baksmali (DEX -&gt; Smali)</value>
</data>
<data name="smaliGroupBox.Text" xml:space="preserve">
<value>Smali (Smali -&gt; DEX)</value>
</data>
<data name="decSmaliBtn.Text" xml:space="preserve">
<value>Дизассемблировать</value>
</data>
<data name="comSmaliBtn.Text" xml:space="preserve">
<value>Ассемблировать</value>
</data>
</root>
+1 -1
View File
@@ -139,7 +139,7 @@ namespace APKToolGUI
if (Language.SystemLanguage.Equals(comboBox1.SelectedItem.ToString()))
Settings.Default.Culture = "Auto";
else
Settings.Default.Culture = StringExt.Regex(@"(?<=\[)(.*?)(?=\])", comboBox1.SelectedItem.ToString());
Settings.Default.Culture = StringExt.RegexExtract(@"(?<=\[)(.*?)(?=\])", comboBox1.SelectedItem.ToString());
Settings.Default.Theme = themeComboBox.SelectedIndex;
Settings.Default.Save();
+15
View File
@@ -163,4 +163,19 @@
<data name="$this.Text" xml:space="preserve">
<value>Настройки</value>
</data>
<data name="buttonCustomJavaLocation.Text" xml:space="preserve">
<value>Указать путь к Java</value>
</data>
<data name="useCustomApktoolChk.Text" xml:space="preserve">
<value>Свой путь к Apktool</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>Тема</value>
</data>
<data name="checkBox6.Text" xml:space="preserve">
<value>Режим отладки</value>
</data>
<data name="checkBox7.Text" xml:space="preserve">
<value>Аргументы JVM</value>
</data>
</root>
+12 -12
View File
@@ -16,25 +16,25 @@ namespace APKToolGUI.Handlers
public AdbControlEventHandlers(FormMain Main)
{
main = Main;
main.killAdbBtn.Click += killAdbBtn_Click;
main.installApkBtn.Click += installApkBtn_Click;
main.refreshDevicesBtn.Click += refreshDevicesBtn_Click;
main.selApkAdbBtn.Click += selApkAdbBtn_Click;
main.devicesListBox.SelectedValueChanged += devicesListBox_SelectedValueChanged;
main.overrideAbiComboBox.SelectedIndexChanged += ComboBoxChanged;
main.killAdbBtn.Click += KillAdbBtn_Click;
main.installApkBtn.Click += InstallApkBtn_Click;
main.refreshDevicesBtn.Click += RefreshDevicesBtn_Click;
main.selApkAdbBtn.Click += SelApkAdbBtn_Click;
main.devicesListBox.SelectedValueChanged += DevicesListBox_SelectedValueChanged;
main.overrideAbiComboBox.SelectedIndexChanged += OverrideAbiComboBox_SelectedIndexChanged;
}
private void ComboBoxChanged(object sender, EventArgs e)
private void OverrideAbiComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
Settings.Default.Adb_OverrideAbi = main.overrideAbiComboBox.SelectedIndex;
}
private async void refreshDevicesBtn_Click(object sender, EventArgs e)
private async void RefreshDevicesBtn_Click(object sender, EventArgs e)
{
await main.ListDevices();
}
private async void killAdbBtn_Click(object sender, EventArgs e)
private async void KillAdbBtn_Click(object sender, EventArgs e)
{
if (MessageBox.Show(Language.ConfirmKillingAdbServer, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
@@ -43,7 +43,7 @@ namespace APKToolGUI.Handlers
}
}
private async void installApkBtn_Click(object sender, EventArgs e)
private async void InstallApkBtn_Click(object sender, EventArgs e)
{
string inputFile = main.apkPathAdbTxtBox.Text;
if (File.Exists(inputFile))
@@ -54,7 +54,7 @@ namespace APKToolGUI.Handlers
MessageBox.Show(Language.ErrorSelectedFileNotExist, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
private void selApkAdbBtn_Click(object sender, EventArgs e)
private void SelApkAdbBtn_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
@@ -65,7 +65,7 @@ namespace APKToolGUI.Handlers
}
}
private void devicesListBox_SelectedValueChanged(object sender, EventArgs e)
private void DevicesListBox_SelectedValueChanged(object sender, EventArgs e)
{
main.ToLog(ApktoolEventType.None, String.Format(Language.DeviceSelected, main.devicesListBox.SelectedItem));
main.selAdbDeviceLbl.Text = main.devicesListBox.GetItemText(main.devicesListBox.SelectedItem);
@@ -14,57 +14,57 @@ namespace APKToolGUI.Handlers
public ApkinfoControlEventHandlers(FormMain Main)
{
main = Main;
main.selApkFileInfoBtn.Click += selApkFileInfoBtn_Click;
main.psLinkBtn.Click += psLinkBtn_Click;
main.apkComboLinkBtn.Click += apkComboLinkBtn_Click;
main.apkPureLinkBtn.Click += apkPureLinkBtn_Click;
main.apkGkLinkBtn.Click += apkGkLinkBtn_Click;
main.apkSupportLinkBtn.Click += apkSupportLinkBtn_Click;
main.apkMirrorLinkBtn.Click += apkMirrorLinkBtn_Click;
main.selApkFileInfoBtn.Click += SelApkFileInfoBtn_Click;
main.psLinkBtn.Click += PsLinkBtn_Click;
main.apkComboLinkBtn.Click += ApkComboLinkBtn_Click;
main.apkPureLinkBtn.Click += ApkPureLinkBtn_Click;
main.apkGkLinkBtn.Click += ApkGkLinkBtn_Click;
main.apkSupportLinkBtn.Click += ApkSupportLinkBtn_Click;
main.apkMirrorLinkBtn.Click += ApkMirrorLinkBtn_Click;
}
private void selApkFileInfoBtn_Click(object sender, EventArgs e)
private async void SelApkFileInfoBtn_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
if (ofd.ShowDialog() == DialogResult.OK)
{
main.GetApkInfo(ofd.FileName);
await main.GetApkInfo(ofd.FileName);
}
}
}
private void psLinkBtn_Click(object sender, EventArgs e)
private void PsLinkBtn_Click(object sender, EventArgs e)
{
if (main.aapt != null)
Process.Start(main.aapt.PlayStoreLink);
}
private void apkComboLinkBtn_Click(object sender, EventArgs e)
private void ApkComboLinkBtn_Click(object sender, EventArgs e)
{
if (main.aapt != null)
Process.Start(main.aapt.ApkComboLink);
}
private void apkPureLinkBtn_Click(object sender, EventArgs e)
private void ApkPureLinkBtn_Click(object sender, EventArgs e)
{
if (main.aapt != null)
Process.Start(main.aapt.ApkPureLink);
}
private void apkGkLinkBtn_Click(object sender, EventArgs e)
private void ApkGkLinkBtn_Click(object sender, EventArgs e)
{
if (main.aapt != null)
Process.Start(main.aapt.ApkGkLink);
}
private void apkSupportLinkBtn_Click(object sender, EventArgs e)
private void ApkSupportLinkBtn_Click(object sender, EventArgs e)
{
if (main.aapt != null)
Process.Start(main.aapt.ApkSupportLink);
}
private void apkMirrorLinkBtn_Click(object sender, EventArgs e)
private void ApkMirrorLinkBtn_Click(object sender, EventArgs e)
{
if (main.aapt != null)
Process.Start(main.aapt.ApkMirrorLink);
@@ -19,12 +19,12 @@ namespace APKToolGUI.Handlers
public BaksmaliControlEventHandlers(FormMain Main)
{
main = Main;
main.baksmaliBrowseOutputBtn.Click += baksmaliBrowseOutputBtn_Click;
main.baksmaliBrowseInputDexBtn.Click += baksmaliBrowseInputDexBtn_Click;
main.decSmaliBtn.Click += decSmaliBtn_Click;
main.baksmaliBrowseOutputBtn.Click += BaksmaliBrowseOutputBtn_Click;
main.baksmaliBrowseInputDexBtn.Click += BaksmaliBrowseInputDexBtn_Click;
main.decSmaliBtn.Click += DecSmaliBtn_Click;
}
internal void baksmaliBrowseOutputBtn_Click(object sender, EventArgs e)
internal void BaksmaliBrowseOutputBtn_Click(object sender, EventArgs e)
{
VistaFolderBrowserDialog dlg = new VistaFolderBrowserDialog();
dlg.ShowNewFolderButton = true;
@@ -35,7 +35,7 @@ namespace APKToolGUI.Handlers
}
}
internal void baksmaliBrowseInputDexBtn_Click(object sender, EventArgs e)
internal void BaksmaliBrowseInputDexBtn_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
@@ -46,7 +46,7 @@ namespace APKToolGUI.Handlers
}
}
internal async void decSmaliBtn_Click(object sender, EventArgs e)
internal async void DecSmaliBtn_Click(object sender, EventArgs e)
{
if (main.baksmaliUseOutputChkBox.Checked)
{
@@ -21,14 +21,14 @@ namespace APKToolGUI.Handlers
public BuildControlEventHandlers(FormMain Main)
{
main = Main;
main.button_BUILD_BrowseAaptPath.Click += button_BUILD_BrowseAaptPath_Click;
main.button_BUILD_BrowseFrameDir.Click += button_BUILD_BrowseFrameDir_Click;
main.button_BUILD_BrowseOutputAppPath.Click += button_BUILD_BrowseOutputAppPath_Click;
main.button_BUILD_BrowseInputProjectDir.Click += button_BUILD_BrowseInputProjectDir_Click;
main.button_BUILD_Build.Click += button_BUILD_Build_Click;
main.button_BUILD_BrowseAaptPath.Click += Button_BUILD_BrowseAaptPath_Click;
main.button_BUILD_BrowseFrameDir.Click += Button_BUILD_BrowseFrameDir_Click;
main.button_BUILD_BrowseOutputAppPath.Click += Button_BUILD_BrowseOutputAppPath_Click;
main.button_BUILD_BrowseInputProjectDir.Click += Button_BUILD_BrowseInputProjectDir_Click;
main.button_BUILD_Build.Click += Button_BUILD_Build_Click;
}
internal void button_BUILD_BrowseAaptPath_Click(object sender, EventArgs e)
internal void Button_BUILD_BrowseAaptPath_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
@@ -43,7 +43,7 @@ namespace APKToolGUI.Handlers
}
}
internal void button_BUILD_BrowseFrameDir_Click(object sender, EventArgs e)
internal void Button_BUILD_BrowseFrameDir_Click(object sender, EventArgs e)
{
using (VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog())
{
@@ -54,7 +54,7 @@ namespace APKToolGUI.Handlers
}
}
internal void button_BUILD_BrowseOutputAppPath_Click(object sender, EventArgs e)
internal void Button_BUILD_BrowseOutputAppPath_Click(object sender, EventArgs e)
{
VistaFolderBrowserDialog dlg = new VistaFolderBrowserDialog();
dlg.ShowNewFolderButton = true;
@@ -65,7 +65,7 @@ namespace APKToolGUI.Handlers
}
}
internal void button_BUILD_BrowseInputProjectDir_Click(object sender, EventArgs e)
internal void Button_BUILD_BrowseInputProjectDir_Click(object sender, EventArgs e)
{
VistaFolderBrowserDialog dlg = new VistaFolderBrowserDialog();
dlg.ShowNewFolderButton = true;
@@ -76,7 +76,7 @@ namespace APKToolGUI.Handlers
}
}
internal async void button_BUILD_Build_Click(object sender, EventArgs e)
internal async void Button_BUILD_Build_Click(object sender, EventArgs e)
{
string decApkDir = main.textBox_BUILD_InputProjectDir.Text;
if (Directory.Exists(main.textBox_BUILD_InputProjectDir.Text))
@@ -19,13 +19,13 @@ namespace APKToolGUI.Handlers
public DecodeControlEventHandlers(FormMain Main)
{
main = Main;
main.button_DECODE_BrowseFrameDir.Click += button_DECODE_BrowseFrameDir_Click;
main.button_DECODE_BrowseOutputDirectory.Click += button_DECODE_BrowseOutputDirectory_Click;
main.button_DECODE_BrowseInputAppPath.Click += button_DECODE_BrowseInputAppPath_Click;
main.button_DECODE_Decode.Click += button_DECODE_Decode_Click;
main.button_DECODE_BrowseFrameDir.Click += Button_DECODE_BrowseFrameDir_Click;
main.button_DECODE_BrowseOutputDirectory.Click += Button_DECODE_BrowseOutputDirectory_Click;
main.button_DECODE_BrowseInputAppPath.Click += Button_DECODE_BrowseInputAppPath_Click;
main.button_DECODE_Decode.Click += Button_DECODE_Decode_Click;
}
internal void button_DECODE_BrowseFrameDir_Click(object sender, EventArgs e)
internal void Button_DECODE_BrowseFrameDir_Click(object sender, EventArgs e)
{
using (VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog())
{
@@ -36,7 +36,7 @@ namespace APKToolGUI.Handlers
}
}
internal void button_DECODE_BrowseOutputDirectory_Click(object sender, EventArgs e)
internal void Button_DECODE_BrowseOutputDirectory_Click(object sender, EventArgs e)
{
using (VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog())
{
@@ -50,18 +50,18 @@ namespace APKToolGUI.Handlers
}
}
internal void button_DECODE_BrowseInputAppPath_Click(object sender, EventArgs e)
internal async void Button_DECODE_BrowseInputAppPath_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
ofd.Filter = "Android Package (*.apk, *.xapk, *.zip, *.apkm, *.apks)|*.apk;*.xapk;*.zip;*.apkm;*.apks";
ofd.Filter = "Android Package (*.apk;*.xapk;*.zip;*.apkm;*.apks)|*.apk;*.xapk;*.zip;*.apkm;*.apks";
if (ofd.ShowDialog() == DialogResult.OK)
{
main.textBox_DECODE_InputAppPath.Text = ofd.FileName;
if (!Settings.Default.Decode_DontParseApkInfo)
main.GetApkInfo(ofd.FileName);
await main.GetApkInfo(ofd.FileName);
if (main.checkBox_DECODE_OutputDirectory.Checked)
{
@@ -71,7 +71,7 @@ namespace APKToolGUI.Handlers
}
}
internal async void button_DECODE_Decode_Click(object sender, EventArgs e)
internal async void Button_DECODE_Decode_Click(object sender, EventArgs e)
{
string inputFile = main.textBox_DECODE_InputAppPath.Text;
if (File.Exists(inputFile))
+3 -3
View File
@@ -203,14 +203,14 @@ namespace APKToolGUI.Handlers
}
}
private void DropApkToGetInfo(DragEventArgs e)
private async void DropApkToGetInfo(DragEventArgs e)
{
string apkFile = null;
if (e.DropOneByEnd(file => apkFile = file, apks))
{
main.smaliBrowseInputDirTxtBox.Text = apkFile;
main.fileTxtBox.Text = apkFile;
main.basicInfoTabPage.BackColor = PanelBackColor();
main.GetApkInfo(apkFile);
await main.GetApkInfo(apkFile);
}
}
@@ -20,14 +20,14 @@ namespace APKToolGUI.Handlers
public FrameworkControlEventHandlers(FormMain Main)
{
main = Main;
main.button_IF_BrowseFrameDir.Click += button_IF_BrowseFrameDir_Click;
main.button_IF_BrowseInputFramePath.Click += button_IF_BrowseInputFramePath_Click;
main.button_IF_InstallFramework.Click += button_IF_InstallFramework_Click;
main.clearFwBtn.Click += clearFwBtn_Click;
main.openFwFolderBtn.Click += openFwFolderBtn_Click;
main.button_IF_BrowseFrameDir.Click += Button_IF_BrowseFrameDir_Click;
main.button_IF_BrowseInputFramePath.Click += Button_IF_BrowseInputFramePath_Click;
main.button_IF_InstallFramework.Click += Button_IF_InstallFramework_Click;
main.clearFwBtn.Click += ClearFwBtn_Click;
main.openFwFolderBtn.Click += OpenFwFolderBtn_Click;
}
internal void button_IF_BrowseFrameDir_Click(object sender, EventArgs e)
internal void Button_IF_BrowseFrameDir_Click(object sender, EventArgs e)
{
main.clearFwBeforeDecodeChkBox.Checked = false;
VistaFolderBrowserDialog dlg = new VistaFolderBrowserDialog();
@@ -39,7 +39,7 @@ namespace APKToolGUI.Handlers
}
}
internal void button_IF_BrowseInputFramePath_Click(object sender, EventArgs e)
internal void Button_IF_BrowseInputFramePath_Click(object sender, EventArgs e)
{
main.clearFwBeforeDecodeChkBox.Checked = false;
using (OpenFileDialog ofd = new OpenFileDialog())
@@ -56,7 +56,7 @@ namespace APKToolGUI.Handlers
}
}
internal async void button_IF_InstallFramework_Click(object sender, EventArgs e)
internal async void Button_IF_InstallFramework_Click(object sender, EventArgs e)
{
if (main.checkBox_IF_FramePath.Checked)
{
@@ -89,14 +89,14 @@ namespace APKToolGUI.Handlers
});
}
internal async void clearFwBtn_Click(object sender, EventArgs e)
internal async void ClearFwBtn_Click(object sender, EventArgs e)
{
main.Running(Language.ClearingFramework);
await main.ClearFramework();
}
internal void openFwFolderBtn_Click(object sender, EventArgs e)
internal void OpenFwFolderBtn_Click(object sender, EventArgs e)
{
if (main.checkBox_IF_FramePath.Checked && Directory.Exists(main.textBox_IF_FrameDir.Text))
Process.Start("explorer.exe", main.textBox_IF_FrameDir.Text);
+28 -28
View File
@@ -15,26 +15,26 @@ namespace APKToolGUI.Handlers
public MainWindowEventHandlers(FormMain Main)
{
main = Main;
main.clearLogToolStripMenuItem.Click += clearLogToolStripMenuItem_Click;
main.copyToolStripMenuItem.Click += copyToolStripMenuItem_Click;
main.openAndroidMainfestBtn.Click += openAndroidMainfestBtn_Click;
main.openApktoolYmlBtn.Click += openApktoolYmlBtn_Click;
main.compileOutputOpenDirBtn.Click += compiledApkOpenDirBtn_Click;
main.button_OpenMainActivity.Click += button_OpenMainActivity_Click;
main.decApkOpenDirBtn.Click += decApkOpenDirBtn_Click;
main.decOutOpenDirBtn.Click += decOutOpenDirBtn_Click;
main.comApkOpenDir.Click += comApkOpenDir_Click;
main.signApkOpenDirBtn.Click += signApkOpenDirBtn_Click;
main.alignApkOpenDirBtn.Click += alignApkOpenDirBtn_Click;
main.mergeApkBtn.Click += mergeApkBtn_Click;
main.selSplitApkBtn.Click += selSplitApkBtn_Click;
main.clearLogToolStripMenuItem.Click += ClearLogToolStripMenuItem_Click;
main.copyToolStripMenuItem.Click += CopyToolStripMenuItem_Click;
main.openAndroidMainfestBtn.Click += OpenAndroidMainfestBtn_Click;
main.openApktoolYmlBtn.Click += OpenApktoolYmlBtn_Click;
main.compileOutputOpenDirBtn.Click += CompiledApkOpenDirBtn_Click;
main.button_OpenMainActivity.Click += Button_OpenMainActivity_Click;
main.decApkOpenDirBtn.Click += DecApkOpenDirBtn_Click;
main.decOutOpenDirBtn.Click += DecOutOpenDirBtn_Click;
main.comApkOpenDir.Click += ComApkOpenDir_Click;
main.signApkOpenDirBtn.Click += SignApkOpenDirBtn_Click;
main.alignApkOpenDirBtn.Click += AlignApkOpenDirBtn_Click;
main.mergeApkBtn.Click += MergeApkBtn_Click;
main.selSplitApkBtn.Click += SelSplitApkBtn_Click;
}
internal void selSplitApkBtn_Click(object sender, EventArgs e)
internal void SelSplitApkBtn_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
ofd.Filter = "Split APK Package (*.xapk;*.zip*.apkm;*.apks)|*.xapk;*.zip*.apkm;*.apks";
ofd.Filter = "Split APK Package (*.xapk;*.zip;*.apkm;*.apks)|*.xapk;*.zip;*.apkm;*.apks";
if (ofd.ShowDialog() == DialogResult.OK)
{
@@ -43,7 +43,7 @@ namespace APKToolGUI.Handlers
}
}
internal async void mergeApkBtn_Click(object sender, EventArgs e)
internal async void MergeApkBtn_Click(object sender, EventArgs e)
{
try
{
@@ -62,12 +62,12 @@ namespace APKToolGUI.Handlers
}
}
private void clearLogToolStripMenuItem_Click(object sender, EventArgs e)
private void ClearLogToolStripMenuItem_Click(object sender, EventArgs e)
{
main.logTxtBox.Text = "";
}
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
private void CopyToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
@@ -79,7 +79,7 @@ namespace APKToolGUI.Handlers
}
}
internal void decApkOpenDirBtn_Click(object sender, EventArgs e)
internal void DecApkOpenDirBtn_Click(object sender, EventArgs e)
{
if (Directory.Exists(main.textBox_BUILD_InputProjectDir.Text))
Process.Start("explorer.exe", main.textBox_BUILD_InputProjectDir.Text);
@@ -89,7 +89,7 @@ namespace APKToolGUI.Handlers
}
}
internal void decOutOpenDirBtn_Click(object sender, EventArgs e)
internal void DecOutOpenDirBtn_Click(object sender, EventArgs e)
{
if (Directory.Exists(Settings.Default.Decode_OutputDir))
Process.Start("explorer.exe", Settings.Default.Decode_OutputDir);
@@ -99,7 +99,7 @@ namespace APKToolGUI.Handlers
}
}
private void openAndroidMainfestBtn_Click(object sender, EventArgs e)
private void OpenAndroidMainfestBtn_Click(object sender, EventArgs e)
{
if (File.Exists(Path.Combine(main.textBox_BUILD_InputProjectDir.Text, "AndroidManifest.xml")))
Process.Start("explorer.exe", Path.Combine(main.textBox_BUILD_InputProjectDir.Text, "AndroidManifest.xml"));
@@ -107,7 +107,7 @@ namespace APKToolGUI.Handlers
main.ToLog(ApktoolEventType.Error, Language.AndroidManifestNotExist);
}
private void openApktoolYmlBtn_Click(object sender, EventArgs e)
private void OpenApktoolYmlBtn_Click(object sender, EventArgs e)
{
if (File.Exists(Path.Combine(main.textBox_BUILD_InputProjectDir.Text, "apktool.yml")))
Process.Start("explorer.exe", Path.Combine(main.textBox_BUILD_InputProjectDir.Text, "apktool.yml"));
@@ -115,7 +115,7 @@ namespace APKToolGUI.Handlers
main.ToLog(ApktoolEventType.Error, Language.AndroidManifestNotExist);
}
private void compiledApkOpenDirBtn_Click(object sender, EventArgs e)
private void CompiledApkOpenDirBtn_Click(object sender, EventArgs e)
{
if (Directory.Exists(Settings.Default.Build_OutputAppPath))
{
@@ -125,7 +125,7 @@ namespace APKToolGUI.Handlers
main.ToLog(ApktoolEventType.Error, Language.ErrorSelectedFileNotExist);
}
private void button_OpenMainActivity_Click(object sender, EventArgs e)
private void Button_OpenMainActivity_Click(object sender, EventArgs e)
{
string decPath = main.textBox_BUILD_InputProjectDir.Text;
if (Directory.Exists(decPath))
@@ -177,7 +177,7 @@ namespace APKToolGUI.Handlers
main.ToLog(ApktoolEventType.Error, Language.DecompiledAPKNotExist);
}
internal void comApkOpenDir_Click(object sender, EventArgs e)
internal void ComApkOpenDir_Click(object sender, EventArgs e)
{
string decApkDir = main.textBox_BUILD_InputProjectDir.Text;
@@ -199,11 +199,11 @@ namespace APKToolGUI.Handlers
}
}
internal void signApkOpenDirBtn_Click(object sender, EventArgs e)
internal void SignApkOpenDirBtn_Click(object sender, EventArgs e)
{
string inputFile = Settings.Default.Sign_InputFile;
string outputFile = inputFile;
if (Settings.Default.Zipalign_UseOutputDir)
if (Settings.Default.Sign_UseOutputDir)
outputFile = Path.Combine(Settings.Default.Sign_OutputDir, Path.GetFileName(inputFile));
if (File.Exists(outputFile))
@@ -214,7 +214,7 @@ namespace APKToolGUI.Handlers
}
}
internal void alignApkOpenDirBtn_Click(object sender, EventArgs e)
internal void AlignApkOpenDirBtn_Click(object sender, EventArgs e)
{
string inputFile = Settings.Default.Zipalign_InputFile;
+20 -20
View File
@@ -18,24 +18,24 @@ namespace APKToolGUI.Handlers
public MenuItemHandlers(FormMain Main)
{
main = Main;
main.saveLogToFileToolStripMenuItem.Click += saveLogItem_Click;
main.settingsToolStripMenuItem.Click += menuItemSettings_Click;
main.exitToolStripMenuItem.Click += menuItemExit_Click;
main.openTempFolderToolStripMenuItem.Click += openTempFolderToolStripMenuItem_Click;
main.checkForUpdateToolStripMenuItem.Click += menuItemCheckUpdate_Click;
main.aboutToolStripMenuItem.Click += menuItemAbout_Click;
main.apktoolIssuesToolStripMenuItem.Click += apktoolIssuesLinkItem_Click;
main.baksmaliIssuesToolStripMenuItem.Click += baksmaliIssuesLinkItem_Click;
main.reportAnIsuueToolStripMenuItem.Click += reportAnIsuueToolStripMenuItem_Click;
main.newInsToolStripMenuItem.Click += newInsToolStripMenuItem_Click;
main.saveLogToFileToolStripMenuItem.Click += SaveLogItem_Click;
main.settingsToolStripMenuItem.Click += MenuItemSettings_Click;
main.exitToolStripMenuItem.Click += MenuItemExit_Click;
main.openTempFolderToolStripMenuItem.Click += OpenTempFolderToolStripMenuItem_Click;
main.checkForUpdateToolStripMenuItem.Click += MenuItemCheckUpdate_Click;
main.aboutToolStripMenuItem.Click += MenuItemAbout_Click;
main.apktoolIssuesToolStripMenuItem.Click += ApktoolIssuesLinkItem_Click;
main.baksmaliIssuesToolStripMenuItem.Click += BaksmaliIssuesLinkItem_Click;
main.reportAnIsuueToolStripMenuItem.Click += ReportAnIsuueToolStripMenuItem_Click;
main.newInsToolStripMenuItem.Click += NewInsToolStripMenuItem_Click;
}
private void newInsToolStripMenuItem_Click(object sender, EventArgs e)
private void NewInsToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
}
private void saveLogItem_Click(object sender, EventArgs e)
private void SaveLogItem_Click(object sender, EventArgs e)
{
using (var sfd = new SaveFileDialog())
{
@@ -50,7 +50,7 @@ namespace APKToolGUI.Handlers
}
}
private void menuItemSettings_Click(object sender, EventArgs e)
private void MenuItemSettings_Click(object sender, EventArgs e)
{
Theme theme = (Theme)Settings.Default.Theme;
@@ -64,12 +64,12 @@ namespace APKToolGUI.Handlers
frm.ShowDialog();
}
private void menuItemExit_Click(object sender, EventArgs e)
private void MenuItemExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void openTempFolderToolStripMenuItem_Click(object sender, EventArgs e)
private void OpenTempFolderToolStripMenuItem_Click(object sender, EventArgs e)
{
if (Directory.Exists(Program.TEMP_PATH))
Process.Start("explorer.exe", Program.TEMP_PATH);
@@ -80,12 +80,12 @@ namespace APKToolGUI.Handlers
}
}
private void menuItemCheckUpdate_Click(object sender, EventArgs e)
private void MenuItemCheckUpdate_Click(object sender, EventArgs e)
{
main.updateCheker.CheckAsync();
}
private void menuItemAbout_Click(object sender, EventArgs e)
private void MenuItemAbout_Click(object sender, EventArgs e)
{
Theme theme = (Theme)Settings.Default.Theme;
@@ -98,17 +98,17 @@ namespace APKToolGUI.Handlers
frm.ShowDialog();
}
private void apktoolIssuesLinkItem_Click(object sender, EventArgs e)
private void ApktoolIssuesLinkItem_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/iBotPeaches/Apktool/issues?q=is%3Aissue");
}
private void baksmaliIssuesLinkItem_Click(object sender, EventArgs e)
private void BaksmaliIssuesLinkItem_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/JesusFreke/smali/issues?q=is%3Aissue");
}
private void reportAnIsuueToolStripMenuItem_Click(object sender, EventArgs e)
private void ReportAnIsuueToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/AndnixSH/APKToolGUI/issues/new/choose");
}
+18 -19
View File
@@ -22,20 +22,19 @@ namespace APKToolGUI.Handlers
public SignControlEventHandlers(FormMain Main)
{
main = Main;
main.button_SIGN_BrowsePublicKey.Click += button_SIGN_BrowsePublicKey_Click;
main.button_SIGN_BrowsePrivateKey.Click += button_SIGN_BrowsePrivateKey_Click;
main.button_SIGN_BrowsePrivateKey.Click += button_SIGN_BrowsePrivateKey_Click;
main.button_SIGN_BrowseInputFile.Click += button_SIGN_BrowseInputFile_Click;
main.button_SIGN_BrowseOutputFile.Click += button_SIGN_BrowseOutputFile_Click;
main.schemev1ComboBox.SelectedIndexChanged += schemeComboBoxChanged;
main.schemev2ComboBox.SelectedIndexChanged += schemeComboBoxChanged;
main.schemev3ComboBox.SelectedIndexChanged += schemeComboBoxChanged;
main.schemev4ComboBox.SelectedIndexChanged += schemeComboBoxChanged;
main.button_SIGN_Sign.Click += button_SIGN_Sign_Click;
main.selectKeyStoreFileBtn.Click += selectKeyStoreFileBtn_Click;
main.button_SIGN_BrowsePublicKey.Click += Button_SIGN_BrowsePublicKey_Click;
main.button_SIGN_BrowsePrivateKey.Click += Button_SIGN_BrowsePrivateKey_Click;
main.button_SIGN_BrowseInputFile.Click += Button_SIGN_BrowseInputFile_Click;
main.button_SIGN_BrowseOutputFile.Click += Button_SIGN_BrowseOutputFile_Click;
main.schemev1ComboBox.SelectedIndexChanged += SchemeComboBox_SelectedIndexChanged;
main.schemev2ComboBox.SelectedIndexChanged += SchemeComboBox_SelectedIndexChanged;
main.schemev3ComboBox.SelectedIndexChanged += SchemeComboBox_SelectedIndexChanged;
main.schemev4ComboBox.SelectedIndexChanged += SchemeComboBox_SelectedIndexChanged;
main.button_SIGN_Sign.Click += Button_SIGN_Sign_Click;
main.selectKeyStoreFileBtn.Click += SelectKeyStoreFileBtn_Click;
}
internal void button_SIGN_BrowsePublicKey_Click(object sender, EventArgs e)
internal void Button_SIGN_BrowsePublicKey_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
@@ -50,7 +49,7 @@ namespace APKToolGUI.Handlers
}
}
internal void button_SIGN_BrowsePrivateKey_Click(object sender, EventArgs e)
internal void Button_SIGN_BrowsePrivateKey_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
@@ -65,7 +64,7 @@ namespace APKToolGUI.Handlers
}
}
internal void button_SIGN_BrowseOutputFile_Click(object sender, EventArgs e)
internal void Button_SIGN_BrowseOutputFile_Click(object sender, EventArgs e)
{
VistaFolderBrowserDialog dlg = new VistaFolderBrowserDialog();
dlg.ShowNewFolderButton = true;
@@ -76,7 +75,7 @@ namespace APKToolGUI.Handlers
}
}
internal void button_SIGN_BrowseInputFile_Click(object sender, EventArgs e)
internal async void Button_SIGN_BrowseInputFile_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
@@ -85,7 +84,7 @@ namespace APKToolGUI.Handlers
if (ofd.ShowDialog() == DialogResult.OK)
{
main.textBox_SIGN_InputFile.Text = ofd.FileName;
main.GetApkInfo(ofd.FileName);
await main.GetApkInfo(ofd.FileName);
main.textBox_SIGN_OutputFile.Text =
String.Format("{0}{1}{2}_signed{3}",
Path.GetDirectoryName(main.textBox_SIGN_InputFile.Text),
@@ -96,7 +95,7 @@ namespace APKToolGUI.Handlers
}
}
internal async void button_SIGN_Sign_Click(object sender, EventArgs e)
internal async void Button_SIGN_Sign_Click(object sender, EventArgs e)
{
try
{
@@ -125,7 +124,7 @@ namespace APKToolGUI.Handlers
}
}
internal void selectKeyStoreFileBtn_Click(object sender, EventArgs e)
internal void SelectKeyStoreFileBtn_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
@@ -135,7 +134,7 @@ namespace APKToolGUI.Handlers
}
}
private void schemeComboBoxChanged(object sender, EventArgs e)
private void SchemeComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
Settings.Default.Sign_Schemev1 = main.schemev1ComboBox.SelectedIndex;
Settings.Default.Sign_Schemev2 = main.schemev2ComboBox.SelectedIndex;
@@ -19,12 +19,12 @@ namespace APKToolGUI.Handlers
public SmaliControlEventHandlers(FormMain Main)
{
main = Main;
main.smaliBrowseOutputBtn.Click += smaliBrowseOutputBtn_Click;
main.smaliBrowseInputDirBtn.Click += smaliBrowseInputDirBtn_Click;
main.comSmaliBtn.Click += comSmaliBtn_Click;
main.smaliBrowseOutputBtn.Click += SmaliBrowseOutputBtn_Click;
main.smaliBrowseInputDirBtn.Click += SmaliBrowseInputDirBtn_Click;
main.comSmaliBtn.Click += ComSmaliBtn_Click;
}
internal void smaliBrowseOutputBtn_Click(object sender, EventArgs e)
internal void SmaliBrowseOutputBtn_Click(object sender, EventArgs e)
{
VistaFolderBrowserDialog dlg = new VistaFolderBrowserDialog();
dlg.ShowNewFolderButton = true;
@@ -35,7 +35,7 @@ namespace APKToolGUI.Handlers
}
}
internal void smaliBrowseInputDirBtn_Click(object sender, EventArgs e)
internal void SmaliBrowseInputDirBtn_Click(object sender, EventArgs e)
{
VistaFolderBrowserDialog dlg = new VistaFolderBrowserDialog();
dlg.ShowNewFolderButton = true;
@@ -46,7 +46,7 @@ namespace APKToolGUI.Handlers
}
}
internal void comSmaliBtn_Click(object sender, EventArgs e)
internal async void ComSmaliBtn_Click(object sender, EventArgs e)
{
if (main.smaliUseOutputChkBox.Checked)
{
@@ -63,7 +63,7 @@ namespace APKToolGUI.Handlers
return;
}
main.Smali(Settings.Default.Smali_InputDir);
await main.Smali(Settings.Default.Smali_InputDir);
}
}
}
@@ -21,10 +21,10 @@ namespace APKToolGUI.Handlers
{
main = Main;
CheckAlignSwitch = !Settings.Default.Zipalign_CheckOnly;
main.checkBox_ZIPALIGN_CheckAlignment.Click += checkBox_ZIPALIGN_CheckAlignment_CheckedChanged;
main.button_ZIPALIGN_BrowseOutputFile.Click += button_ZIPALIGN_BrowseOutputFile_Click;
main.button_ZIPALIGN_BrowseInputFile.Click += button_ZIPALIGN_BrowseInputFile_Click;
main.button_ZIPALIGN_Align.Click += button_ZIPALIGN_Align_Click;
main.checkBox_ZIPALIGN_CheckAlignment.Click += CheckBox_ZIPALIGN_CheckAlignment_CheckedChanged;
main.button_ZIPALIGN_BrowseOutputFile.Click += Button_ZIPALIGN_BrowseOutputFile_Click;
main.button_ZIPALIGN_BrowseInputFile.Click += Button_ZIPALIGN_BrowseInputFile_Click;
main.button_ZIPALIGN_Align.Click += Button_ZIPALIGN_Align_Click;
}
internal bool CheckAlignSwitch
@@ -36,12 +36,12 @@ namespace APKToolGUI.Handlers
}
}
internal void checkBox_ZIPALIGN_CheckAlignment_CheckedChanged(object sender, EventArgs e)
internal void CheckBox_ZIPALIGN_CheckAlignment_CheckedChanged(object sender, EventArgs e)
{
CheckAlignSwitch = !main.checkBox_ZIPALIGN_CheckAlignment.Checked;
}
internal void button_ZIPALIGN_BrowseOutputFile_Click(object sender, EventArgs e)
internal void Button_ZIPALIGN_BrowseOutputFile_Click(object sender, EventArgs e)
{
VistaFolderBrowserDialog dlg = new VistaFolderBrowserDialog();
dlg.ShowNewFolderButton = true;
@@ -52,7 +52,7 @@ namespace APKToolGUI.Handlers
}
}
internal void button_ZIPALIGN_BrowseInputFile_Click(object sender, EventArgs e)
internal async void Button_ZIPALIGN_BrowseInputFile_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
@@ -66,7 +66,7 @@ namespace APKToolGUI.Handlers
if (ofd.ShowDialog() == DialogResult.OK)
{
main.textBox_ZIPALIGN_InputFile.Text = ofd.FileName;
main.GetApkInfo(ofd.FileName);
await main.GetApkInfo(ofd.FileName);
if (!main.checkBox_ZIPALIGN_CheckAlignment.Checked)
main.textBox_ZIPALIGN_OutputFile.Text = String.Format("{0}\\{1}_zipaligned{2}",
Path.GetDirectoryName(ofd.FileName),
@@ -76,7 +76,7 @@ namespace APKToolGUI.Handlers
}
}
internal async void button_ZIPALIGN_Align_Click(object sender, EventArgs e)
internal async void Button_ZIPALIGN_Align_Click(object sender, EventArgs e)
{
if (!File.Exists(main.textBox_ZIPALIGN_InputFile.Text))
{
@@ -1,8 +0,0 @@
<linker>
<assembly fullname="System.Diagnostics.DiagnosticSource">
<type fullname="System.Diagnostics.Metrics.MetricsEventSource">
<!-- Used by System.Private.CoreLib via reflection to init the EventSource -->
<method name="GetInstance" />
</type>
</assembly>
</linker>
+4 -3
View File
@@ -14,7 +14,7 @@ namespace Java
public JarProcess(string javaPath, string jarPath)
{
JavaPath = javaPath.Equals("java") ? "" : javaPath;
JavaPath = string.IsNullOrWhiteSpace(javaPath) ? "java" : javaPath;
JarPath = jarPath;
Initialize();
}
@@ -38,8 +38,9 @@ namespace Java
if (Settings.Default.UseCustomJVMArgs)
customArgs = Settings.Default.CustomJVMArgs;
StartInfo.Arguments = String.Format("-jar {0} \"{1}\" {2}", customArgs, JarPath, args);
Debug.WriteLine(String.Format("-jar {0} \"{1}\" {2}", customArgs, JarPath, args));
string jvmArgs = string.IsNullOrWhiteSpace(customArgs) ? string.Empty : customArgs.Trim() + " ";
StartInfo.Arguments = String.Format("{0}-jar \"{1}\" {2}", jvmArgs, JarPath, args);
Debug.WriteLine(StartInfo.Arguments);
return base.Start();
}
+30
View File
@@ -510,6 +510,36 @@
<data name="ClearFrameworkPrompt" xml:space="preserve">
<value>После изменения версии Apktool необходимо очистить кеш. Вы хотите очистить его сейчас?</value>
</data>
<data name="RestartApplicationPrompt" xml:space="preserve">
<value>Для применения изменений требуется перезапуск. Перезапустить приложение сейчас?</value>
</data>
<data name="ClearTempFolder" xml:space="preserve">
<value>Очистка временной папки</value>
</data>
<data name="DeletingFolder" xml:space="preserve">
<value>Удаление папки: {0}</value>
</data>
<data name="DirectoryNotExist" xml:space="preserve">
<value>Директория "{0}" не существует</value>
</data>
<data name="OpenComFolder" xml:space="preserve">
<value>Открыть папку скомпилированных файлов</value>
</data>
<data name="OpenDecFolder" xml:space="preserve">
<value>Открыть папку декомпилированных файлов</value>
</data>
<data name="FixApktoolYml" xml:space="preserve">
<value>Исправлен apktool.yml</value>
</data>
<data name="CopyFileTo" xml:space="preserve">
<value>Копирование файла "{0}" в "{1}"</value>
</data>
<data name="SplitApkNotFound" xml:space="preserve">
<value>Split APK не выбран</value>
</data>
<data name="CantDetectApkeditorVersion" xml:space="preserve">
<value>Не удалось определить версию APKEditor</value>
</data>
<data name="SetLanguageRestartApplication" xml:space="preserve">
<value>Язык установлен. Хотите перезапустить программу?</value>
</data>
+26 -26
View File
@@ -10,6 +10,7 @@ using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace APKToolGUI
@@ -17,7 +18,7 @@ namespace APKToolGUI
static class Program
{
/// <summary>
/// Главная точка входа для приложения.
/// Main entry point for the application.
/// </summary>
[DllImport("Shcore.dll")]
static extern int SetProcessDpiAwareness(int PROCESS_DPI_AWARENESS);
@@ -118,14 +119,7 @@ namespace APKToolGUI
public static bool IsWin10OrAbove()
{
// Check if the operating system is Windows 10 or above
if (OSVersion.GetOSVersion().Version.Major >= 10 && OSVersion.GetOSVersion().Version.Minor >= 0)
{
return true;
}
else
{
return false;
}
return OSVersion.GetOSVersion().Version.Major >= 10;
}
@@ -141,38 +135,44 @@ namespace APKToolGUI
public static void SetLanguage()
{
String settingsCulture = Settings.Default.Culture;
if (settingsCulture.Equals("Auto"))
{
// Let .NET handle the resource fallback process.
// It will automatically use the system's language if a satellite assembly is available,
// otherwise it will fall back to the neutral language defined in the main assembly (English).
return;
}
try
{
if (settingsCulture.Equals("Auto"))
{
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InstalledUICulture;
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InstalledUICulture;
}
else
{
System.Globalization.CultureInfo _settingsCulture = System.Globalization.CultureInfo.GetCultureInfo(settingsCulture);
System.Threading.Thread.CurrentThread.CurrentUICulture = _settingsCulture;
System.Threading.Thread.CurrentThread.CurrentCulture = _settingsCulture;
}
System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.GetCultureInfo(settingsCulture);
System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
System.Threading.Thread.CurrentThread.CurrentCulture = culture;
}
catch
catch (System.Globalization.CultureNotFoundException ex)
{
Debug.WriteLine($"[Program] Invalid culture '{settingsCulture}': {ex.Message}");
// Fall back to system default culture
}
catch (ArgumentException ex)
{
Debug.WriteLine($"[Program] Failed to set culture: {ex.Message}");
}
}
private static bool FilesCheck()
{
// проверка файлов
// File verification
List<String> missigFiles = MissingFilesCheck();
if (missigFiles.Count > 0)
{
String files = Environment.NewLine;
StringBuilder filesBuilder = new StringBuilder();
filesBuilder.AppendLine();
foreach (String file in missigFiles)
{
files += file + Environment.NewLine;
filesBuilder.AppendLine(file);
}
MessageBox.Show(Language.RequiredFilesMissing + files, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(Language.RequiredFilesMissing + filesBuilder.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
//Application.Exit();
return false;
}
+17 -17
View File
@@ -2,35 +2,35 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Управление общими сведениями о сборке осуществляется с помощью
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
// General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("APK Tool GUI")]
[assembly: AssemblyDescription("GUI for apktool, signapk and zipalign utilities.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("APK Tool GUI")]
[assembly: AssemblyCopyright("Original owner: INFINUM, 2012-2015 | Maintained by: AndnixSH, 2022-2024")]
[assembly: AssemblyCopyright("Original owner: INFINUM, 2012-2015 | Maintained by: AndnixSH, 2022-2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Параметр ComVisible со значением FALSE делает типы в сборке невидимыми
// для COM-компонентов. Если требуется обратиться к типу в этой сборке через
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("49ccb60c-22a6-4a25-a4bf-9208712ad928")]
// Сведения о версии сборки состоят из следующих четырех значений:
// Version information for an assembly consists of the following four values:
//
// Основной номер версии
// Дополнительный номер версии
// Номер построения
// Редакция
// Major Version
// Minor Version
// Build Number
// Revision
//
// Можно задать все значения или принять номер построения и номер редакции по умолчанию,
// используя "*", как показано ниже:
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.3.1.6")]
[assembly: AssemblyFileVersion("3.3.1.6")]
[assembly: AssemblyVersion("3.3.2.1")]
[assembly: AssemblyFileVersion("3.3.2.1")]
+2 -2
View File
@@ -12,7 +12,7 @@ namespace APKToolGUI.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -1011,7 +1011,7 @@ namespace APKToolGUI.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(Bluegrams.Application.PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
[global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)]
public bool Build_UseAapt2 {
get {
+1 -1
View File
@@ -216,7 +216,7 @@
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="Build_UseAapt2" Provider="Bluegrams.Application.PortableSettingsProvider" Roaming="true" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="PlaySoundWhenDone" Provider="Bluegrams.Application.PortableSettingsProvider" Roaming="true" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
+3 -3
View File
@@ -17,7 +17,7 @@ namespace APKToolGUI.Utils
{
if (mf.Contains("<application"))
{
return StringExt.Regex(@"(?<=android:name=\"")(.*?)(?=\"")", mf);
return StringExt.RegexExtract(@"(?<=android:name=\"")(.*?)(?=\"")", mf);
}
}
return "";
@@ -31,11 +31,11 @@ namespace APKToolGUI.Utils
foreach (string mf in Manifest)
{
if (String.IsNullOrEmpty(packageName))
packageName = StringExt.Regex(@"(?<=package=\"")(.*?)(?=\"")", mf);
packageName = StringExt.RegexExtract(@"(?<=package=\"")(.*?)(?=\"")", mf);
if (mf.Contains("<activity"))
{
mainActivity = StringExt.Regex(@"(?<=android:name=\"")(.*?)(?=\"")", mf);
mainActivity = StringExt.RegexExtract(@"(?<=android:name=\"")(.*?)(?=\"")", mf);
}
if (mf.Contains("android.intent.action.MAIN"))
{
+24 -1
View File
@@ -38,6 +38,12 @@ namespace SaveToGameWpf.Logic.Utils
public static void CheckDragEnter(this DragEventArgs e, params string[] extensions)
{
string[] files = e.GetFilesDrop();
if (files.Length == 0)
{
e.Effect = DragDropEffects.None;
return;
}
if (extensions == null && Directory.Exists(files[0]))
e.Effect = DragDropEffects.Copy;
else if (extensions != null && extensions.Any(ext => files[0].EndsWith(ext, StringComparison.Ordinal)))
@@ -49,12 +55,18 @@ namespace SaveToGameWpf.Logic.Utils
public static bool CheckDragOver(this DragEventArgs e, params string[] extensions)
{
string[] files = e.GetFilesDrop();
if (files.Length == 0)
{
e.Effect = DragDropEffects.None;
return false;
}
if (extensions == null && Directory.Exists(files[0]))
{
e.Effect = DragDropEffects.Move;
return true;
}
else if (files.Length == 1 && extensions.Any(ext => files[0].EndsWith(ext, StringComparison.Ordinal)))
else if (extensions != null && files.Length == 1 && extensions.Any(ext => files[0].EndsWith(ext, StringComparison.Ordinal)))
{
e.Effect = DragDropEffects.Move;
return true;
@@ -68,6 +80,11 @@ namespace SaveToGameWpf.Logic.Utils
public static bool CheckManyDragOver(this DragEventArgs e, params string[] extensions)
{
string[] files = e.GetFilesDrop();
if (files.Length == 0)
{
e.Effect = DragDropEffects.None;
return false;
}
if (extensions == null && Directory.Exists(files[0]))
{
@@ -87,6 +104,9 @@ namespace SaveToGameWpf.Logic.Utils
public static bool DropOneByEnd(this DragEventArgs e, Action<string> onSuccess, params string[] extensions)
{
string[] files = e.GetFilesDrop();
if (files.Length == 0)
return false;
if (extensions == null && Directory.Exists(files[0]))
{
onSuccess(files[0]);
@@ -103,6 +123,9 @@ namespace SaveToGameWpf.Logic.Utils
public static bool DropManyByEnd(this DragEventArgs e, Action<string[]> onSuccess, params string[] extensions)
{
if (extensions == null || extensions.Length == 0)
return false;
foreach (string apk in extensions)
{
Debug.WriteLine(apk);
+33 -11
View File
@@ -14,23 +14,45 @@ namespace APKToolGUI.Utils
public static void KillAllProcessesSpawnedBy(UInt32 parentProcessId)
{
// NOTE: Process Ids are reused!
ManagementObjectSearcher searcher = new ManagementObjectSearcher(
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(
"SELECT * " +
"FROM Win32_Process " +
"WHERE ParentProcessId=" + parentProcessId);
ManagementObjectCollection collection = searcher.Get();
if (collection.Count > 0)
"WHERE ParentProcessId=" + parentProcessId))
{
foreach (var item in collection)
using (ManagementObjectCollection collection = searcher.Get())
{
UInt32 childProcessId = (UInt32)item["ProcessId"];
if ((int)childProcessId != Process.GetCurrentProcess().Id)
if (collection.Count > 0)
{
Debug.WriteLine($"Kill child process {childProcessId}");
KillAllProcessesSpawnedBy(childProcessId);
foreach (var item in collection)
{
UInt32 childProcessId = (UInt32)item["ProcessId"];
if ((int)childProcessId != Process.GetCurrentProcess().Id)
{
Debug.WriteLine($"Kill child process {childProcessId}");
Process childProcess = Process.GetProcessById((int)childProcessId);
childProcess.Kill();
// Recursively kill child processes
KillAllProcessesSpawnedBy(childProcessId);
// Kill and dispose the child process
try
{
using (Process childProcess = Process.GetProcessById((int)childProcessId))
{
childProcess.Kill();
}
}
catch (ArgumentException)
{
// Process already exited
Debug.WriteLine($"Process {childProcessId} already exited");
}
catch (InvalidOperationException ex)
{
// Process is terminating or has exited
Debug.WriteLine($"Process {childProcessId} is terminating: {ex.Message}");
}
}
}
}
}
}
+33 -8
View File
@@ -1,21 +1,40 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace APKToolGUI.Utils
{
public static class StringExt
{
static readonly Random random = new Random();
public static string Regex(string text, string match)
[ThreadStatic]
private static Random threadRandom;
private static Random ThreadRandom
{
Regex myRegex = new Regex(text);
Match matched = myRegex.Match(match);
get
{
if (threadRandom == null)
threadRandom = new Random(unchecked(Environment.TickCount * 31 + Thread.CurrentThread.ManagedThreadId));
return threadRandom;
}
}
/// <summary>
/// Extracts a string from the input using the provided regex pattern.
/// </summary>
/// <param name="pattern">The regex pattern to match.</param>
/// <param name="input">The input string to search.</param>
/// <returns>The matched string or empty string if no match found.</returns>
public static string RegexExtract(string pattern, string input)
{
Regex regex = new Regex(pattern);
Match matched = regex.Match(input);
return matched.ToString();
}
@@ -23,14 +42,14 @@ namespace APKToolGUI.Utils
{
const string chars = "abcdefghijklmnopqrstuvwxyz";
return new string(Enumerable.Repeat(chars, length)
.Select(s => s[random.Next(s.Length)]).ToArray());
.Select(s => s[ThreadRandom.Next(s.Length)]).ToArray());
}
public static string RandStrWithCaps(int length)
{
const string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
return new string(Enumerable.Repeat(chars, length)
.Select(s => s[random.Next(s.Length)]).ToArray());
.Select(s => s[ThreadRandom.Next(s.Length)]).ToArray());
}
/// <summary>
@@ -64,8 +83,14 @@ namespace APKToolGUI.Utils
if (text.Length < 1) return text;
return text.Remove(text.ToString().LastIndexOf(character), character.Length);
}
catch
catch (ArgumentOutOfRangeException ex)
{
Debug.WriteLine($"[StringExt] Character not found in text: {ex.Message}");
return text;
}
catch (Exception ex)
{
Debug.WriteLine($"[StringExt] Failed to remove last character: {ex.Message}");
return text;
}
}
+6 -6
View File
@@ -221,7 +221,7 @@
<value>False</value>
</setting>
<setting name="Build_UseAapt2" serializeAs="String">
<value>True</value>
<value>False</value>
</setting>
<setting name="PlaySoundWhenDone" serializeAs="String">
<value>False</value>
@@ -308,7 +308,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.2.0" newVersion="6.0.2.0" />
<bindingRedirect oldVersion="0.0.0.0-6.0.3.0" newVersion="6.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WinCopies.WindowsAPICodePack.Win32Native" publicKeyToken="ac0f4cf54a027a4d" culture="neutral" />
@@ -320,11 +320,11 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.HashCode" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
@@ -332,11 +332,11 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.10" newVersion="9.0.0.10" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Permissions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.10" newVersion="9.0.0.10" />
</dependentAssembly>
</assemblyBinding>
</runtime>
+13 -13
View File
@@ -2,7 +2,7 @@
<packages>
<package id="Costura.Fody" version="6.0.0" targetFramework="net48" developmentDependency="true" />
<package id="DarkNet" version="2.3.0" targetFramework="net48" />
<package id="Fody" version="6.9.2" targetFramework="net48" developmentDependency="true" />
<package id="Fody" version="6.9.3" targetFramework="net48" developmentDependency="true" />
<package id="Microsoft.Bcl.HashCode" version="6.0.0" targetFramework="net48" />
<package id="Microsoft.NETCore.Platforms" version="7.0.4" targetFramework="net48" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net48" />
@@ -16,16 +16,16 @@
<package id="Resource.Embedder" version="2.2.0" targetFramework="net48" />
<package id="ResourceLoader" version="3.3.1" targetFramework="net48" />
<package id="System.AppContext" version="4.3.0" targetFramework="net48" />
<package id="System.Buffers" version="4.6.0" targetFramework="net48" />
<package id="System.Buffers" version="4.6.1" targetFramework="net48" />
<package id="System.Collections" version="4.3.0" targetFramework="net48" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net48" />
<package id="System.Collections.Immutable" version="9.0.3" targetFramework="net48" />
<package id="System.Collections.Immutable" version="9.0.10" targetFramework="net48" />
<package id="System.Console" version="4.3.1" targetFramework="net48" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net48" />
<package id="System.Diagnostics.DiagnosticSource" version="9.0.3" targetFramework="net48" />
<package id="System.Diagnostics.DiagnosticSource" version="9.0.10" targetFramework="net48" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net48" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net48" />
<package id="System.Formats.Nrbf" version="9.0.3" targetFramework="net48" />
<package id="System.Formats.Nrbf" version="9.0.10" targetFramework="net48" />
<package id="System.Globalization" version="4.3.0" targetFramework="net48" />
<package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net48" />
<package id="System.IO" version="4.3.0" targetFramework="net48" />
@@ -33,20 +33,20 @@
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Linq" version="4.3.0" targetFramework="net48" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net48" />
<package id="System.Memory" version="4.6.1" targetFramework="net48" />
<package id="System.Memory" version="4.6.3" targetFramework="net48" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net48" />
<package id="System.Net.Primitives" version="4.3.1" targetFramework="net48" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net48" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net48" />
<package id="System.Reflection" version="4.3.0" targetFramework="net48" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net48" />
<package id="System.Reflection.Metadata" version="9.0.3" targetFramework="net48" />
<package id="System.Reflection.Metadata" version="9.0.10" targetFramework="net48" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Resources.Extensions" version="9.0.3" targetFramework="net48" />
<package id="System.Resources.Extensions" version="9.0.10" targetFramework="net48" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime" version="4.3.1" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.1" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net48" />
<package id="System.Runtime.Extensions" version="4.3.1" targetFramework="net48" />
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net48" />
@@ -57,16 +57,16 @@
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net48" />
<package id="System.Security.Permissions" version="9.0.3" targetFramework="net48" />
<package id="System.Security.Permissions" version="9.0.10" targetFramework="net48" />
<package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net48" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net48" />
<package id="System.Text.Encoding.CodePages" version="9.0.3" targetFramework="net48" />
<package id="System.Text.Encoding.CodePages" version="9.0.10" targetFramework="net48" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net48" />
<package id="System.Text.RegularExpressions" version="4.3.1" targetFramework="net48" />
<package id="System.Threading" version="4.3.0" targetFramework="net48" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net48" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net48" />
<package id="System.ValueTuple" version="4.6.0" targetFramework="net48" />
<package id="System.ValueTuple" version="4.6.1" targetFramework="net48" />
<package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="net48" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net48" />
</packages>
+32 -24
View File
@@ -10,13 +10,13 @@ It is a tool for reverse engineering 3rd party, closed, binary Android apps. It
# Download links
https://github.com/AndnixSH/APKToolGUI/releases
Any such report from your antivirus is a false positive and is due to how the application works. You must manually add APKToolGUI.exe to your antivirus's whitelist/exclusion list.
Any alert from your antivirus regarding this application is a **false positive**, caused by how the application operates. To resolve this, manually add **APKToolGUI.exe** to your antiviruss whitelist or exclusion list.
If you don't believe this then try to compile the app by yourself or simply don't use it until you can confirm it is safe by working directly with your antiirus provider.
If you remain unsure, you can compile the app yourself or refrain from using it until you confirm its safety with your antivirus provider.
# Requirements
- Windows 7 32-bit/64-bit and above
- [Java](https://www.java.com/en/) or [JDK](https://www.oracle.com/java/technologies/downloads/) 8 or above. Using latest JDK is not really necessary, it tends to cause unexpected issues. Java 8 and 17 (long-term support release) is enough. Use 64-bit version if your system is 64-bit
- [Java](https://www.java.com/en/) or [JDK](https://www.oracle.com/java/technologies/downloads/) 8 or above. Using latest JDK is not really necessary. Java 8 and 25 (long-term support release) is enough. Use 64-bit version if your system is 64-bit
- [.NET Framework 4.8](https://dotnet.microsoft.com/en-us/download/dotnet-framework/net48) (Windows 8 and above already have it preinstalled)
# Features
@@ -75,40 +75,48 @@ For Framework/system apps related issues, check on [XDA Forum](https://forum.xda
Anything else, [create a new issue](https://github.com/AndnixSH/APKToolGUI/issues)
# FAQ
##### Q: Can it be ported to other OS like Linux?
A: Notthing is impossible, but it's not easy as long as Microsoft not supporting WinForm for other platforms, making .NET Core useless, unlike Java FX that supports other platforms since decades. If you know, feel free to open an issue. Until then, use [WineHQ](https://www.winehq.org/) or similar to run exe
##### Can it be ported to macOS or Linux?
Microsoft has not made it easy to port, and .NET Core remains impractical for this purpose. While I could use Avalonia UI as an alternative, I currently dont have the time to port the entire project. Pull requests are welcome!
##### Q: How to update Apktool?
A: Download [Apktool.jar](https://github.com/iBotPeaches/Apktool/releases) and replace it on Resources folder
In the meantime, you can use [WineHQ](https://www.winehq.org/) or similar tools to run the .exe file.
##### Q: How to update Baksmali/Smali?
A: Download [Baksmali.jar/Smali.jar](https://bitbucket.org/JesusFreke/smali/downloads/) and replace it on Resources folder
##### How to update Apktool?
Download [Apktool.jar](https://github.com/iBotPeaches/Apktool/releases) and replace it on Resources folder
##### Q: How to reset?
A: Simply delete the config.xml file from the directory of the executeable
##### How to update Baksmali/Smali?
Download [Baksmali.jar/Smali.jar](https://bitbucket.org/JesusFreke/smali/downloads/) and replace it on Resources folder
##### Q: Can you make an automatic APK injecting tool?
A: No, I'm not interested.
##### How to reset?
Simply delete the config.xml file from the directory of the executeable
##### Q: Can you implement to convert APK to AAB?
A: No, apktool is about recompiling, not converting to other formats. AAB is only used for distributing an application to Play Store, so it is not directly installable. If you really want to convert APK to ABB, try APK2AAB tool https://github.com/sensei-z/APK2AAB
##### Can you help me with modding APKs in general?
No, I do not provide support for APK modding.
##### Q: I don't like split APK. Where can I get single APK instead?
A: Download from [Apkcombo's APK downloader](https://apkcombo.com/downloader/), or [Apkpure](https://apkpure.com/) (Choose APK instead XAPK)
##### Can you make an automatic APK injecting tool?
No, I'm not interested.
##### Q: Can you help me with modding APK in general?
A: Sorry, I don't offer support with it.
##### Can you implement APK to AAB conversion?
No, APKTool is designed for decompiling and recompiling APKs, not for converting between formats. AAB (Android App Bundle) is used exclusively for distributing apps on the Google Play Store and is not directly installable on devices.
##### Q: Can you implement features to protect/pack/obfuscate APK?
A: No, APK protection is beyond the scope of this tool
If you need to convert an APK to AAB, you can try using a tool like [APK2AAB](https://github.com/sensei-z/APK2AAB)
##### Q: Can you implement features to deobfuscate/unpack APK or bypass anti-cheat/security?
A: No, they are also beyond the scope of this tool. I don't condone bypassing such protections
##### Can you implement features to protect, pack, or obfuscate APKs?
No, APK protection is beyond the scope of this tool.
##### Can you implement features to deobfuscate, unpack APKs, or bypass anti-cheat/security?
No, these features are also beyond the scope of this tool. I do not support or condone bypassing such protections.
# Development
This project is written in C#
Use Visual Studio 2019 and above. NET Framework 4.8 SDK is required
Use Visual Studio 2022 and above. NET Framework 4.8 SDK is required
# Contributing
Contributions are welcome! Please ensure you:
- Submit pull requests with clear, detailed descriptions.
- Open an issue to discuss significant changes before implementing them.
- Do not submit pull requests for bypass or protection features.
# Credits
- AndnixSH
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
+23
View File
@@ -1,3 +1,26 @@
3.3.2.2
- Updated APKEditor to 1.4.7
- Updated Apktool to 3.0.1
- Updated ADB to 37.0.0-14910828
3.3.2.1
- Updated APKEditor to 1.4.5
- Updated Apktool to 2.12.1
- Updated Aapt & Zipalign
- Fixed *.zip and *.apkm not selectable for merging
- Export image when clicking on icon box in APK Info
3.3.2.0
- Remove flickering fix due to tabs flickering in Russian language. I will look into WPF for modern UI instead
- Updated tools (Apktool, APKEditor, AAPT, etc.) to latest versions
- Fixed issues that *.zip and *.apkm are not selectable
- Partially added Japanese language
- Partially added Turkish language
- Updated Vietnamese language
- Updated German language
Note: "Use Aapt2" must be disabled for Apktool 2.12.0 and above
3.3.1.6
- Fixed APK installation issue (Revert back to DotNetZip but using ProDotNetZip for fixed vulnerability)
- Update packages