mirror of
https://github.com/AndnixSH/APKToolGUI.git
synced 2026-05-04 11:02:27 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b043a4a3b | |||
| f974e198d5 | |||
| 8c43f59bd1 | |||
| bd1dcf6f64 | |||
| e0018909dc | |||
| 580c49b59c | |||
| 328736bbab | |||
| a294aa5a40 | |||
| 17289ff3f3 | |||
| 4471de12d5 | |||
| 469ccb6c9c | |||
| bfd2f41c88 | |||
| 6cda22c47e | |||
| 73dbd422a8 | |||
| 6411889613 |
@@ -0,0 +1,46 @@
|
||||
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
|
||||
run: |
|
||||
cp APKToolGUI/bin/Release/APKToolGUI.exe package/
|
||||
cp -r APKToolGUI/bin/Release/Resources package/
|
||||
cp APKToolGUI/bin/Release/*.dll package/
|
||||
|
||||
- name: Create placeholder config.xml
|
||||
run: New-Item -Path package/ -Name "config.xml" -ItemType "file"
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: APKToolGUI
|
||||
path: package/
|
||||
@@ -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>
|
||||
@@ -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
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,47 @@ 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");
|
||||
|
||||
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 +65,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,10 @@ using Java;
|
||||
|
||||
namespace APKToolGUI
|
||||
{
|
||||
public class Apktool : JarProcess
|
||||
public class Apktool : JarProcess, IDisposable
|
||||
{
|
||||
private bool disposed = false;
|
||||
|
||||
enum ApktoolActionType
|
||||
{
|
||||
Decompile,
|
||||
@@ -161,16 +163,27 @@ 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 (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(ex);
|
||||
Debug.WriteLine($"[Apktool] Failed to cancel process: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,6 +287,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($"[Apktool] Error during disposal: {ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
~Apktool()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void ApktoolDataReceivedEventHandler(Object sender, ApktoolDataReceivedEventArgs e);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
Generated
+3
-3
@@ -28,7 +28,6 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
||||
this.tabControlMain = new System.Windows.Forms.TabControl();
|
||||
this.tabPageMain = new System.Windows.Forms.TabPage();
|
||||
@@ -243,7 +242,7 @@
|
||||
this.toolStripStatusLabelStateImage = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabelStateText = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.progressBar = new System.Windows.Forms.ToolStripProgressBar();
|
||||
this.contextMenuStripLog = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.contextMenuStripLog = new System.Windows.Forms.ContextMenuStrip();
|
||||
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.clearLogToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.logTxtBox = new System.Windows.Forms.RichTextBox();
|
||||
@@ -265,7 +264,7 @@
|
||||
this.apktoolIssuesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.baksmaliIssuesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.tabControlMain.SuspendLayout();
|
||||
this.tabPageMain.SuspendLayout();
|
||||
@@ -828,6 +827,7 @@
|
||||
resources.ApplyResources(this.apkIconPicBox, "apkIconPicBox");
|
||||
this.apkIconPicBox.Name = "apkIconPicBox";
|
||||
this.apkIconPicBox.TabStop = false;
|
||||
this.apkIconPicBox.Click += new System.EventHandler(this.apkIconPicBox_Click);
|
||||
//
|
||||
// label11
|
||||
//
|
||||
|
||||
+284
-196
@@ -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,156 @@ 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);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
ToLog(ApktoolEventType.Warning, Language.ErrorGettingApkInfo + "\n" + ex.ToString());
|
||||
#else
|
||||
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 +367,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 +421,7 @@ namespace APKToolGUI
|
||||
color = Color.DarkOrange;
|
||||
else
|
||||
color = Color.Orange;
|
||||
color = Color.White;
|
||||
break;
|
||||
case ApktoolEventType.Unknown:
|
||||
if (Program.IsDarkTheme())
|
||||
@@ -537,7 +576,7 @@ namespace APKToolGUI
|
||||
DirectoryUtils.Delete(splitDir);
|
||||
Directory.CreateDirectory(splitDir);
|
||||
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
if (Settings.Default.Framework_ClearBeforeDecode)
|
||||
{
|
||||
@@ -574,10 +613,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 +666,7 @@ namespace APKToolGUI
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.InputFile, inputSplitApk));
|
||||
|
||||
@@ -717,7 +756,7 @@ namespace APKToolGUI
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
if (apktool.ClearFramework() == 0)
|
||||
{
|
||||
@@ -762,7 +801,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 +840,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 +1041,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 +1050,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 +1097,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 +1154,7 @@ namespace APKToolGUI
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
string tempApk = Path.Combine(Program.TEMP_PATH, "tempapk.apk");
|
||||
string outputApkFile = outputDir;
|
||||
@@ -1208,7 +1247,7 @@ namespace APKToolGUI
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
if (Settings.Default.Utf8FilenameSupport)
|
||||
{
|
||||
@@ -1302,7 +1341,7 @@ namespace APKToolGUI
|
||||
{
|
||||
devicesListBox.Items.Clear();
|
||||
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
devices = adb.GetDevices();
|
||||
});
|
||||
@@ -1352,7 +1391,7 @@ namespace APKToolGUI
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
code = adb.Install(device, inputApk);
|
||||
if (code == 0)
|
||||
@@ -1378,7 +1417,7 @@ namespace APKToolGUI
|
||||
#region Form handlers
|
||||
private async void FormMain_Shown(object sender, EventArgs e)
|
||||
{
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
InitializeUpdateChecker();
|
||||
InitializeZipalign();
|
||||
@@ -1451,7 +1490,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 +1525,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 +1565,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 +1583,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 +1602,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 +1697,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+978
-1098
File diff suppressed because it is too large
Load Diff
@@ -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();
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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.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);
|
||||
|
||||
@@ -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,7 +199,7 @@ 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;
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -22,20 +22,20 @@ 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_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 +50,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 +65,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 +76,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 +85,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 +96,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 +125,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 +135,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>
|
||||
+26
-26
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.0")]
|
||||
[assembly: AssemblyFileVersion("3.3.2.0")]
|
||||
|
||||
+2
-2
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"))
|
||||
{
|
||||
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
@@ -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>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,3 +1,14 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user