Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btn_flash_boot_Click(object sender, EventArgs e)
- {
- String source_path = txt_boot.Text;
- if (File.Exists(source_path))
- {
- System.IO.File.Copy(source_path, "boot_AndroidControl.img", true);
- //---Reboot in Bootloader
- StripStatus.Text = "rebooting bootloader...";
- System.Diagnostics.ProcessStartInfo psi =
- new System.Diagnostics.ProcessStartInfo("C:/adb.exe", "reboot-bootloader");
- psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
- System.Diagnostics.Process.Start(psi).WaitForExit();
- // Checkt ob Gerät in Fastboot ist
- bool in_fastboot = false;
- while (in_fastboot == false)
- {
- Process process = new Process();
- process.StartInfo.UseShellExecute = false;
- process.StartInfo.RedirectStandardOutput = true;
- process.StartInfo.RedirectStandardError = true;
- process.StartInfo.CreateNoWindow = true;
- process.StartInfo.UseShellExecute = false;
- System.Threading.Thread.Sleep(500);
- process.StartInfo.FileName = "C:/fastboot.exe ";
- process.StartInfo.Arguments = "devices";
- process.Start();
- string output = process.StandardOutput.ReadToEnd();
- if (output.Contains("fastboot"))
- {
- in_fastboot = true;
- }
- else { in_fastboot = false; }
- }
- StripStatus.Text = "flashing boot...";
- System.Threading.Thread.Sleep(1500);
- System.Diagnostics.ProcessStartInfo psi2 =
- new System.Diagnostics.ProcessStartInfo("C:/fastboot.exe", "flash boot boot_AndroidControl.img");
- psi2.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
- System.Diagnostics.Process.Start(psi2).WaitForExit();
- System.Threading.Thread.Sleep(1500);
- StripStatus.Text = "boot flashed, rebooting phone now...";
- System.Diagnostics.ProcessStartInfo psi4 =
- new System.Diagnostics.ProcessStartInfo("C:/fastboot.exe", "reboot");
- psi4.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
- System.Diagnostics.Process.Start(psi4).WaitForExit();
- System.IO.File.Delete("boot_AndroidControl.img");
- System.Threading.Thread.Sleep(2500);
- StripStatus.Text = "Bereit";
- }
- else {
- MessageBox.Show("can't find recovery.img");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement