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 MotoFlash_Load(object sender, EventArgs e) { oConfigMng.LoadConfig(); cAppend("STARTING MOTO FLASH: Starting DeviceDetectionService..."); await Task.Run(() => DeviceDetectionService()); cAppend("STARTING MOTO FLASH: Starting DeviceDetectionService... {OK}"); if (oConfigMng.Config.ToolTheme == "light") { materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; } if (oConfigMng.Config.ToolTheme == "dark") { materialSkinManager.Theme = MaterialSkinManager.Themes.DARK; } if (oConfigMng.Config.DeviceCodenmae == "") { cAppend("STARTING MOTO FLASH: Please connect your device, so MotoTool can check your device!"); Dialogs.WarningDialog("MotoFlash", "Please connect your device, so MotoTool can check your device!"); materialButtonDowngradeMoto.Enabled = false; materialButtonFlashMoto.Enabled = false; groupBox1.Enabled = false; return; } if (oConfigMng.Config.DeviceCodenmae != "beckham" && oConfigMng.Config.DeviceCodenmae != "doha" && oConfigMng.Config.DeviceCodenmae != "sanders" && oConfigMng.Config.DeviceCodenmae != "potter" && oConfigMng.Config.DeviceCodenmae != "ocean" && oConfigMng.Config.DeviceCodenmae != "sofiar") { cAppend("STARTING MOTO FLASH: Device not compatible yet! Current device: " + oConfigMng.Config.DeviceCodenmae); materialButtonDowngradeMoto.Enabled = false; materialButtonFlashMoto.Enabled = false; groupBox1.Enabled = false; Dialogs.WarningDialog("MotoFlash: Device not compatible yet!", "Hey! im working to make compatible your device! device compatible for now: Beckham, Doha, Potter, Sanders, Ocean and Sofiar"); return; } else { string firmwarepath = @"C:\\adb\\Firmware\\" + oConfigMng.Config.DeviceFirmware + oConfigMng.Config.DeviceFirmwareInfo; if (Directory.Exists(firmwarepath) && oConfigMng.Config.FirmwareExtracted == "1") { if (oConfigMng.Config.DeviceFirmware == oConfigMng.Config.DeviceFirmware) { cAppend("STARTING MOTO FLASH: Setting firmware path: " + firmwarepath); Directory.SetCurrentDirectory(firmwarepath); } } else { cAppend("STARTING MOTO FLASH: Please download your firmware! - Device Channel: " + "{ " + oConfigMng.Config.DeviceFirmware + "}"); materialButtonDowngradeMoto.Enabled = false; materialButtonFlashMoto.Enabled = false; groupBox1.Enabled = false; Dialogs.WarningDialog("Moto Flash", "Please download your firmware! - Device Channel: " + "{" + oConfigMng.Config.DeviceFirmware + "}"); return; } } }
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 static void ReadLang(string langxml, string lang) { try { reader = new XmlTextReader(LangFilePath + langxml); reader.MoveToContent(); string elementName = ""; if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == lang)) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { elementName = reader.Name; } else { if ((reader.NodeType == XmlNodeType.Text) && (reader.HasValue)) { switch (elementName) { case "btnfolder": btnfolder = reader.Value; break; case "btnadbfolder": btnadbfolder = reader.Value; break; case "btnclearfolder": btnclearfolder = reader.Value; break; case "btndownloads": btndownloads = reader.Value; break; case "btnfolderpath": btnfolderpath = reader.Value; break; case "btnmovefilestotwrp": btnmovefilestotwrp = reader.Value; break; case "btnunins": btnunins = reader.Value; break; case "btncheck4updates": btncheck4updates = reader.Value; break; case "btnrefreshtool": btnrefreshtool = reader.Value; break; case "btnhelp": btnhelp = reader.Value; break; case "btnexit": btnexit = reader.Value; break; case "btnunlock": btnunlock = reader.Value; break; case "btnlock": btnlock = reader.Value; break; case "otherslabel": otherslabel = reader.Value; break; case "btndownloadtwrppermanent": btndownloadtwrppermanent = reader.Value; break; case "rebotlabel": rebotlabel = reader.Value; break; case "langselect": langselect = reader.Value; break; case "dstatus": dstatus = reader.Value; break; case "toolwaitdownload": toolwaitdownload = reader.Value; break; case "freeram": freeram = reader.Value; break; case "foldersize": foldersize = reader.Value; break; case "username": username = reader.Value; break; case "rtabyeapf": rtabyeapf = reader.Value; break; case "internetchecktitle": internetchecktitle = reader.Value; break; case "internetcheck": internetcheck = reader.Value; break; case "internetcheckfiles": internetcheckfiles = reader.Value; break; case "dchannel": dchannel = reader.Value; break; case "dnotcompatibletitle": dnotcompatibletitle = reader.Value; break; case "dnotcompatiblebody": dnotcompatiblebody = reader.Value; break; case "deviceconnectedlistbox": deviceconnectedlistbox = reader.Value; break; case "devicecodenamelistbox": devicecodenamelistbox = reader.Value; break; case "connectmodelistbox": connectmodelistbox = reader.Value; break; case "deviceseriallistbox": deviceseriallistbox = reader.Value; break; case "batterylistbox": batterylistbox = reader.Value; break; case "batterytemplistbox": batterytemplistbox = reader.Value; break; case "batteryhealthlistbox": batteryhealthlistbox = reader.Value; break; case "devicerememberlistbox": devicerememberlistbox = reader.Value; break; case "deviceconnectedlistboxoff": deviceconnectedlistboxoff = reader.Value; break; case "devicecodenamelistboxoff": devicecodenamelistboxoff = reader.Value; break; case "connectmodelistboxoff": connectmodelistboxoff = reader.Value; break; case "deviceseriallistboxoff": deviceseriallistboxoff = reader.Value; break; case "batterylistboxoff": batterylistboxoff = reader.Value; break; case "batterytemplistboxoff": batterytemplistboxoff = reader.Value; break; case "batteryhealthlistboxoff": batteryhealthlistboxoff = reader.Value; break; case "newtoolupdate": newtoolupdate = reader.Value; break; case "newtoolupdate2": newtoolupdate2 = reader.Value; break; case "noupdatetitle": noupdatetitle = reader.Value; break; case "noupdatebody": noupdatebody = reader.Value; break; case "updateerrortitle": updateerrortitle = reader.Value; break; case "themeenginetitle": themeenginetitle = reader.Value; break; case "themeenginedarkbody": themeenginedarkbody = reader.Value; break; case "themeenginelightbody": themeenginelightbody = reader.Value; break; case "errorstartingadb": errorstartingadb = reader.Value; break; case "errorreadingout": errorreadingout = reader.Value; break; case "bootloaderreadmetitle": bootloaderreadmetitle = reader.Value; break; case "bootloaderreadme": bootloaderreadme = reader.Value; break; case "lockbootloadertitle": lockbootloadertitle = reader.Value; break; case "lockbootloaderbody1": lockbootloaderbody1 = reader.Value; break; case "lockbootloaderbody2": lockbootloaderbody2 = reader.Value; break; case "lockbootloaderbody3": lockbootloaderbody3 = reader.Value; break; case "lockingbl": lockingbl = reader.Value; break; case "lockingblok": lockingblok = reader.Value; break; case "lockblcancel": lockblcancel = reader.Value; break; case "checkingdeviceconnection": checkingdeviceconnection = reader.Value; break; case "checkingdeviceconnectionok": checkingdeviceconnectionok = reader.Value; break; case "devicerebooting": devicerebooting = reader.Value; break; case "connectdevice": connectdevice = reader.Value; break; case "connectdevicemototool": connectdevicemototool = reader.Value; break; case "connecttotwrp": connecttotwrp = reader.Value; break; case "motoflashplug": motoflashplug = reader.Value; break; case "interneconnectionoff": interneconnectionoff = reader.Value; break; case "interneconnectionok": interneconnectionok = reader.Value; break; case "readfirmware": readfirmware = reader.Value; break; case "debloatothersbox": debloatothersbox = reader.Value; break; case "debloatothershelp": debloatothershelp = reader.Value; break; case "debloatothers": debloatothers = reader.Value; break; case "flashtwrppermanent": flashtwrppermanent = reader.Value; break; case "flashtwrpab": flashtwrpab = reader.Value; break; case "twrpnotsupport": twrpnotsupport = reader.Value; break; case "twrpbooting": twrpbooting = reader.Value; break; case "blankflashnotsupport": blankflashnotsupport = reader.Value; break; case "blankflashcheck": blankflashcheck = reader.Value; break; case "cantfindlogo": cantfindlogo = reader.Value; break; case "logomissing": logomissing = reader.Value; break; case "motodrivers": motodrivers = reader.Value; break; case "motodriversinstall": motodriversinstall = reader.Value; break; case "clearfolderstitle": clearfolderstitle = reader.Value; break; case "clearfoldersbody": clearfoldersbody = reader.Value; break; case "openfoldererror": openfoldererror = reader.Value; break; case "createfoldererror": createfoldererror = reader.Value; break; case "clearfolderswarns2": clearfolderswarns2 = reader.Value; break; case "MSGBOXServerNetworkLosttitle": MSGBOXServerNetworkLosttitle = reader.Value; break; case "MSGBOXServerNetworkLost": MSGBOXServerNetworkLost = reader.Value; break; case "MSGBOXFileCorruptedtitle": MSGBOXFileCorruptedtitle = reader.Value; break; case "MSGBOXFileCorruptedbody": MSGBOXFileCorruptedbody = reader.Value; break; case "MSGBOXBootloaderWarning": MSGBOXBootloaderWarning = reader.Value; break; case "MSGBOXFirmwareMissingtitle": MSGBOXFirmwareMissingtitle = reader.Value; break; case "MSGBOXFirmwareMissingbody": MSGBOXFirmwareMissingbody = reader.Value; break; case "MsgBoxResultFirmwareInfo": MsgBoxResultFirmwareInfo = reader.Value; break; case "downloadUIdownloading": downloadUIdownloading = reader.Value; break; case "downloadUIdownloadcancel": downloadUIdownloadcancel = reader.Value; break; case "downloadUIdownloadcomplete": downloadUIdownloadcomplete = reader.Value; break; case "downloadUIfilelocate": downloadUIfilelocate = reader.Value; break; case "firmwareselected": firmwareselected = reader.Value; break; case "firmwarechannel": firmwarechannel = reader.Value; break; case "firmwarealreadydownloaded": firmwarealreadydownloaded = reader.Value; break; case "firmwareerror": firmwareerror = reader.Value; break; case "movetotwrpdrag": movetotwrpdrag = reader.Value; break; case "movetotwrpfilestitle": movetotwrpfilestitle = reader.Value; break; case "movetotwrpcopy": movetotwrpcopy = reader.Value; break; case "movetotwrpcopy1": movetotwrpcopy1 = reader.Value; break; case "movetotwrpfilescopy": movetotwrpfilescopy = reader.Value; break; case "movetotwrpfilescopy1": movetotwrpfilescopy1 = reader.Value; break; case "motoflashdevicenotcompatibletitle": motoflashdevicenotcompatibletitle = reader.Value; break; case "motoflashdevicenotcompatible": motoflashdevicenotcompatible = reader.Value; break; case "motoflashdownload": motoflashdownload = reader.Value; break; case "motoflashselectoption": motoflashselectoption = reader.Value; break; case "motoflashdetect": motoflashdetect = reader.Value; break; case "motoflashinstalled": motoflashinstalled = reader.Value; break; case "motoflashdowngrade": motoflashdowngrade = reader.Value; break; case "clearfolderswarn": clearfolderswarn = reader.Value; break; case "clearfolderscont": clearfolderscont = reader.Value; break; case "clearyesbtn": clearyesbtn = reader.Value; break; case "help": help = reader.Value; break; case "helpsource": helpsource = reader.Value; break; case "helphowto": helphowto = reader.Value; break; case "helpcontact": helpcontact = reader.Value; break; case "helpsourceinf": helpsourceinf = reader.Value; break; case "helpcoy": helpcoy = reader.Value; break; case "helptoolcompiled": helptoolcompiled = reader.Value; break; case "helptoolversion": helptoolversion = reader.Value; break; case "uninstallwarn": uninstallwarn = reader.Value; break; case "uninscont": uninscont = reader.Value; break; case "seleclanguilabel": seleclanguilabel = reader.Value; break; case "seleclanguitoolrestart": seleclanguitoolrestart = reader.Value; break; case "unzipuifilepath": unzipuifilepath = reader.Value; break; case "unzipuifildest": unzipuifildest = reader.Value; break; case "unzipuifileextract": unzipuifileextract = reader.Value; break; case "unzipuiprogressindi": unzipuiprogressindi = reader.Value; break; case "unzipuiprogresstotal": unzipuiprogresstotal = reader.Value; break; case "unzipuifilesize": unzipuifilesize = reader.Value; break; case "unzipuiprogress": unzipuiprogress = reader.Value; break; case "unzipexctractok": unzipexctractok = reader.Value; break; } } } } } } catch (Exception ex) { Dialogs.ErrorDialog("MotoTool Lang Engine", ex.Message); Logs.DebugErrorLogs(ex); } finally { if (reader != null) { reader.Close(); } } }
public static void TOOLDOWNLOAD(string serverpath, string serverpath2, string fchannelname) { if (InternetCheck.ConnectToInternet() == true) { try { reader = new XmlTextReader(xmlUrl + serverpath + serverpath2); reader.MoveToContent(); string elementName = ""; if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == fchannelname)) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { elementName = reader.Name; } else { if ((reader.NodeType == XmlNodeType.Text) && (reader.HasValue)) { switch (elementName) { case "url": downloadUrl = reader.Value; DOWNLOADPath = downloadUrl; break; case "name": filename = reader.Value; break; case "filepath": filepath = reader.Value; SAVEPath = filepath; break; case "filepathname": filepathname = reader.Value; SAVEPathname = filepathname; break; } } } } } } catch (Exception ex) { Logs.DebugErrorLogs(ex); Dialogs.ErrorDialog("Download Error", ex.Message); } finally { if (reader != null) { reader.Close(); } } } else { Dialogs.ErrorDialog("Network Lost", "Network lost... Please check your internet connection!"); } }
public static void ExtractAll() { try { if (!File.Exists("C:\\adb\\adb.exe")) { Stream adb1 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Franco28Tool.Engine.Resources.adb.adb.exe"); FileStream adb = new FileStream("C:\\adb\\adb.exe", FileMode.CreateNew); for (int i = 0; i < adb1.Length; i++) { adb.WriteByte((byte)adb1.ReadByte()); } adb.Close(); } if (!File.Exists("C:\\adb\\fastboot.exe")) { Stream fastboot1 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Franco28Tool.Engine.Resources.adb.fastboot.exe"); FileStream fastboot = new FileStream("C:\\adb\\fastboot.exe", FileMode.CreateNew); for (int i = 0; i < fastboot1.Length; i++) { fastboot.WriteByte((byte)fastboot1.ReadByte()); } fastboot.Close(); } if (!File.Exists("C:\\adb\\AdbWinUsbApi.dll")) { Stream AdbWinUsbApi1 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Franco28Tool.Engine.Resources.adb.AdbWinUsbApi.dll"); FileStream AdbWinUsbApi = new FileStream("C:\\adb\\AdbWinUsbApi.dll", FileMode.CreateNew); for (int i = 0; i < AdbWinUsbApi1.Length; i++) { AdbWinUsbApi.WriteByte((byte)AdbWinUsbApi1.ReadByte()); } AdbWinUsbApi.Close(); } if (!File.Exists("C:\\adb\\AdbWinApi.dll")) { Stream AdbWinApi1 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Franco28Tool.Engine.Resources.adb.AdbWinApi.dll"); FileStream AdbWinApi = new FileStream("C:\\adb\\AdbWinApi.dll", FileMode.CreateNew); for (int i = 0; i < AdbWinApi1.Length; i++) { AdbWinApi.WriteByte((byte)AdbWinApi1.ReadByte()); } AdbWinApi.Close(); } if (!File.Exists("C:\\adb\\libwinpthread-1.dll")) { Stream libwinpthread1 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Franco28Tool.Engine.Resources.adb.libwinpthread-1.dll"); FileStream libwinpthread = new FileStream("C:\\adb\\libwinpthread-1.dll", FileMode.CreateNew); for (int i = 0; i < libwinpthread1.Length; i++) { libwinpthread.WriteByte((byte)libwinpthread1.ReadByte()); } libwinpthread.Close(); } if (!File.Exists("C:\\adb\\source.properties")) { Stream source1 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Franco28Tool.Engine.Resources.adb.source.properties"); FileStream source = new FileStream("C:\\adb\\source.properties", FileMode.CreateNew); for (int i = 0; i < source1.Length; i++) { source.WriteByte((byte)source1.ReadByte()); } source.Close(); } } catch (Exception er) { Logs.DebugErrorLogs(er); Dialogs.ErrorDialog(@"FATAL ERROR EXTRACTING ADB-FASTBOOT:", "Error: " + er); } }
private void Firmwares_Load(object sender, EventArgs e) { oConfigMng.LoadConfig(); if (oConfigMng.Config.ToolTheme == "light") { materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; } if (oConfigMng.Config.ToolTheme == "dark") { materialSkinManager.Theme = MaterialSkinManager.Themes.DARK; } cAppend("FIRMWARE STARTING: Checking internet connection..."); if (InternetCheck.ConnectToInternet() == true) { cAppend("FIRMWARE STARTING: Checking internet connection... {OK}"); label2.Text = " Internet Connection: Online"; } else { cAppend("FIRMWARE STARTING: Checking internet connection... {ERROR}"); label2.Text = " Internet Connection: Offline"; } if (oConfigMng.Config.DeviceCodenmae == "") { cAppend("FIRMWARE STARTING: Please connect your device, so MotoTool can read firmwares!"); Dialogs.WarningDialog("Device Check", "Please connect your device, so MotoTool can read firmwares!"); return; } if (oConfigMng.Config.DeviceCodenmae == oConfigMng.Config.DeviceCodenmae) { LoadDeviceServer.CheckDevice(oConfigMng.Config.DeviceCodenmae + ".xml", oConfigMng.Config.DeviceCodenmae); string tr = "true"; cAppend("FIRMWARE STARTING: Checking server..."); if (LoadDeviceServer.fserverMaintenance == tr) { cAppend("FIRMWARE STARTING: Firmware server is on maintenance! Please this will be back soon..."); Dialogs.WarningDialog("Firmware server is on maintenance", "Please this will be back soon..."); return; } else { materialButtonFirmwareServer.Enabled = true; cAppend("FIRMWARE STARTING: Checking server... {OK}"); } } cAppend("FIRMWARE STARTING: Checking device info... "); if (oConfigMng.Config.DeviceCodenmae == "lima") { materialButtonRETAIL.Enabled = true; materialButtonRETAPAC.Enabled = true; materialButtonRETAR.Enabled = true; materialButtonRETIN.Enabled = true; materialButtonRETBR.Enabled = true; materialButtonRETCA.Enabled = true; materialButtonRETEU.Enabled = true; materialButtonRETLA.Enabled = true; materialButtonRETGB.Enabled = true; materialButtonRETCL.Enabled = true; materialButtonTEFBR.Enabled = true; materialButtonOPENCL.Enabled = true; materialButtonOPENMX.Enabled = true; materialButtonOPENLA.Enabled = true; materialButtonOPENPE.Enabled = true; materialButtonEEGB.Enabled = true; cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}"); } if (oConfigMng.Config.DeviceCodenmae == "sofiar") { materialButtonAMXLA.Enabled = true; materialButtonAMXCL.Enabled = true; materialButtonAMXCO.Enabled = true; materialButtonATTMX.Enabled = true; materialButtonOPENMX.Enabled = true; materialButtonRETLA.Enabled = true; materialButtonRETAR.Enabled = true; materialButtonRETEU.Enabled = true; cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}"); } if (oConfigMng.Config.DeviceCodenmae == "beckham") { materialButtonAMXBR.Enabled = true; materialButtonAMXLA.Enabled = true; materialButtonAMXM.Enabled = true; materialButtonAMZ.Enabled = true; materialButtonRETAIL.Enabled = true; materialButtonRETAPAC.Enabled = true; materialButtonRETAR.Enabled = true; materialButtonRETBR.Enabled = true; materialButtonRETCA.Enabled = true; materialButtonRETEU.Enabled = true; materialButtonRETUS.Enabled = true; materialButtonRETLA.Enabled = true; materialButtonTEFBR.Enabled = true; materialButtonTEFCL.Enabled = true; materialButtonTEFCO.Enabled = true; materialButtonTEFPE.Enabled = true; materialButtonATTMX.Enabled = true; materialButtonBWACA.Enabled = true; materialButtonDTEU.Enabled = true; materialButtonNIIPE.Enabled = true; materialButtonOPENCL.Enabled = true; materialButtonOPENMX.Enabled = true; materialButtonSprint.Enabled = true; materialButtonTIGCO.Enabled = true; materialButtonTIMBR.Enabled = true; materialButtonUSC.Enabled = true; cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}"); } if (oConfigMng.Config.DeviceCodenmae == "doha") { materialButtonAMXBR.Enabled = true; materialButtonAMXLA.Enabled = true; materialButtonAMXM.Enabled = true; materialButtonAMXCL.Enabled = true; materialButtonAMXPE.Enabled = true; materialButtonRETIN.Enabled = true; materialButtonRETRU.Enabled = true; materialButtonRETAIL.Enabled = true; materialButtonRETAPAC.Enabled = true; materialButtonRETAR.Enabled = true; materialButtonRETBR.Enabled = true; materialButtonRETEU.Enabled = true; materialButtonTEFMX.Enabled = true; materialButtonORAEU.Enabled = true; materialButtonPLUSPL.Enabled = true; materialButtonTIGCA.Enabled = true; materialButtonATTMX.Enabled = true; materialButtonOPENCL.Enabled = true; materialButtonOPENMX.Enabled = true; cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}"); } if (oConfigMng.Config.DeviceCodenmae == "evert" && oConfigMng.Config.DeviceCodenmae == "potter" && oConfigMng.Config.DeviceCodenmae == "lake") { materialButtonAMXBR.Enabled = true; materialButtonAMXLA.Enabled = true; materialButtonAMXM.Enabled = true; materialButtonAMXCL.Enabled = true; materialButtonAMXPE.Enabled = true; materialButtonAMXCO.Enabled = true; materialButtonTEFBR.Enabled = true; materialButtonTEFCO.Enabled = true; materialButtonTEFMX.Enabled = true; materialButtonTEFES.Enabled = true; if (oConfigMng.Config.DeviceCodenmae == "evert") { materialButtonRETUS.Enabled = true; materialButtonRETGB.Enabled = true; materialButtonRETIN.Enabled = true; materialButtonRETAIL.Enabled = true; materialButtonRETAPAC.Enabled = true; materialButtonRETAR.Enabled = true; materialButtonRETBR.Enabled = true; materialButtonRETEU.Enabled = true; materialButtonRETLA.Enabled = true; materialButtonRETLA1ST.Enabled = true; materialButtonWOMCL.Enabled = true; materialButtonTIMBR.Enabled = true; materialButtonTIGCO.Enabled = true; materialButtonENTCL.Enabled = true; cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}"); } if (oConfigMng.Config.DeviceCodenmae == "potter") { materialButtonRETUS.Enabled = true; materialButtonRETGB.Enabled = true; materialButtonRETIN.Enabled = true; materialButtonRETAIL.Enabled = true; materialButtonRETAPAC.Enabled = true; materialButtonRETAR.Enabled = true; materialButtonRETBR.Enabled = true; materialButtonRETEU.Enabled = true; materialButtonRETLA.Enabled = true; materialButtonRETLA1ST.Enabled = true; materialButtonRETMX.Enabled = true; materialButtonTIMBR.Enabled = true; materialButtonTIGCO.Enabled = true; cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}"); } if (oConfigMng.Config.DeviceCodenmae == "lake") { materialButtonRETGB.Enabled = true; materialButtonRETAIL.Enabled = true; materialButtonRETAPAC.Enabled = true; materialButtonRETAR.Enabled = true; materialButtonRETBR.Enabled = true; materialButtonRETEU.Enabled = true; materialButtonRETLA.Enabled = true; materialButtonRETRU.Enabled = true; materialButtonTEFBR.Enabled = true; materialButtonTEFCO.Enabled = true; materialButtonTEFMX.Enabled = true; materialButtonEEGB.Enabled = true; materialButtonORAEU.Enabled = true; materialButtonTMO.Enabled = true; materialButtonENTCL.Enabled = true; materialButtonTIMBR.Enabled = true; materialButtonWOMCL.Enabled = true; materialButtonTIGCO.Enabled = true; cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}"); } } if (oConfigMng.Config.DeviceCodenmae == "river") { materialButtonAMXBR.Enabled = true; materialButtonAMZ.Enabled = true; materialButtonRETGB.Enabled = true; materialButtonRETAIL.Enabled = true; materialButtonRETAPAC.Enabled = true; materialButtonRETAR.Enabled = true; materialButtonRETBR.Enabled = true; materialButtonRETEU.Enabled = true; materialButtonRETLA.Enabled = true; materialButtonRETRU.Enabled = true; materialButtonRETUS.Enabled = true; materialButtonRETIN.Enabled = true; materialButtonTEFBR.Enabled = true; materialButtonTEFCO.Enabled = true; materialButtonTEFPE.Enabled = true; materialButtonOPENCL.Enabled = true; materialButtonOPENMX.Enabled = true; materialButtonTIMBR.Enabled = true; materialButtonNIIPE.Enabled = true; materialButtonTIGCO.Enabled = true; cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}"); } if (oConfigMng.Config.DeviceCodenmae == "sanders") { materialButtonAMXBR.Enabled = true; materialButtonRETGB.Enabled = true; materialButtonRETAIL.Enabled = true; materialButtonRETAPAC.Enabled = true; materialButtonRETAR.Enabled = true; materialButtonRETBR.Enabled = true; materialButtonRETLA.Enabled = true; materialButtonRETRU.Enabled = true; materialButtonRETUS.Enabled = true; materialButtonRETIN.Enabled = true; materialButtonTEFBR.Enabled = true; materialButtonOPENMX.Enabled = true; materialButtonTIMBR.Enabled = true; cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}"); } }
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); } }