public static void CanCallCancelDownloadCheck() { var selectedDrive = new USBHelper.Drive { Path = "TestValue866096061", Name = "TestValue539938438" }; var result = SanityCheckHelper.CancelDownloadCheck(selectedDrive); Assert.Fail("Create or modify test"); }
public static async Task <bool> Download(string installMode, ObservableCollection <SModel.Ivsu> ivsuList, SModel.SRegion selectedRegion, string selectedRelease, string selectedMapVersion, string driveLetter, USBHelper.Drive selectedDrive) { if (await SetIvsuList(installMode, ivsuList, selectedRegion, selectedRelease, selectedMapVersion, driveLetter) == false) { await Application.Current.Dispatcher.BeginInvoke(() => UIHelper.ShowErrorDialog(LM.GetValue("MessageBox.NoPackagesSelected"))); return(false); } bool canceldownload = false; //Install Mode is reformat or downgrade My20 warning if ((installMode == "reformat" || installMode == "downgrade") && !AppMan.App.DownloadOnly && AppMan.App.Settings.My20v2 == null) { if (await Application.Current.Dispatcher.Invoke(() => UIHelper.ShowDialog(string.Format(LM.GetValue("MessageBox.My20Check")), LM.GetValue("String.Warning") + "!", LM.GetValue("String.No"), LM.GetValue("String.Yes"), null, ContentDialogButton.None, Brushes.DarkRed)) == ContentDialogResult.Primary) { await USBHelper.LogPrepareUSBAction(selectedDrive, driveLetter, "logutilitymy20"); return(true); } } //Warn is users region is different to new selection if (selectedRegion.Code != AppMan.App.Settings.CurrentRegion) { if (await Application.Current.Dispatcher.Invoke(() => UIHelper.ShowWarningDialog(string.Format(LM.GetValue("MessageBox.CancelRegionMismatch")), LM.GetValue("String.Warning") + "!", LM.GetValue("String.No"), LM.GetValue("String.Yes"))) != ContentDialogResult.Primary) { canceldownload = true; } } //Cancel no apps package selected if (!AppMan.App.AppsSelected && (installMode == "reformat" || installMode == "downgrade")) { await Application.Current.Dispatcher.BeginInvoke(() => UIHelper.ShowErrorDialog(LM.GetValue("MessageBox.CancelNoApps"))); canceldownload = true; } if (!canceldownload && (AppMan.App.DownloadOnly || !await SanityCheckHelper.CancelDownloadCheck(selectedDrive))) { if (AppMan.App.DownloadOnly) { AppMan.Logger.Info($"Starting download only of ({selectedRelease} - {selectedRegion?.Code} - {selectedMapVersion})"); } else { AppMan.App.DriveNumber = selectedDrive.Path.Replace("Win32_DiskDrive.DeviceID=\"\\\\\\\\.\\\\PHYSICALDRIVE", "").Replace("\"", ""); AppMan.App.DriveLetter = driveLetter; AppMan.Logger.Info($"Starting process ({selectedRelease} - {selectedRegion?.Code} - {selectedMapVersion})"); } AppMan.App.IsDownloading = true; AppMan.App.FireDownloadsTabEvent(); return(true); } return(false); }