mirror of
https://github.com/AndnixSH/APKToolGUI.git
synced 2026-06-03 11:07:39 +00:00
Implement cancellation when clicking on status bar
And clean up
This commit is contained in:
@@ -62,6 +62,17 @@ namespace APKToolGUI
|
||||
if (Exited != null)
|
||||
Exited(this, new ApkEditorExitedEventArgs(ExitCode));
|
||||
}
|
||||
public void Cancel()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (HasExited == false)
|
||||
{
|
||||
Kill();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public int Merge(string input, string output)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@ namespace APKToolGUI
|
||||
Null
|
||||
}
|
||||
|
||||
//Note: I don't use some features and don't use any framework related since I make it simple for game modding purposes
|
||||
static class DecompileKeys
|
||||
{
|
||||
public const string NoSource = " -s"; //Do not decode sources.
|
||||
@@ -146,6 +145,18 @@ namespace APKToolGUI
|
||||
return ExitCode;
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (HasExited == false)
|
||||
{
|
||||
Kill();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public int Build(string inputFolder, string outputFile)
|
||||
{
|
||||
string keyForceAll = null, keyAapt = null, keyCopyOriginal = null, noCrunch = null, keyFramePath = null, keyOutputAppPath = null, apiLevel = null, useAapt2 = null;
|
||||
|
||||
@@ -63,6 +63,18 @@ namespace APKToolGUI
|
||||
Exited(this, new BaksmaliExitedEventArgs(ExitCode));
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (HasExited == false)
|
||||
{
|
||||
Kill();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public int Disassemble(string input, string output)
|
||||
{
|
||||
string inputFile = String.Format("\"{0}\"", input);
|
||||
|
||||
@@ -65,6 +65,14 @@ namespace APKToolGUI
|
||||
Exited(this, new SignapkExitedEventArgs(base.ExitCode, lastSourceApk, lastOutApk));
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
if (HasExited == false)
|
||||
{
|
||||
Kill();
|
||||
}
|
||||
}
|
||||
|
||||
public int Sign(string input, string output)
|
||||
{
|
||||
lastSourceApk = input;
|
||||
|
||||
@@ -60,6 +60,18 @@ namespace APKToolGUI
|
||||
Exited(this, new SmaliExitedEventArgs(ExitCode));
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (HasExited == false)
|
||||
{
|
||||
Kill();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public int Assemble(string input, string output)
|
||||
{
|
||||
string inputFile = String.Format("\"{0}\"", input);
|
||||
|
||||
@@ -50,6 +50,18 @@ namespace APKToolGUI
|
||||
Exited(this, new EventArgs());
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (processZipalign.HasExited == false)
|
||||
{
|
||||
processZipalign.Kill();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public int Align(string input, string output)
|
||||
{
|
||||
string keyCheckOnly = null, keyVerbose = null, keyRecompress = null, keyOverwriteOutputFile = null, keyOutputFile = null;
|
||||
|
||||
Generated
+10
@@ -248,6 +248,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.tabControlMain.SuspendLayout();
|
||||
this.tabPageMain.SuspendLayout();
|
||||
this.signPanel.SuspendLayout();
|
||||
@@ -1787,6 +1788,7 @@
|
||||
this.toolStripStatusLabelStateText.Name = "toolStripStatusLabelStateText";
|
||||
this.toolStripStatusLabelStateText.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
|
||||
this.toolStripStatusLabelStateText.Spring = true;
|
||||
this.toolStripStatusLabelStateText.Click += new System.EventHandler(this.toolStripStatusLabelStateText_Click);
|
||||
//
|
||||
// toolStripProgressBar1
|
||||
//
|
||||
@@ -1795,6 +1797,7 @@
|
||||
this.toolStripProgressBar1.MarqueeAnimationSpeed = 30;
|
||||
this.toolStripProgressBar1.Name = "toolStripProgressBar1";
|
||||
this.toolStripProgressBar1.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
|
||||
this.toolStripProgressBar1.Click += new System.EventHandler(this.toolStripProgressBar1_Click);
|
||||
//
|
||||
// contextMenuStripLog
|
||||
//
|
||||
@@ -1960,6 +1963,12 @@
|
||||
resources.ApplyResources(this.aboutToolStripMenuItem, "aboutToolStripMenuItem");
|
||||
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.menuItemAbout_Click);
|
||||
//
|
||||
// toolTip1
|
||||
//
|
||||
this.toolTip1.AutoPopDelay = 10000;
|
||||
this.toolTip1.InitialDelay = 500;
|
||||
this.toolTip1.ReshowDelay = 100;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
@@ -2246,6 +2255,7 @@
|
||||
internal System.Windows.Forms.RichTextBox logTxtBox;
|
||||
internal System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
|
||||
private System.Windows.Forms.CheckBox checkBox_DECODE_UseApkEditorMerge;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+146
-94
@@ -17,6 +17,7 @@ using System.Media;
|
||||
using APKSMerger.AndroidRes;
|
||||
using Ionic.Zip;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace APKToolGUI
|
||||
{
|
||||
@@ -180,54 +181,12 @@ namespace APKToolGUI
|
||||
Close();
|
||||
break;
|
||||
case "sign":
|
||||
Running();
|
||||
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
string inputFile = file;
|
||||
string outputDir = file;
|
||||
if (Settings.Default.Zipalign_UseOutputDir && !IgnoreOutputDirContextMenu)
|
||||
outputDir = Path.Combine(Settings.Default.Sign_OutputDir, Path.GetFileName(inputFile));
|
||||
if (!Settings.Default.Sign_OverwriteInputFile)
|
||||
outputDir = PathUtils.GetDirectoryNameWithoutExtension(outputDir) + "_signed.apk";
|
||||
|
||||
if (Sign(inputFile, outputDir) == 0)
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.SignSuccessfullyCompleted, outputDir));
|
||||
|
||||
if (Settings.Default.AutoDeleteIdsigFile)
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.DeleteFile, outputDir + ".idsig"));
|
||||
FileUtils.Delete(outputDir + ".idsig");
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
else
|
||||
ToLog(ApktoolEventType.Error, String.Format(Language.ErrorSigning, outputDir));
|
||||
});
|
||||
|
||||
Done();
|
||||
if (await Sign(file) == 0)
|
||||
Close();
|
||||
break;
|
||||
case "zipalign":
|
||||
Running();
|
||||
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
string outputDir = file;
|
||||
if (Settings.Default.Zipalign_UseOutputDir && !IgnoreOutputDirContextMenu)
|
||||
outputDir = Path.Combine(Settings.Default.Zipalign_OutputDir, Path.GetFileName(file));
|
||||
|
||||
if (!Settings.Default.Zipalign_OverwriteOutputFile)
|
||||
outputDir = PathUtils.GetDirectoryNameWithoutExtension(outputDir) + " aligned.apk";
|
||||
|
||||
if (Align(file, outputDir) == 0)
|
||||
Close();
|
||||
else
|
||||
ToLog(ApktoolEventType.Error, Language.ErrorZipalign);
|
||||
});
|
||||
|
||||
Done(printTimer: true);
|
||||
if (await Align(file) == 0)
|
||||
Close();
|
||||
break;
|
||||
case "baksmali":
|
||||
if (await Baksmali(file) == 0)
|
||||
@@ -517,6 +476,8 @@ namespace APKToolGUI
|
||||
{
|
||||
int code = 0;
|
||||
|
||||
Running();
|
||||
|
||||
string apkFileName = Path.GetFileName(inputSplitApk);
|
||||
|
||||
string tempApk = Path.Combine(Program.TEMP_PATH, "dec.apk");
|
||||
@@ -531,8 +492,6 @@ namespace APKToolGUI
|
||||
|
||||
try
|
||||
{
|
||||
Running();
|
||||
|
||||
DirectoryUtils.Delete(extractedSplitDir);
|
||||
Directory.CreateDirectory(extractedSplitDir);
|
||||
DirectoryUtils.Delete(mergedDir);
|
||||
@@ -634,6 +593,8 @@ namespace APKToolGUI
|
||||
{
|
||||
int code = 0;
|
||||
|
||||
Running();
|
||||
|
||||
string apkFileName = Path.GetFileName(inputSplitApk);
|
||||
|
||||
string tempApk = Path.Combine(Program.TEMP_PATH, "dec.apk");
|
||||
@@ -650,8 +611,6 @@ namespace APKToolGUI
|
||||
|
||||
try
|
||||
{
|
||||
Running();
|
||||
|
||||
DirectoryUtils.Delete(splitDir);
|
||||
Directory.CreateDirectory(splitDir);
|
||||
|
||||
@@ -758,6 +717,8 @@ namespace APKToolGUI
|
||||
{
|
||||
int code = 0;
|
||||
|
||||
Running();
|
||||
|
||||
string apkFileName = Path.GetFileName(inputApk);
|
||||
string outputDir = PathUtils.GetDirectoryNameWithoutExtension(inputApk);
|
||||
if (Settings.Default.Decode_UseOutputDir && !IgnoreOutputDirContextMenu)
|
||||
@@ -768,18 +729,15 @@ namespace APKToolGUI
|
||||
|
||||
try
|
||||
{
|
||||
DirectoryUtils.Delete(outputTempDir);
|
||||
|
||||
if (!Settings.Default.Decode_Force && Directory.Exists(outputDir))
|
||||
{
|
||||
ToLog(ApktoolEventType.Error, String.Format(Language.DecodeDesDirExists, outputDir));
|
||||
return 1;
|
||||
}
|
||||
|
||||
Running();
|
||||
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
DirectoryUtils.Delete(outputTempDir);
|
||||
|
||||
if (Settings.Default.Framework_ClearBeforeDecode)
|
||||
{
|
||||
if (ClearFramework() == 0)
|
||||
@@ -1067,6 +1025,7 @@ namespace APKToolGUI
|
||||
try
|
||||
{
|
||||
Running();
|
||||
|
||||
ToLog(ApktoolEventType.Infomation, "=====[ " + Language.CompilingDex + " ]=====");
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.InputDirectory, inputDir));
|
||||
ToStatus(String.Format(Language.DecompilingDex + "...", Path.GetFileName(smaliBrowseInputDirTxtBox.Text)), Resources.waiting);
|
||||
@@ -1113,34 +1072,58 @@ namespace APKToolGUI
|
||||
ToLog(ApktoolEventType.Error, e.Data);
|
||||
}
|
||||
|
||||
internal int Align(string input, string output)
|
||||
internal async Task<int> Align(string inputFile)
|
||||
{
|
||||
int code = 0;
|
||||
|
||||
Running();
|
||||
|
||||
Invoke(new Action(delegate ()
|
||||
{
|
||||
ToLog(ApktoolEventType.Infomation, "=====[ " + Language.Aligning + " ]=====");
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.InputFile, input));
|
||||
ToStatus(String.Format(Language.Aligning + " \"{0}\"...", Path.GetFileName(input)), Resources.waiting);
|
||||
}));
|
||||
string outputDir = inputFile;
|
||||
if (Settings.Default.Zipalign_UseOutputDir && !IgnoreOutputDirContextMenu)
|
||||
outputDir = Path.Combine(Settings.Default.Zipalign_OutputDir, Path.GetFileName(inputFile));
|
||||
|
||||
string tempApk = Path.Combine(Program.TEMP_PATH, "tempapk.apk");
|
||||
string outputApkFile = output;
|
||||
if (!Settings.Default.Zipalign_OverwriteOutputFile)
|
||||
outputDir = PathUtils.GetDirectoryNameWithoutExtension(outputDir) + " aligned.apk";
|
||||
|
||||
if (Settings.Default.Utf8FilenameSupport)
|
||||
ToLog(ApktoolEventType.Infomation, "=====[ " + Language.Aligning + " ]=====");
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.InputFile, inputFile));
|
||||
ToStatus(String.Format(Language.Aligning + " \"{0}\"...", Path.GetFileName(inputFile)), Resources.waiting);
|
||||
|
||||
try
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.CopyFileToTemp, input, tempApk));
|
||||
FileUtils.Copy(input, tempApk, true);
|
||||
input = tempApk;
|
||||
output = tempApk;
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
string tempApk = Path.Combine(Program.TEMP_PATH, "tempapk.apk");
|
||||
string outputApkFile = outputDir;
|
||||
|
||||
if (Settings.Default.Utf8FilenameSupport)
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.CopyFileToTemp, inputFile, tempApk));
|
||||
FileUtils.Copy(inputFile, tempApk, true);
|
||||
inputFile = tempApk;
|
||||
outputDir = tempApk;
|
||||
}
|
||||
|
||||
code = zipalign.Align(inputFile, outputDir);
|
||||
if (code == 0)
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.ZipalignFileSavedTo, outputDir));
|
||||
if (Settings.Default.Utf8FilenameSupport)
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.MoveTempApkToOutput, tempApk, outputApkFile));
|
||||
FileUtils.Move(tempApk, outputApkFile, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
code = 1;
|
||||
ToLog(ApktoolEventType.Error, ex.Message);
|
||||
}
|
||||
|
||||
int code = zipalign.Align(input, output);
|
||||
if (code == 0 && Settings.Default.Utf8FilenameSupport)
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.MoveTempApkToOutput, tempApk, outputApkFile));
|
||||
FileUtils.Move(tempApk, outputApkFile, true);
|
||||
}
|
||||
Done(printTimer: true);
|
||||
|
||||
return code;
|
||||
}
|
||||
#endregion
|
||||
@@ -1163,31 +1146,67 @@ namespace APKToolGUI
|
||||
ToLog(ApktoolEventType.None, e.Message);
|
||||
}
|
||||
|
||||
internal int Sign(string input, string output)
|
||||
internal async Task<int> Sign(string input)
|
||||
{
|
||||
Invoke(new Action(delegate ()
|
||||
{
|
||||
ToLog(ApktoolEventType.Infomation, "=====[ " + Language.Signing + " ]=====");
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.InputFile, input));
|
||||
ToStatus(String.Format(Language.Signing + " \"{0}\"...", Path.GetFileName(input)), Resources.waiting);
|
||||
}));
|
||||
int code = 0;
|
||||
|
||||
Running();
|
||||
|
||||
string outputDir = input;
|
||||
if (Settings.Default.Zipalign_UseOutputDir && !IgnoreOutputDirContextMenu)
|
||||
outputDir = Path.Combine(Settings.Default.Sign_OutputDir, Path.GetFileName(input));
|
||||
if (!Settings.Default.Sign_OverwriteInputFile)
|
||||
outputDir = PathUtils.GetDirectoryNameWithoutExtension(outputDir) + "_signed.apk";
|
||||
|
||||
string tempApk = Path.Combine(Program.TEMP_PATH, "tempapk.apk");
|
||||
string outputApkFile = output;
|
||||
string outputApkFile = outputDir;
|
||||
|
||||
if (Settings.Default.Utf8FilenameSupport)
|
||||
ToLog(ApktoolEventType.Infomation, "=====[ " + Language.Signing + " ]=====");
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.InputFile, input));
|
||||
ToStatus(String.Format(Language.Signing + " \"{0}\"...", Path.GetFileName(input)), Resources.waiting);
|
||||
|
||||
try
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.CopyFileToTemp, input, tempApk));
|
||||
FileUtils.Copy(input, tempApk, true);
|
||||
input = tempApk;
|
||||
output = tempApk;
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
if (Settings.Default.Utf8FilenameSupport)
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.CopyFileToTemp, input, tempApk));
|
||||
FileUtils.Copy(input, tempApk, true);
|
||||
input = tempApk;
|
||||
outputDir = tempApk;
|
||||
}
|
||||
|
||||
code = signapk.Sign(input, outputDir);
|
||||
|
||||
if (code == 0)
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.SignSuccessfullyCompleted, outputDir));
|
||||
|
||||
if (Settings.Default.AutoDeleteIdsigFile)
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.DeleteFile, outputDir + ".idsig"));
|
||||
FileUtils.Delete(outputDir + ".idsig");
|
||||
}
|
||||
|
||||
if (Settings.Default.Utf8FilenameSupport)
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.MoveTempApkToOutput, tempApk, outputApkFile));
|
||||
FileUtils.Move(tempApk, outputApkFile, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
ToLog(ApktoolEventType.Error, String.Format(Language.ErrorSigning, outputDir));
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
code = 1;
|
||||
ToLog(ApktoolEventType.Error, ex.Message);
|
||||
}
|
||||
|
||||
int code = signapk.Sign(input, output);
|
||||
if (code == 0 && Settings.Default.Utf8FilenameSupport)
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.MoveTempApkToOutput, tempApk, outputApkFile));
|
||||
FileUtils.Move(tempApk, outputApkFile, true);
|
||||
}
|
||||
Done(printTimer: true);
|
||||
|
||||
return code;
|
||||
}
|
||||
#endregion
|
||||
@@ -1352,5 +1371,38 @@ namespace APKToolGUI
|
||||
Settings.Default.Save();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Cancel
|
||||
private void toolStripStatusLabelStateText_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show(Language.CancelProcess, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
CancelProcess();
|
||||
}
|
||||
|
||||
private void toolStripProgressBar1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show(Language.CancelProcess, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
CancelProcess();
|
||||
}
|
||||
|
||||
private void CancelProcess()
|
||||
{
|
||||
try
|
||||
{
|
||||
ToStatus(Language.PleaseWait, Resources.waiting);
|
||||
|
||||
apkeditor.Cancel();
|
||||
apktool.Cancel();
|
||||
baksmali.Cancel();
|
||||
smali.Cancel();
|
||||
zipalign.Cancel();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex);
|
||||
ActionButtonsEnabled = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5737,7 +5737,7 @@ and change target SDK to 29</value>
|
||||
<value>None</value>
|
||||
</data>
|
||||
<data name="toolStripStatusLabelStateText.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>479, 17</value>
|
||||
<value>448, 17</value>
|
||||
</data>
|
||||
<data name="toolStripStatusLabelStateText.Text" xml:space="preserve">
|
||||
<value>Loading...</value>
|
||||
@@ -5943,6 +5943,9 @@ and change target SDK to 29</value>
|
||||
<data name=">>menuStrip1.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>538, 13</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
@@ -7774,6 +7777,12 @@ and change target SDK to 29</value>
|
||||
<data name=">>aboutToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>toolTip1.Name" xml:space="preserve">
|
||||
<value>toolTip1</value>
|
||||
</data>
|
||||
<data name=">>toolTip1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>FormMain</value>
|
||||
</data>
|
||||
|
||||
@@ -138,7 +138,6 @@ namespace APKToolGUI
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void buttonCustomJavaLocation_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (OpenFileDialog openJavaExe = new OpenFileDialog())
|
||||
|
||||
@@ -128,30 +128,7 @@ namespace APKToolGUI.Handlers
|
||||
{
|
||||
main.textBox_ZIPALIGN_InputFile.Text = apkFile;
|
||||
|
||||
try
|
||||
{
|
||||
main.Running();
|
||||
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
string outputDir = apkFile;
|
||||
if (Settings.Default.Zipalign_UseOutputDir)
|
||||
outputDir = Path.Combine(Settings.Default.Zipalign_OutputDir, Path.GetFileName(apkFile));
|
||||
|
||||
if (!Settings.Default.Zipalign_OverwriteOutputFile)
|
||||
outputDir = PathUtils.GetDirectoryNameWithoutExtension(outputDir) + " aligned.apk";
|
||||
|
||||
if (main.Align(apkFile, outputDir) == 0)
|
||||
main.ToLog(ApktoolEventType.None, String.Format(Language.ZipalignFileSavedTo, outputDir));
|
||||
else
|
||||
main.ToLog(ApktoolEventType.Error, Language.ErrorZipalign);
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
main.ToLog(ApktoolEventType.Error, ex.Message);
|
||||
}
|
||||
main.Done(printTimer: true);
|
||||
await main.Align(apkFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,41 +144,7 @@ namespace APKToolGUI.Handlers
|
||||
{
|
||||
main.textBox_SIGN_InputFile.Text = apkFile;
|
||||
|
||||
try
|
||||
{
|
||||
main.Running();
|
||||
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
string inputFile = apkFile;
|
||||
string outputDir = apkFile;
|
||||
if (Settings.Default.Zipalign_UseOutputDir)
|
||||
outputDir = Path.Combine(Settings.Default.Sign_OutputDir, Path.GetFileName(inputFile));
|
||||
if (!Settings.Default.Sign_OverwriteInputFile)
|
||||
outputDir = PathUtils.GetDirectoryNameWithoutExtension(outputDir) + "_signed.apk";
|
||||
|
||||
if (main.Sign(inputFile, outputDir) == 0)
|
||||
{
|
||||
if (Settings.Default.Zipalign_UseOutputDir)
|
||||
main.ToLog(ApktoolEventType.None, String.Format(Language.SignSuccessfullyCompleted, inputFile));
|
||||
else
|
||||
main.ToLog(ApktoolEventType.None, String.Format(Language.SignSuccessfullyCompleted, outputDir));
|
||||
|
||||
if (Settings.Default.AutoDeleteIdsigFile)
|
||||
{
|
||||
main.ToLog(ApktoolEventType.None, String.Format(Language.DeleteFile, outputDir + ".idsig"));
|
||||
FileUtils.Delete(outputDir + ".idsig");
|
||||
}
|
||||
}
|
||||
else
|
||||
main.ToLog(ApktoolEventType.Error, String.Format(Language.ErrorSigning, outputDir));
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
main.ToLog(ApktoolEventType.Error, ex.Message);
|
||||
}
|
||||
main.Done(printTimer: true);
|
||||
await main.Sign(apkFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using APKToolGUI.Languages;
|
||||
using APKToolGUI.ApkTool;
|
||||
using APKToolGUI.Languages;
|
||||
using APKToolGUI.Properties;
|
||||
using APKToolGUI.Utils;
|
||||
using Ookii.Dialogs.WinForms;
|
||||
@@ -118,37 +119,12 @@ namespace APKToolGUI.Handlers
|
||||
|
||||
main.Running();
|
||||
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
string inputFile = Settings.Default.Sign_InputFile;
|
||||
string outputDir = inputFile;
|
||||
if (Settings.Default.Zipalign_UseOutputDir)
|
||||
outputDir = Path.Combine(Settings.Default.Sign_OutputDir, Path.GetFileName(inputFile));
|
||||
if (!Settings.Default.Sign_OverwriteInputFile)
|
||||
outputDir = PathUtils.GetDirectoryNameWithoutExtension(outputDir) + "_signed.apk";
|
||||
|
||||
if (main.Sign(inputFile, outputDir) == 0)
|
||||
{
|
||||
if (Settings.Default.Zipalign_UseOutputDir)
|
||||
main.ToLog(ApktoolEventType.None, String.Format(Language.SignSuccessfullyCompleted, inputFile));
|
||||
else
|
||||
main.ToLog(ApktoolEventType.None, String.Format(Language.SignSuccessfullyCompleted, outputDir));
|
||||
|
||||
if (Settings.Default.AutoDeleteIdsigFile)
|
||||
{
|
||||
main.ToLog(ApktoolEventType.None, String.Format(Language.DeleteFile, outputDir + ".idsig"));
|
||||
FileUtils.Delete(outputDir + ".idsig");
|
||||
}
|
||||
}
|
||||
else
|
||||
main.ToLog(ApktoolEventType.Error, String.Format(Language.ErrorSigning, outputDir));
|
||||
});
|
||||
await main.Sign(Settings.Default.Sign_InputFile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
main.ToLog(ApktoolEventType.Error, ex.Message);
|
||||
}
|
||||
main.Done(printTimer: true);
|
||||
}
|
||||
|
||||
internal void selectKeyStoreFileBtn_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -78,36 +78,15 @@ namespace APKToolGUI.Handlers
|
||||
|
||||
internal async void button_ZIPALIGN_Align_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
if (!File.Exists(main.textBox_ZIPALIGN_InputFile.Text))
|
||||
{
|
||||
if (!File.Exists(main.textBox_ZIPALIGN_InputFile.Text))
|
||||
{
|
||||
main.ShowMessage(Language.ErrorSelectedFileNotExist, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
string inputFile = Settings.Default.Zipalign_InputFile;
|
||||
|
||||
string outputDir = inputFile;
|
||||
if (Settings.Default.Zipalign_UseOutputDir)
|
||||
outputDir = Path.Combine(Settings.Default.Zipalign_OutputDir, Path.GetFileName(inputFile));
|
||||
|
||||
if (!Settings.Default.Zipalign_OverwriteOutputFile)
|
||||
outputDir = PathUtils.GetDirectoryNameWithoutExtension(outputDir) + " aligned.apk";
|
||||
|
||||
if (main.Align(inputFile, outputDir) == 0)
|
||||
main.ToLog(ApktoolEventType.None, String.Format(Language.ZipalignFileSavedTo, outputDir));
|
||||
else
|
||||
main.ToLog(ApktoolEventType.Error, Language.ErrorZipalign);
|
||||
});
|
||||
main.ShowMessage(Language.ErrorSelectedFileNotExist, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
main.ToLog(ApktoolEventType.Error, ex.Message);
|
||||
}
|
||||
main.Done(printTimer: true);
|
||||
|
||||
string inputFile = Settings.Default.Zipalign_InputFile;
|
||||
|
||||
await main.Align(inputFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+27
@@ -60,6 +60,15 @@ namespace APKToolGUI.Languages {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Aborted.
|
||||
/// </summary>
|
||||
internal static string Aborted {
|
||||
get {
|
||||
return ResourceManager.GetString("Aborted", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to About.
|
||||
/// </summary>
|
||||
@@ -132,6 +141,15 @@ namespace APKToolGUI.Languages {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Are you sure you want to cancel the process?.
|
||||
/// </summary>
|
||||
internal static string CancelProcess {
|
||||
get {
|
||||
return ResourceManager.GetString("CancelProcess", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Can't detect apktool version..
|
||||
/// </summary>
|
||||
@@ -888,6 +906,15 @@ namespace APKToolGUI.Languages {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Please wait....
|
||||
/// </summary>
|
||||
internal static string PleaseWait {
|
||||
get {
|
||||
return ResourceManager.GetString("PleaseWait", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Removed all ApkTool dummies.
|
||||
/// </summary>
|
||||
|
||||
@@ -468,4 +468,13 @@
|
||||
<data name="MergingApkEditor" xml:space="preserve">
|
||||
<value>Merging APK using APKEditor.jar</value>
|
||||
</data>
|
||||
<data name="Aborted" xml:space="preserve">
|
||||
<value>Aborted</value>
|
||||
</data>
|
||||
<data name="CancelProcess" xml:space="preserve">
|
||||
<value>Are you sure you want to cancel the process?</value>
|
||||
</data>
|
||||
<data name="PleaseWait" xml:space="preserve">
|
||||
<value>Please wait...</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
@@ -103,12 +104,14 @@ namespace SaveToGameWpf.Logic.Utils
|
||||
{
|
||||
foreach (string apk in extensions)
|
||||
{
|
||||
Debug.WriteLine(apk);
|
||||
string[] files = e.GetFilesDrop(apk);
|
||||
|
||||
if (files.Length > 0)
|
||||
{
|
||||
onSuccess(files);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user