private void button5_Click(object sender, EventArgs e) { string serial = GetSelectedSerialnumber(); Thread thr = new Thread(() => { StandardIO.AdbCMDBackgroundNoReturn("", "shell wm size " + txt_phoneinformation_resolution.Text, " -s " + serial); }); thr.Start(); }
private void button3_Click(object sender, EventArgs e) { //about buttom; //StandardIO.AdbCMD("version"); //GetInformationAndOpenViewer("", "version", "ADBVersionInfo", 340, 150); String adb_version_from_cmd = StandardIO.AdbCMDBackground("", "version"); textBox1_about_pane.Text = adb_version_from_cmd; }
private void button4_Click(object sender, EventArgs e) { //adb help buttom; //StandardIO.AdbCMD("help"); //help cmd output is located in STDERR;use 2>&1 redirection; String adb_help_info = StandardIO.AdbCMDBackground("", "help 2>&1"); textBox1_about_pane.Text = adb_help_info; }
//-------------------------------------------------------------------------------------------------- //-------------------Methods------------------------------------------------------------------------ //-------------------------------------------------------------------------------------------------- //Refresh cbserials private void RefreshCBserials() { cbSerials.Invoke((MethodInvoker)(() => cbSerials.Items.Clear())); foreach (var item in StandardIO.GetDevices()) { cbSerials.Invoke((MethodInvoker)(() => cbSerials.Items.Add(item))); } cbSerials.Invoke((MethodInvoker)(() => cbSerials.SelectedIndex = cbSerials.Items.Count - 1)); }
private void btn_restore_restore_Click(object sender, EventArgs e) { if (txt_restore_path.Text == "") { MessageBox.Show("Please select a file!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { StandardIO.AdbCMD("restore \"" + txt_restore_path.Text + "\"", " -s " + GetSelectedSerialnumber()); } }
private void button2_Click(object sender, EventArgs e) { string serial = GetSelectedSerialnumber(); Thread thr = new Thread(() => { StandardIO.AdbCMDBackgroundNoReturn("", "shell su root busybox ifconfig wlan0 down", " -s " + serial); }); thr.Start(); Thread thr2 = new Thread(() => { StandardIO.AdbCMDBackground("", "shell su root busybox ifconfig wlan0 up", " -s " + serial); }); thr2.Start(); }
private void btn_push_push_Click(object sender, EventArgs e) { if (txt_push_fromfilepath.Text == "" || txt_push_tofilepath.Text == "") { MessageBox.Show("Please select a file and chose destination!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var s = "push \"" + txt_push_fromfilepath.Text + "\"" + " \"" + txt_push_tofilepath.Text + "\""; StandardIO.AdbCMD(s, " -s " + GetSelectedSerialnumber()); } }
private void btn_sideload_sideload_Click(object sender, EventArgs e) { if (txt_sideload_path.Text != "") { var s = "sideload \"" + txt_sideload_path.Text + "\""; StandardIO.AdbCMD(s, " -s " + GetSelectedSerialnumber()); } else { MessageBox.Show("Please select a file!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_run_Click(object sender, EventArgs e) { var s = txt_customcommand.Text; if (s == "") { MessageBox.Show("Please enter a command!", "Error"); } else { StandardIO.AdbCMD(@s, " -s " + GetSelectedSerialnumber()); } }
private void GetInstalledApps(string serial) { cbInstalledApps.Invoke((MethodInvoker)(() => { cbInstalledApps.Items.Clear(); })); string output = null; output = StandardIO.AdbCMDBackground("", "shell \"pm list packages -3 | cut -c9- | sort\"", " -s " + serial); foreach (var item in output.Split(new string[] { "\r\r\n", }, StringSplitOptions.RemoveEmptyEntries)) { cbInstalledApps.Invoke((MethodInvoker)(() => { cbInstalledApps.Items.Add(item); })); } }
private void RefreshInformationTextbox() { while (true) { string s = null; Thread tr = new Thread(() => { s = StandardIO.AdbCMDBackground("", "devices -l"); }); tr.Start(); tr.Join(); txt_devices.Invoke((MethodInvoker)(() => txt_devices.Text = s.ToUpper())); Thread.Sleep(3000); } }
private void btn_backup_backup_Click(object sender, EventArgs e) { var name = " -f \"" + txt_backup_path.Text + "\""; var apk = " -noapk"; var shared = " -noshared"; var all = " -all"; var system = " -system"; var package = txt_backup_packagename.Text; if (cb_backup_package.Checked == false) { if (txt_backup_path.Text == "") { MessageBox.Show("Please select a destination!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (cb_backup_withapk.Checked) { apk = " -apk"; } if (cb_backup_shared.Checked) { shared = " -shared"; } if (cb_backup_nosystem.Checked) { system = " -nosystem"; } StandardIO.AdbCMD("backup" + apk + shared + all + system + name, " -s " + GetSelectedSerialnumber()); } } else { if (txt_backup_path.Text == "") { MessageBox.Show("Please select a destination!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { StandardIO.AdbCMD("backup -apk " + package + name, " -s " + GetSelectedSerialnumber()); } } }
private void btn_phoneinformation_spoofmac_Click(object sender, EventArgs e) { var s = txt_phoneinformation_mac.Text; var r = new Regex(@"(([a-f]|[0-9]|[A-F]){2}\:){5}([a-f]|[0-9]|[A-F]){2}\b"); if (r.Match(s).Success) { string serial = GetSelectedSerialnumber(); Thread thr = new Thread(() => { StandardIO.AdbCMDBackgroundNoReturn("", "shell su root busybox ifconfig wlan0 hw ether " + s, "-s " + serial); }); thr.Start(); } else { MessageBox.Show("Please enter a valid MAC address", "Error"); } }
private void button5_Click_1(object sender, EventArgs e) { groupBox11.Enabled = false; tabControl1.Enabled = false; ThreadStart starter = () => { StandardIO.AdbCMDBackground("", "disconnect", ""); }; starter += () => { groupBox11.Invoke((MethodInvoker)(() => groupBox11.Enabled = true)); tabControl1.Invoke((MethodInvoker)(() => tabControl1.Enabled = true)); MessageBox.Show("Successfully disconnected", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }; Thread thread = new Thread(starter) { IsBackground = true }; thread.Start(); }
private void btn_packages_install_Click_1(object sender, EventArgs e) { var s = "\"" + txt_packages_path.Text + "\""; string serial = " -s " + GetSelectedSerialnumber(); if (txt_packages_path.Text != "") { //StandardIO.AdbCMD("install " + s, " -s " + GetSelectedSerialnumber()); string output = null; groupBox11.Enabled = false; tabControl1.Enabled = false; ThreadStart starter = () => { output = StandardIO.AdbCMDBackground("", "install " + s, serial); }; starter += () => { groupBox11.Invoke((MethodInvoker)(() => groupBox11.Enabled = true)); tabControl1.Invoke((MethodInvoker)(() => tabControl1.Enabled = true)); MessageBox.Show(output, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }; Thread thread = new Thread(starter) { IsBackground = true }; thread.Start(); while (thread.IsAlive) { Application.DoEvents(); } RefreshInstalledAps(); } else { MessageBox.Show("Please select a file!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_rebootmenu_reboot_Click(object sender, EventArgs e) { Close(); MainForm mainform = Application.OpenForms.OfType <MainForm>().Single(); string serial = " -s " + mainform.cbSerials.SelectedItem.ToString();; string cmd = null; switch (combo_rebootmenu.SelectedIndex) { case 0: //StandardIO.AdbCMDBackground("", "shell reboot -p", serial); cmd = "shell reboot -p"; break; case 1: //StandardIO.AdbCMDBackground("", "reboot", serial); cmd = "reboot"; break; case 2: //StandardIO.AdbCMDBackground("", "reboot bootloader", serial); cmd = "reboot bootloader"; break; case 3: //StandardIO.AdbCMDBackground("", "reboot recovery", serial); cmd = "reboot recovery"; break; } Thread thr = new Thread(() => { StandardIO.AdbCMDBackgroundNoReturn("", cmd, serial); }); thr.Start(); }
private void btn_remountsystem_Click(object sender, EventArgs e) { StandardIO.AdbCMDBackgroundNoReturn("", "remount"); }
private void btn_openshell_Click(object sender, EventArgs e) { StandardIO.AdbCMD("shell", " -s " + GetSelectedSerialnumber()); }
private void btn_phoneinformation_resetdpi_Click(object sender, EventArgs e) { StandardIO.AdbCMDBackground("", "shell wm density reset && tools\\adb reboot"); }
private void btn_phoneinformation_changedpi_Click(object sender, EventArgs e) { StandardIO.AdbCMDBackground("", "shell wm density " + txt_phoneinformation_dpi.Text + "&& tools\\adb reboot"); }