From 92f842ea059ebdfc1e86993d6cab0fc1923d9b5c Mon Sep 17 00:00:00 2001 From: Furtif Date: Fri, 30 Sep 2022 02:39:54 +0200 Subject: [PATCH 1/3] save and reload last ip used --- adbGUI/Forms/MainForm.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/adbGUI/Forms/MainForm.cs b/adbGUI/Forms/MainForm.cs index b6271a1..066f535 100644 --- a/adbGUI/Forms/MainForm.cs +++ b/adbGUI/Forms/MainForm.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Drawing; +using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Threading; @@ -86,8 +87,11 @@ private void CloseApplication() Debug.WriteLine(" > Killing all child processes..."); CLI.StopWithShell(); - Debug.WriteLine(" > Closing application..."); - Environment.Exit(0); + // Save last ip config + File.WriteAllText("data.dat", tst_IpAdress.Text); + + Debug.WriteLine(" > Closing application..."); + Environment.Exit(0); } private void DevicesWatcher_DevicesChanged(object sender, List e) @@ -123,6 +127,12 @@ private void MainForm_KeyDown(object sender, KeyEventArgs e) private void MainForm_Load(object sender, EventArgs e) { + // Load last ip config + if (File.Exists("data.dat")) + { + tst_IpAdress.Text = File.ReadAllText("data.dat").Trim(); + } + // Begin and cancel so the RichTextBox will stay clean. Otherwise it will start in line 2. CLI.Commandline.BeginOutputReadLine(); CLI.Commandline.CancelOutputRead(); @@ -140,7 +150,6 @@ private void MainForm_Load(object sender, EventArgs e) if (HelperClass.AlwaysClearConsole) { rtb_console.Invoke((MethodInvoker)(() => rtb_console.Clear())); } }; - // We start a thread which continuously (see RICHTEXTBOX_REFRSH_INTERVAL) // reads stringBuilder and fills the RichTextBox and then empties stringBuilder. new Thread(AppendToRichTextBox).Start(); @@ -154,6 +163,7 @@ private void MainForm_Load(object sender, EventArgs e) //Select custom command control cbx_customCommand.Select(); } + private void Rtb_console_Resize(object sender, EventArgs e) { rtb_console.ScrollToCaret(); From db83171ea8fe775d6de3904f941a95ed6d403f36 Mon Sep 17 00:00:00 2001 From: Furtif Date: Fri, 30 Sep 2022 02:45:33 +0200 Subject: [PATCH 2/3] typo's --- adbGUI/Forms/MainForm.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/adbGUI/Forms/MainForm.cs b/adbGUI/Forms/MainForm.cs index 066f535..d86caea 100644 --- a/adbGUI/Forms/MainForm.cs +++ b/adbGUI/Forms/MainForm.cs @@ -87,11 +87,11 @@ private void CloseApplication() Debug.WriteLine(" > Killing all child processes..."); CLI.StopWithShell(); - // Save last ip config - File.WriteAllText("data.dat", tst_IpAdress.Text); + // Save last ip config + File.WriteAllText("data.dat", tst_IpAdress.Text); - Debug.WriteLine(" > Closing application..."); - Environment.Exit(0); + Debug.WriteLine(" > Closing application..."); + Environment.Exit(0); } private void DevicesWatcher_DevicesChanged(object sender, List e) @@ -163,7 +163,7 @@ private void MainForm_Load(object sender, EventArgs e) //Select custom command control cbx_customCommand.Select(); } - + private void Rtb_console_Resize(object sender, EventArgs e) { rtb_console.ScrollToCaret(); @@ -288,7 +288,7 @@ private void Tsb_Power_Click(object sender, EventArgs e) case "Reboot Fastboot": HelperClass.Execute("adb reboot fastboot"); break; - case "Reboot Emergency Download (Qualcomm Only)": + case "Reboot Emergency Download (Qualcomm Only)": HelperClass.Execute("adb reboot edl"); break; case "Samsung Odin/Download mode (Samsung only)": From 62034bd58b10ad792284759805c7f3dfac8abf06 Mon Sep 17 00:00:00 2001 From: Furtif Date: Fri, 30 Sep 2022 02:58:21 +0200 Subject: [PATCH 3/3] kill server if close --- adbGUI/Methods/CLI.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/adbGUI/Methods/CLI.cs b/adbGUI/Methods/CLI.cs index af8b97f..527a5f0 100644 --- a/adbGUI/Methods/CLI.cs +++ b/adbGUI/Methods/CLI.cs @@ -71,6 +71,7 @@ public static void KillChildProcessesAsync() public static void KillChildProcessesWithShell() { + HelperClass.Execute("adb kill-server"); string input = "taskkill /F "; foreach (int pid in GetChildProcesses())