diff --git a/ATA-GUI/ATA-GUI.csproj b/ATA-GUI/ATA-GUI.csproj index 7283d8f..ff8599b 100644 --- a/ATA-GUI/ATA-GUI.csproj +++ b/ATA-GUI/ATA-GUI.csproj @@ -9,9 +9,9 @@ ATALogoGUI.ico - 3.4.3.0 - 3.4.3.0 - 3.4.3.0 + 3.4.4.0 + 3.4.4.0 + 3.4.4.0 © 2021-2024 Massimiliano Sartore diff --git a/ATA-GUI/Classes/ATA.cs b/ATA-GUI/Classes/ATA.cs index f614556..595210c 100644 --- a/ATA-GUI/Classes/ATA.cs +++ b/ATA-GUI/Classes/ATA.cs @@ -9,7 +9,7 @@ namespace ATA_GUI.Classes { internal class ATA { - public static readonly string CURRENTVERSION = "v3.4.3"; + public static readonly string CURRENTVERSION = "v3.4.4"; public static readonly string IPFileName = "IPList.txt"; public HashSet IPList { get; } = new HashSet(); diff --git a/ATA-GUI/Forms/MainForm.cs b/ATA-GUI/Forms/MainForm.cs index bee77b6..0c18d4d 100644 --- a/ATA-GUI/Forms/MainForm.cs +++ b/ATA-GUI/Forms/MainForm.cs @@ -988,14 +988,14 @@ private void backgroundWorkerFlashImg_DoWork(object sender, System.ComponentMode private async Task checkAdbFastboot(bool isAdb) { string exeTmp = isAdb ? "adb.exe" : "fastboot.exe"; - bool exist = File.Exists(exeTmp) && File.Exists("AdbWinUsbApi.dll") && File.Exists("AdbWinApi.dll"); + bool exist = File.Exists(exeTmp) && File.Exists("AdbWinUsbApi.dll") && File.Exists("AdbWinApi.dll") && File.Exists("etc1tool.exe"); if (!exist) { - LogWriteLine("adb not found", LogType.ERROR); + LogWriteLine("platform tools not found", LogType.ERROR); } - return exist || await ADBDownload(); + return exist || await ADBDownload(false); } private void buttonRebootToSystem_Click(object sender, EventArgs e) @@ -1247,11 +1247,11 @@ private void tabControl1_Selected(object sender, TabControlEventArgs e) panelFastboot.Enabled = false; } - private async Task ADBDownload() + public async Task ADBDownload(bool isUpdate) { if (!ata.IsConnected) { - MessageShowBox("You are offline, ATA can not download ADB", 0); + MessageShowBox("You are offline, ATA can not download SDK Platform Tools", 0); return false; } Invoke(delegate @@ -1260,7 +1260,9 @@ private async Task ADBDownload() buttonDisconnectIP.Enabled = false; }); - ExeMissingForm adbError = new("adb.exe not found\n\nDo you want to download sdk platform tool?\n\n[By pressing YES you agree sdk platform tool terms and conditions]\nfor more info press info button", "Error, ADB Missing!"); + string message = isUpdate ? "" : "SDK Platform Tools not found\n\n"; + + ExeMissingForm adbError = new(message + "Do you want to download them?\n\n[By pressing 'YES' you agree SDK Platform Tools terms and conditions]\nfor more info press info button", "Error, SDK Platform Tools Missing!"); _ = adbError.ShowDialog(); switch (adbError.DialogResult) @@ -1293,14 +1295,7 @@ private async Task ADBDownload() LogWriteLine("getting things ready...", LogType.INFO); _ = ConsoleProcess.systemCommand("taskkill /f /im adb.exe"); _ = ConsoleProcess.systemCommand("taskkill /f /im fastboot.exe"); - _ = ConsoleProcess.systemCommand("del adb.exe"); - _ = ConsoleProcess.systemCommand("del AdbWinUsbApi.dll"); - _ = ConsoleProcess.systemCommand("del AdbWinApi.dll"); - _ = ConsoleProcess.systemCommand("del fastboot.exe"); - _ = ConsoleProcess.systemCommand("move platform-tools\\adb.exe \"%cd%\""); - _ = ConsoleProcess.systemCommand("move platform-tools\\AdbWinUsbApi.dll \"%cd%\""); - _ = ConsoleProcess.systemCommand("move platform-tools\\AdbWinApi.dll \"%cd%\""); - _ = ConsoleProcess.systemCommand("move platform-tools\\fastboot.exe \"%cd%\""); + _ = ConsoleProcess.systemCommand("move /Y platform-tools\\* \"%cd%\""); Directory.Delete("platform-tools", true); File.Delete("sdkplatformtool.zip"); @@ -1479,10 +1474,15 @@ private void labelSettings_MouseLeave(object sender, EventArgs e) labelSettings.BackColor = Color.Black; } - private void labelSettings_Click(object sender, EventArgs e) + private async void labelSettings_Click(object sender, EventArgs e) { Settings settings = new(); - _ = settings.ShowDialog(); + DialogResult dialogResult = settings.ShowDialog(); + + if (dialogResult == DialogResult.Yes) + { + _ = await ADBDownload(true); + } } private void labelHelp_Click(object sender, EventArgs e) diff --git a/ATA-GUI/Forms/Settings.Designer.cs b/ATA-GUI/Forms/Settings.Designer.cs index fe62789..d7537ed 100644 --- a/ATA-GUI/Forms/Settings.Designer.cs +++ b/ATA-GUI/Forms/Settings.Designer.cs @@ -1,4 +1,6 @@  +using System; + namespace ATA_GUI { partial class Settings @@ -39,7 +41,7 @@ private void InitializeComponent() labelLog = new System.Windows.Forms.Label(); labelCurrentRelease = new System.Windows.Forms.Label(); checkBoxInitPopUp = new System.Windows.Forms.CheckBox(); - buttonRemoveLocalSDK = new System.Windows.Forms.Button(); + buttonUpdateLocalSDK = new System.Windows.Forms.Button(); buttonDeleteIPHistory = new System.Windows.Forms.Button(); SuspendLayout(); // @@ -145,19 +147,19 @@ private void InitializeComponent() checkBoxInitPopUp.UseVisualStyleBackColor = true; checkBoxInitPopUp.CheckedChanged += checkBoxInitPopUp_CheckedChanged; // - // buttonRemoveLocalSDK + // buttonUpdateLocalSDK // - buttonRemoveLocalSDK.BackColor = System.Drawing.Color.White; - buttonRemoveLocalSDK.FlatStyle = System.Windows.Forms.FlatStyle.System; - buttonRemoveLocalSDK.ForeColor = System.Drawing.Color.Black; - buttonRemoveLocalSDK.Location = new System.Drawing.Point(121, 236); - buttonRemoveLocalSDK.Margin = new System.Windows.Forms.Padding(2); - buttonRemoveLocalSDK.Name = "buttonRemoveLocalSDK"; - buttonRemoveLocalSDK.Size = new System.Drawing.Size(187, 27); - buttonRemoveLocalSDK.TabIndex = 42; - buttonRemoveLocalSDK.Text = "Remove local SDK"; - buttonRemoveLocalSDK.UseVisualStyleBackColor = false; - buttonRemoveLocalSDK.Click += buttonRemoveLocalSDK_Click; + buttonUpdateLocalSDK.BackColor = System.Drawing.Color.White; + buttonUpdateLocalSDK.FlatStyle = System.Windows.Forms.FlatStyle.System; + buttonUpdateLocalSDK.ForeColor = System.Drawing.Color.Black; + buttonUpdateLocalSDK.Location = new System.Drawing.Point(121, 236); + buttonUpdateLocalSDK.Margin = new System.Windows.Forms.Padding(2); + buttonUpdateLocalSDK.Name = "buttonUpdateLocalSDK"; + buttonUpdateLocalSDK.Size = new System.Drawing.Size(187, 27); + buttonUpdateLocalSDK.TabIndex = 42; + buttonUpdateLocalSDK.Text = "Update local SDK Platform Tools"; + buttonUpdateLocalSDK.UseVisualStyleBackColor = false; + buttonUpdateLocalSDK.Click += buttonUpdateLocalSDK_Click; // // buttonDeleteIPHistory // @@ -180,7 +182,7 @@ private void InitializeComponent() BackColor = System.Drawing.Color.White; ClientSize = new System.Drawing.Size(424, 347); Controls.Add(buttonDeleteIPHistory); - Controls.Add(buttonRemoveLocalSDK); + Controls.Add(buttonUpdateLocalSDK); Controls.Add(label1); Controls.Add(checkBoxInitPopUp); Controls.Add(labelLatestRelease); @@ -214,7 +216,7 @@ private void InitializeComponent() private System.Windows.Forms.Label labelLog; private System.Windows.Forms.Label labelCurrentRelease; private System.Windows.Forms.CheckBox checkBoxInitPopUp; - private System.Windows.Forms.Button buttonRemoveLocalSDK; + private System.Windows.Forms.Button buttonUpdateLocalSDK; private System.Windows.Forms.Button buttonDeleteIPHistory; } } \ No newline at end of file diff --git a/ATA-GUI/Forms/Settings.cs b/ATA-GUI/Forms/Settings.cs index 2d6c6af..65b271b 100644 --- a/ATA-GUI/Forms/Settings.cs +++ b/ATA-GUI/Forms/Settings.cs @@ -125,39 +125,10 @@ private void checkBoxInitPopUp_CheckedChanged(object sender, EventArgs e) _ = Feedback.changeFeedbackFile(true); } - private void buttonRemoveLocalSDK_Click(object sender, EventArgs e) + private void buttonUpdateLocalSDK_Click(object sender, EventArgs e) { - string[] programs = { "adb.exe", "fastboot.exe", "AdbWinUsbApi.dll", "AdbWinApi.dll" }; - bool nFound = false; - - _ = ConsoleProcess.systemCommand("taskkill /f /im " + programs[0]); - - foreach (string program in programs) - { - if (!deleter(program)) - { - nFound = true; - } - } - - if (nFound) - { - MainForm.MessageShowBox("SDK not found", 1); - } - else - { - MainForm.MessageShowBox("SDK deleted", 2); - } - } - - private bool deleter(string programName) - { - if (File.Exists(programName)) - { - File.Delete(programName); - return true; - } - return false; + DialogResult = DialogResult.Yes; + Close(); } private void buttonDeleteIPHistory_Click(object sender, EventArgs e) diff --git a/ATA-GUI/Forms/WaitingForm.cs b/ATA-GUI/Forms/WaitingForm.cs index 229c4ab..ed74489 100644 --- a/ATA-GUI/Forms/WaitingForm.cs +++ b/ATA-GUI/Forms/WaitingForm.cs @@ -10,8 +10,6 @@ public WaitingForm() InitializeComponent(); } - - private void backgroundWorkerMessages_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { int counter = 0; @@ -19,7 +17,7 @@ private void backgroundWorkerMessages_DoWork(object sender, System.ComponentMode while (!backgroundWorkerMessages.CancellationPending) { backgroundWorkerMessages.ReportProgress(counter++); - Thread.Sleep(1000); + Thread.Sleep(2000); } }