private void MaterialButtonClose_Click(object sender, EventArgs e) { if (oConfigMng.Config.Autosavelogs == "true") { cAppend("EXIT: Saving Firmware logs..."); try { string filePath = @"C:\adb\.settings\Logs\FirmwareLogs.txt"; cAppend("EXIT: Saving Firmware logs... {OK}"); console.SaveFile(filePath, RichTextBoxStreamType.PlainText); } catch (Exception ex) { Logs.DebugErrorLogs(ex); cAppend("EXIT: Saving Firmware logs... {ERROR}"); Dialogs.ErrorDialog("An error has occured while attempting to save the output...", ex.ToString()); } } var download = new DownloadUI(); if (download.webClient != null) { download.webClient.CancelAsync(); download.Dispose(); this.Dispose(); } else { download.Dispose(); this.Dispose(); } }
public void downloadcall(string xmlname, string xmlpath) { var call = new DownloadUI(); DownloadsMng.TOOLDOWNLOAD(oConfigMng.Config.DeviceCodenmae, xmlname, xmlpath); oConfigMng.Config.DownloadFileSizeTWRPPermanent = DownloadsMng.filename; oConfigMng.SaveConfig(); openChildForm2(call); }
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); } }