mirror of
https://github.com/AndnixSH/APKToolGUI.git
synced 2026-05-04 11:02:27 +00:00
Refactoring Code(Part 1)
This commit is contained in:
@@ -255,9 +255,18 @@ namespace APKToolGUI.Utils
|
||||
w.DownloadFile(StringExt.Regex(@"(?<=\""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}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+68
-19
@@ -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;
|
||||
}
|
||||
|
||||
@@ -71,7 +73,52 @@ namespace APKToolGUI
|
||||
}
|
||||
}
|
||||
}
|
||||
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,19 +167,21 @@ 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()
|
||||
|
||||
@@ -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;
|
||||
@@ -79,7 +81,18 @@ namespace APKToolGUI
|
||||
}
|
||||
}
|
||||
}
|
||||
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 +171,40 @@ namespace APKToolGUI
|
||||
return version.Replace("\r\n", "");
|
||||
}
|
||||
}
|
||||
|
||||
public new void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected 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,
|
||||
@@ -168,9 +170,17 @@ namespace APKToolGUI
|
||||
}
|
||||
}
|
||||
}
|
||||
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 +284,40 @@ namespace APKToolGUI
|
||||
return version.Replace("\r\n", "");
|
||||
}
|
||||
}
|
||||
|
||||
public new void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected 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;
|
||||
@@ -79,7 +81,18 @@ namespace APKToolGUI
|
||||
}
|
||||
}
|
||||
}
|
||||
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 +112,40 @@ namespace APKToolGUI
|
||||
CancelErrorRead();
|
||||
return ExitCode;
|
||||
}
|
||||
|
||||
public new void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected 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;
|
||||
@@ -82,7 +84,18 @@ namespace APKToolGUI
|
||||
}
|
||||
}
|
||||
}
|
||||
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 +165,40 @@ namespace APKToolGUI
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
public new void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected 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;
|
||||
@@ -76,7 +78,18 @@ namespace APKToolGUI
|
||||
}
|
||||
}
|
||||
}
|
||||
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 +109,40 @@ namespace APKToolGUI
|
||||
CancelErrorRead();
|
||||
return ExitCode;
|
||||
}
|
||||
|
||||
public new void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected 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
|
||||
|
||||
+110
-11
@@ -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;
|
||||
}
|
||||
|
||||
@@ -65,7 +67,52 @@ namespace APKToolGUI
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"[Zipalign] Cancel failed: {ex.Message}");
|
||||
// 프로세스 종료 실패는 치명적이지 않으므로 계속 진행
|
||||
}
|
||||
}
|
||||
|
||||
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 +149,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;
|
||||
}
|
||||
|
||||
+262
-196
@@ -40,6 +40,8 @@ namespace APKToolGUI
|
||||
private Stopwatch stopwatch = new Stopwatch();
|
||||
private string lastStartedDate;
|
||||
|
||||
private Image previousApkIcon;
|
||||
|
||||
internal static FormMain Instance { get; private set; }
|
||||
|
||||
public FormMain()
|
||||
@@ -172,116 +174,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);
|
||||
string arch = "";
|
||||
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"))
|
||||
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, ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var aaptParser = new AaptParser();
|
||||
var parsed = aaptParser.Parse(actualFile);
|
||||
|
||||
DirectoryUtils.Delete(splitPath);
|
||||
|
||||
return new ApkParseResult
|
||||
{
|
||||
Success = parsed,
|
||||
Aapt = aaptParser,
|
||||
Architecture = arch.TrimEnd(',', ' '),
|
||||
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 +364,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)
|
||||
@@ -537,7 +572,7 @@ namespace APKToolGUI
|
||||
DirectoryUtils.Delete(splitDir);
|
||||
Directory.CreateDirectory(splitDir);
|
||||
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
if (Settings.Default.Framework_ClearBeforeDecode)
|
||||
{
|
||||
@@ -574,10 +609,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 +662,7 @@ namespace APKToolGUI
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.InputFile, inputSplitApk));
|
||||
|
||||
@@ -717,7 +752,7 @@ namespace APKToolGUI
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
if (apktool.ClearFramework() == 0)
|
||||
{
|
||||
@@ -762,7 +797,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 +836,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 +1037,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 +1046,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 +1093,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 +1150,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 +1243,7 @@ namespace APKToolGUI
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
if (Settings.Default.Utf8FilenameSupport)
|
||||
{
|
||||
@@ -1302,7 +1337,7 @@ namespace APKToolGUI
|
||||
{
|
||||
devicesListBox.Items.Clear();
|
||||
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
devices = adb.GetDevices();
|
||||
});
|
||||
@@ -1352,7 +1387,7 @@ namespace APKToolGUI
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Factory.StartNew(() =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
code = adb.Install(device, inputApk);
|
||||
if (code == 0)
|
||||
@@ -1378,7 +1413,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 +1486,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 +1521,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 +1561,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 +1579,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 +1598,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
|
||||
|
||||
@@ -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,16 +14,16 @@ 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 async void selApkFileInfoBtn_Click(object sender, EventArgs e)
|
||||
private async void SelApkFileInfoBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (OpenFileDialog ofd = new OpenFileDialog())
|
||||
{
|
||||
@@ -34,37 +34,37 @@ namespace APKToolGUI.Handlers
|
||||
}
|
||||
}
|
||||
|
||||
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,7 +50,7 @@ namespace APKToolGUI.Handlers
|
||||
}
|
||||
}
|
||||
|
||||
internal async 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())
|
||||
{
|
||||
@@ -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))
|
||||
|
||||
@@ -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,22 +15,22 @@ 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())
|
||||
{
|
||||
@@ -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 async 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())
|
||||
{
|
||||
@@ -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 async void comSmaliBtn_Click(object sender, EventArgs e)
|
||||
internal async void ComSmaliBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (main.smaliUseOutputChkBox.Checked)
|
||||
{
|
||||
|
||||
@@ -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 async 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())
|
||||
{
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -17,7 +17,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);
|
||||
@@ -155,15 +155,20 @@ namespace APKToolGUI
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = _settingsCulture;
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
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("")]
|
||||
@@ -14,23 +14,23 @@ using System.Runtime.InteropServices;
|
||||
[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.2.0")]
|
||||
[assembly: AssemblyFileVersion("3.3.2.0")]
|
||||
|
||||
@@ -64,8 +64,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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user