private async void TextBox2_DragDrop(object sender, DragEventArgs e) { string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); string s = ""; foreach (string File in FileList) { s = s + " " + File; } TextBox2.Text = s; if (IDDeviceState.RECOVERY == state) { cAppend("Copying " + " " + s + " " + " to /sdcard..."); await Task.Run(() => ADB.Instance().Push(s, "/sdcard")); Dialogs.InfoDialog("Move Files: Info", "File copied" + " " + s + " " + " into /sdcard!"); } else { Thread.Sleep(1000); cAppend("MOVE FILES TO TWRP: Your device is in the wrong state. Please put your device in recovery mode.\n"); Dialogs.WarningDialog("Move Files: " + s, "Please plug your device on booted TWRP!"); Invalidate(); } }
public void DCSelected() { if (activeForm != null) { activeForm.Dispose(); } if (oConfigMng.Config.DeviceCodenmae == "") { cAppend("Please connect your device to read firmwares!"); Dialogs.WarningDialog("Device Check", "Please connect your device to read firmwares!"); return; } if (oConfigMng.Config.DeviceCodenmae == oConfigMng.Config.DeviceCodenmae) { cAppend("Loading device..."); LoadDeviceServer.CheckDevice(oConfigMng.Config.DeviceCodenmae + ".xml", oConfigMng.Config.DeviceCodenmae); cAppend("Loading device... {OK}"); string tr = "true"; var main = new ToolMaintenance(); if (LoadDeviceServer.fserverMaintenance == tr) { cAppend("Firmware is on maintenance!"); openChildForm(main); } cAppend("Selected Device Channel: {" + oConfigMng.Config.DeviceFirmware + "}" + "\nDownloading " + oConfigMng.Config.DeviceFirmware + " Firmware"); Dialogs.InfoDialog("Device Channel", "Selected Device Channel: {" + oConfigMng.Config.DeviceFirmware + "}" + "\nDownloading " + oConfigMng.Config.DeviceFirmware + " Firmware"); oConfigMng.Config.FirmwareExtracted = "0"; oConfigMng.SaveConfig(); downloadstart(); } }
public void visual_reLoad() { Dialogs.InfoDialog(oConfigMng.Config.ToolLang, LangEngine.seleclanguitoolrestart); string arguments = string.Empty; string[] args = Environment.GetCommandLineArgs(); for (int i = 1; i < args.Length; i++) { arguments += args[i] + " "; } this.Controls.Clear(); this.Dispose(); Application.Exit(); System.Diagnostics.Process.Start(Application.ExecutablePath, arguments); }
public static void ClearFolders() { var paths = new[] { "C:\\adb\\" }; foreach (var path in paths) { if (Directory.Exists(path)) { Directory.Delete(path, true); } } Dialogs.InfoDialog("Clear folders", "All Folders cleared! The app will restart!"); Application.ExitThread(); Application.Restart(); }
private void ExtractFile_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { //Set the maximum vaue to int.MaxValue because the process is completed oConfigMng.LoadConfig(); progressBar_Individual.Value = int.MaxValue; progressBar_Total.Value = int.MaxValue; Dialogs.InfoDialog("INFO: Unzip", "The zip has been extracted well!"); oConfigMng.Config.FirmwareExtracted = "1"; oConfigMng.SaveConfig(); LoadDeviceServer.CheckDevice(oConfigMng.Config.DeviceCodenmae + ".xml", oConfigMng.Config.DeviceCodenmae); if (File.Exists(DownloadsMng.SAVEPathname)) { File.Delete(DownloadsMng.SAVEPathname); } this.Dispose(); }
public void Completed(object sender, AsyncCompletedEventArgs e) { // Here if its cancelled by the button, this will show a messagge if (e.Cancelled == true) { cAppend("Download has been canceled: " + DownloadsMng.filename); materialButton10.Enabled = false; materialButton23.Enabled = true; Dialogs.InfoDialog(DownloadsMng.filename, "Download has been canceled"); try { oConfigMng.LoadConfig(); if (DownloadsMng.filename == oConfigMng.Config.DeviceFirmwareInfo) { oConfigMng.Config.DownloadFileSizeFirmware = ""; oConfigMng.SaveConfig(); } if (DownloadsMng.filename == oConfigMng.Config.DeviceTWPRInfo) { oConfigMng.Config.DownloadFileSizeTWRP = ""; oConfigMng.SaveConfig(); } if (DownloadsMng.filename == oConfigMng.Config.DownloadFileSizeTWRPPermanent) { oConfigMng.Config.DownloadFileSizeTWRPPermanent = ""; oConfigMng.SaveConfig(); } } catch (Exception er) { Logs.DebugErrorLogs(er); Dialogs.ErrorDialog("ERROR: Removing file sizes", "Error: " + er); } return; } sw.Reset(); cAppend("Download completed!"); ProgressBar1.Value = 0; try { if (Path.GetExtension(DownloadsMng.SAVEPathname).Equals(".zip")) { // Check TWRP Installer try { string partialName = "twrp"; DirectoryInfo hdDirectoryInWhichToSearch = new DirectoryInfo(@"C:\adb\TWRP\"); FileInfo[] filesInDir = hdDirectoryInWhichToSearch.GetFiles("*" + partialName + "*.*"); foreach (FileInfo foundFile in filesInDir) { string fullName = foundFile.FullName; if (fullName == DownloadsMng.SAVEPathname) { cAppend(DownloadsMng.filename + " Info" + "\nDownload complete, " + DownloadsMng.filename + "is located at: " + Environment.NewLine + "'" + DownloadsMng.SAVEPath + "'."); Dialogs.InfoDialog(DownloadsMng.filename + " Info", "Download complete, " + DownloadsMng.filename + "is located at: " + Environment.NewLine + "'" + DownloadsMng.SAVEPath + "'."); closeform(); this.Dispose(); return; } } } catch (Exception er) { Logs.DebugErrorLogs(er); Dialogs.ErrorDialog("ERROR: Verify TWRP INSTALLER", "Error: " + er); } // If its zip file, show this general messagge cAppend(DownloadsMng.filename + " Info" + "\nDownload complete, " + DownloadsMng.filename + "is located at: " + Environment.NewLine + "'" + DownloadsMng.SAVEPath + "'."); Dialogs.InfoDialog(DownloadsMng.filename + " Info", "Download complete, " + DownloadsMng.filename + "is located at: " + Environment.NewLine + "'" + DownloadsMng.SAVEPath + "'."); this.Hide(); // here if xml reader firmware exctrated equals to 0, this will extract the downloaded zip! try { if (oConfigMng.Config.FirmwareExtracted == "0") { DirectoryInfo di = Directory.CreateDirectory(DownloadsMng.filename); var unzip = new UnzipUI(); unzip.textBox_FilePath.Text = DownloadsMng.SAVEPathname; unzip.textBox_ExtractionFolder.Text = DownloadsMng.filepath + DownloadsMng.filename; unzip.Text = "Unzip: " + DownloadsMng.filename; if (unzip.textBox_FilePath.Text != string.Empty && unzip.textBox_ExtractionFolder.Text != string.Empty) { unzip.extractFile.RunWorkerAsync(); } else { Strings.MsgBoxUnzippyAlert(); } unzip.Show(); if (File.Exists(DownloadsMng.SAVEPathname)) { File.Delete(DownloadsMng.SAVEPathname); } closeform(); this.Dispose(); return; } } catch (Exception er) { Logs.DebugErrorLogs(er); Dialogs.ErrorDialog("ERROR: Unzip File", "Error: " + er); } closeform(); this.Dispose(); return; } else { closeform(); return; } } catch (Exception er) { Logs.DebugErrorLogs(er); Dialogs.ErrorDialog("ERROR: Verify ZIP files", "Error: " + er); } }
private void downgradeBTN_Click(object sender, EventArgs e) { Dialogs.InfoDialog("Downgrade Mode", "Hey! this is not ready yet! soon will be working..."); }
private async void flash_Click(object sender, EventArgs e) { try { if (materialSwitchFlashAll.Checked == false && materialSwitchFlashAllExceptModem.Checked == false) { cAppend("MOTO FLASH: Please select an option!"); Dialogs.WarningDialog("Moto Flash", "Please select an option!"); return; } string firmwarepath = @"C:\\adb\\Firmware\\" + oConfigMng.Config.DeviceFirmware + oConfigMng.Config.DeviceFirmwareInfo; Thread.Sleep(3000); if (state == IDDeviceState.FASTBOOT || state == IDDeviceState.BOOTLOADER) { try { cAppend("MOTO FLASH: Settings firmware path: " + firmwarepath); Directory.SetCurrentDirectory(firmwarepath); cAppend("MOTO FLASH: Waiting for device..."); await Task.Run(() => ADB.WaitForDevice()); cAppend("MOTO FLASH: Rebooting into bootloader mode."); await Task.Run(() => ADB.Instance().Reboot(IDBoot.BOOTLOADER)); if (materialSwitchFlashAll.Checked == true) { cAppend("Device Info: Waiting for device..."); await Task.Run(() => ADB.WaitForDevice()); if (oConfigMng.Config.DeviceCodenmae == "sofiar" && oConfigMng.Config.DeviceCodenmae == "doha" && oConfigMng.Config.DeviceCodenmae == "ocean" && oConfigMng.Config.DeviceCodenmae == "evert") { FFlash(FirmwareFlashRead.set_a); } FFlash(FirmwareFlashRead.getvar); FFlash(FirmwareFlashRead.oem); FFlash(FirmwareFlashRead.gpt); FFlash(FirmwareFlashRead.bootloader); if (oConfigMng.Config.DeviceCodenmae == "sanders") { FFlash(FirmwareFlashRead.fsg_a); FFlash(FirmwareFlashRead.modemst1); FFlash(FirmwareFlashRead.modemst2); FFlash(FirmwareFlashRead.bluetooth_a); FFlash(FirmwareFlashRead.dsp_a); FFlash(FirmwareFlashRead.logo_a); FFlash(FirmwareFlashRead.boot_a); FFlash(FirmwareFlashRead.system_a_0); FFlash(FirmwareFlashRead.system_a_1); FFlash(FirmwareFlashRead.system_a_2); FFlash(FirmwareFlashRead.system_a_3); FFlash(FirmwareFlashRead.system_a_4); FFlash(FirmwareFlashRead.system_a_5); FFlash(FirmwareFlashRead.system_a_6); FFlash(FirmwareFlashRead.system_a_7); FFlash(FirmwareFlashRead.system_a_8); FFlash(FirmwareFlashRead.system_a_9); FFlash(FirmwareFlashRead.system_a_10); FFlash(FirmwareFlashRead.oem_a); } if (oConfigMng.Config.DeviceCodenmae == "potter") { FFlash(FirmwareFlashRead.fsg_a); FFlash(FirmwareFlashRead.modemst1); FFlash(FirmwareFlashRead.modemst2); FFlash(FirmwareFlashRead.bluetooth_a); FFlash(FirmwareFlashRead.dsp_a); FFlash(FirmwareFlashRead.logo_a); FFlash(FirmwareFlashRead.boot_a); FFlash(FirmwareFlashRead.system_a_0); FFlash(FirmwareFlashRead.system_a_1); FFlash(FirmwareFlashRead.system_a_2); FFlash(FirmwareFlashRead.system_a_3); FFlash(FirmwareFlashRead.system_a_4); FFlash(FirmwareFlashRead.system_a_5); FFlash(FirmwareFlashRead.system_a_6); FFlash(FirmwareFlashRead.system_a_7); FFlash(FirmwareFlashRead.system_a_8); FFlash(FirmwareFlashRead.oem_a); } if (oConfigMng.Config.DeviceCodenmae == "ocean") { FFlash(FirmwareFlashRead.modem_a); FFlash(FirmwareFlashRead.modem_b); FFlash(FirmwareFlashRead.fsg_a); FFlash(FirmwareFlashRead.fsg_b); FFlash(FirmwareFlashRead.modemst1); FFlash(FirmwareFlashRead.modemst2); FFlash(FirmwareFlashRead.dsp_a); FFlash(FirmwareFlashRead.dsp_b); FFlash(FirmwareFlashRead.logo_a); FFlash(FirmwareFlashRead.logo_b); FFlash(FirmwareFlashRead.boot_a); FFlash(FirmwareFlashRead.boot_b); FFlash(FirmwareFlashRead.dtbo_a); FFlash(FirmwareFlashRead.dtbo_b); FFlash(FirmwareFlashRead.system_a_0); FFlash(FirmwareFlashRead.system_a_1); FFlash(FirmwareFlashRead.system_a_2); FFlash(FirmwareFlashRead.system_a_3); FFlash(FirmwareFlashRead.system_a_4); FFlash(FirmwareFlashRead.system_a_5); FFlash(FirmwareFlashRead.system_a_6); FFlash(FirmwareFlashRead.system_a_7); FFlash(FirmwareFlashRead.system_a_8); FFlash(FirmwareFlashRead.system_a_9); FFlash(FirmwareFlashRead.system_b_0); FFlash(FirmwareFlashRead.system_b_1); FFlash(FirmwareFlashRead.system_b_2); FFlash(FirmwareFlashRead.vendor_a_0); FFlash(FirmwareFlashRead.vendor_a_1); FFlash(FirmwareFlashRead.vendor_b_0); FFlash(FirmwareFlashRead.vendor_b_1); FFlash(FirmwareFlashRead.oem_a); FFlash(FirmwareFlashRead.oem_b); } if (oConfigMng.Config.DeviceCodenmae == "sofiar") { FFlash(FirmwareFlashRead.vbmeta_a); FFlash(FirmwareFlashRead.vbmeta_b); FFlash(FirmwareFlashRead.radio_a); FFlash(FirmwareFlashRead.radio_b); FFlash(FirmwareFlashRead.bluetooth_a); FFlash(FirmwareFlashRead.bluetooth_b); FFlash(FirmwareFlashRead.dsp_a); FFlash(FirmwareFlashRead.dsp_b); FFlash(FirmwareFlashRead.logo_a); FFlash(FirmwareFlashRead.logo_b); FFlash(FirmwareFlashRead.boot_a); FFlash(FirmwareFlashRead.boot_b); FFlash(FirmwareFlashRead.dtbo_a); FFlash(FirmwareFlashRead.dtbo_b); FFlash(FirmwareFlashRead.recovery_a); FFlash(FirmwareFlashRead.recovery_b); FFlash(FirmwareFlashRead.system_a_0); FFlash(FirmwareFlashRead.system_a_1); FFlash(FirmwareFlashRead.system_a_2); FFlash(FirmwareFlashRead.system_a_3); FFlash(FirmwareFlashRead.system_a_4); FFlash(FirmwareFlashRead.system_a_5); FFlash(FirmwareFlashRead.system_a_6); FFlash(FirmwareFlashRead.system_a_7); FFlash(FirmwareFlashRead.system_a_8); FFlash(FirmwareFlashRead.system_a_9); FFlash(FirmwareFlashRead.system_a_10); FFlash(FirmwareFlashRead.system_a_11); FFlash(FirmwareFlashRead.system_a_12); FFlash(FirmwareFlashRead.system_a_13); FFlash(FirmwareFlashRead.system_a_14); } if (oConfigMng.Config.DeviceCodenmae == "doha") { FirmwareFlashRead.ReadFirmwareFlashAB(oConfigMng.Config.DeviceCodenmae); FFlash(FirmwareFlashRead.vbmeta_a); FFlash(FirmwareFlashRead.vbmeta_b); FFlash(FirmwareFlashRead.modem_a); FFlash(FirmwareFlashRead.modem_b); FFlash(FirmwareFlashRead.fsg_a); FFlash(FirmwareFlashRead.fsg_b); FFlash(FirmwareFlashRead.modemst1); FFlash(FirmwareFlashRead.modemst2); FFlash(FirmwareFlashRead.bluetooth_a); FFlash(FirmwareFlashRead.bluetooth_b); FFlash(FirmwareFlashRead.dsp_a); FFlash(FirmwareFlashRead.dsp_b); FFlash(FirmwareFlashRead.logo_a); FFlash(FirmwareFlashRead.logo_b); FFlash(FirmwareFlashRead.boot_a); FFlash(FirmwareFlashRead.boot_b); FFlash(FirmwareFlashRead.dtbo_a); FFlash(FirmwareFlashRead.dtbo_b); FFlash(FirmwareFlashRead.system_a_0); FFlash(FirmwareFlashRead.system_a_1); FFlash(FirmwareFlashRead.system_a_2); FFlash(FirmwareFlashRead.system_a_3); FFlash(FirmwareFlashRead.system_a_4); FFlash(FirmwareFlashRead.system_a_5); FFlash(FirmwareFlashRead.system_b_0); FFlash(FirmwareFlashRead.system_b_1); FFlash(FirmwareFlashRead.oem_a); FFlash(FirmwareFlashRead.oem_b); FFlash(FirmwareFlashRead.vendor_a); FFlash(FirmwareFlashRead.vendor_b); } if (oConfigMng.Config.DeviceCodenmae == "beckham") { FirmwareFlashRead.ReadFirmwareFlashAB(oConfigMng.Config.DeviceCodenmae); FFlash(FirmwareFlashRead.modem_a); FFlash(FirmwareFlashRead.fsg_a); FFlash(FirmwareFlashRead.modemst1); FFlash(FirmwareFlashRead.modemst2); FFlash(FirmwareFlashRead.bluetooth_a); FFlash(FirmwareFlashRead.dsp_a); FFlash(FirmwareFlashRead.logo_a); FFlash(FirmwareFlashRead.boot_a); FFlash(FirmwareFlashRead.system_a_0); FFlash(FirmwareFlashRead.system_a_1); FFlash(FirmwareFlashRead.system_a_2); FFlash(FirmwareFlashRead.system_a_3); FFlash(FirmwareFlashRead.system_a_4); FFlash(FirmwareFlashRead.system_a_5); FFlash(FirmwareFlashRead.system_b_0); FFlash(FirmwareFlashRead.oem_a); FFlash(FirmwareFlashRead.oem_b); FFlash(FirmwareFlashRead.vendor_a); FFlash(FirmwareFlashRead.vendor_b); } FFlash(FirmwareFlashRead.erasecarrier); FFlash(FirmwareFlashRead.eraseuserdata); FFlash(FirmwareFlashRead.eraseddr); FFlash(FirmwareFlashRead.oemclear); FFlash(FirmwareFlashRead.reboot); Dialogs.InfoDialog("FIRMWARE Installed!", "FIRMWARE: " + oConfigMng.Config.DeviceFirmwareInfo + " installed!"); } // no modem if (materialSwitchFlashAllExceptModem.Checked == true) { cAppend("Moto Flash: Flash No Modem: This option is not ready yet..."); Dialogs.WarningDialog("Moto Flash: Flash No Modem", "This option is not ready yet..."); materialSwitchFlashAllExceptModem.Checked = false; return; } } catch (Exception er) { Logs.DebugErrorLogs(er); Dialogs.WarningDialog("Moto Flash: ERROR", er.Message); } } else { Dialogs.WarningDialog("Moto Flash", "Please plug your device! Remember to plug your phone on Fastboot Mode!"); } } catch (Exception er) { Logs.DebugErrorLogs(er); Dialogs.ErrorDialog("ERROR: Moto Flash", "Error: " + er); return; } }
public void downloadstart() { oConfigMng.LoadConfig(); string firmwarepath = @"C:\\adb\\Firmware\\" + oConfigMng.Config.DeviceFirmware + @"\\" + DownloadsMng.filename; string firmwarezip = DownloadsMng.filepathname; var dld = new DownloadUI(); try { cAppend("FIRMWARE DOWNLOAD: Checking firmware files..."); if (File.Exists(firmwarezip) && oConfigMng.Config.FirmwareExtracted == "0") { long length = new FileInfo(firmwarezip).Length; string vIn = oConfigMng.Config.DownloadFileSizeFirmware; long vOut = Convert.ToInt64(vIn); if (length == vOut) { cAppend("FIRMWARE DOWNLOAD: Firmware already exist, now it will be exctracted"); DirectoryInfo di = Directory.CreateDirectory(DownloadsMng.filename); var unzip = new UnzipUI(); unzip.textBox_FilePath.Text = DownloadsMng.SAVEPathname; unzip.textBox_ExtractionFolder.Text = firmwarepath; unzip.Text = "Unzip: " + DownloadsMng.filename; cAppend("FIRMWARE DOWNLOAD EXTRACTING: Firmware " + DownloadsMng.filename); if (unzip.textBox_FilePath.Text != string.Empty && unzip.textBox_ExtractionFolder.Text != string.Empty) { unzip.extractFile.RunWorkerAsync(); } else { Strings.MsgBoxUnzippyAlert(); } unzip.Show(); return; } else { Strings.MSGBOXFileCorrupted(); oConfigMng.Config.DownloadFileSizeFirmware = ""; cAppend(@"FIRMWARE DOWNLOAD: File is corrupted \: " + DownloadsMng.SAVEPathname); File.Delete(DownloadsMng.SAVEPathname); oConfigMng.Config.DeviceFirmwareInfo = DownloadsMng.filename; oConfigMng.Config.FirmwareExtracted = "0"; oConfigMng.SaveConfig(); openChildForm(dld); return; } } else if (oConfigMng.Config.FirmwareExtracted == "1") { cAppend("FIRMWARE DOWNLOAD: Firmware already " + DownloadsMng.SAVEPathname); return; } } catch (Exception er) { Logs.DebugErrorLogs(er); Dialogs.ErrorDialog("ERROR: Unzip File", "Error: " + er); return; } if (Directory.Exists(firmwarepath)) { DirectoryInfo files = new DirectoryInfo(firmwarepath + @"\"); if (!File.Exists(files + "*.img") || !File.Exists("*.bin")) { cAppend("Can't find firmware images on folder! firmware will be downloaded again! \nFirmware: " + DownloadsMng.filename); Dialogs.ErrorDialog(DownloadsMng.filename, "Can't find firmware images on folder! firmware will be downloaded again! \nFirmware: " + DownloadsMng.filename); openChildForm(dld); return; } cAppend("Firmware already downloaded! \nFirmware: " + DownloadsMng.filename); Dialogs.InfoDialog(DownloadsMng.filename, "Firmware already downloaded! \nFirmware: " + DownloadsMng.filename); return; } else { CreateFirmwareFolder(); oConfigMng.Config.DeviceFirmwareInfo = DownloadsMng.filename; oConfigMng.Config.FirmwareExtracted = "0"; oConfigMng.SaveConfig(); openChildForm(dld); } }