diff --git a/MPF.ExecutionContexts.Test/RedumperTests.cs b/MPF.ExecutionContexts.Test/RedumperTests.cs index d70fa318..41e851ea 100644 --- a/MPF.ExecutionContexts.Test/RedumperTests.cs +++ b/MPF.ExecutionContexts.Test/RedumperTests.cs @@ -70,7 +70,7 @@ namespace MPF.ExecutionContexts.Test [Theory] [InlineData("disc -h --version --verbose --auto-eject --drive=dr --speed=0 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs --disable-cdtext")] [InlineData("disc --help --version --verbose --auto-eject --drive=dr --speed=0 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs --disable-cdtext")] - public void CDTest(string parameters) + public void DiscTest(string parameters) { string? expected = "disc --help --version --verbose --auto-eject --drive=dr --speed=0 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs --disable-cdtext"; var context = new ExecutionContext(parameters); diff --git a/MPF.Frontend/ViewModels/MainViewModel.cs b/MPF.Frontend/ViewModels/MainViewModel.cs index 2b5eb3d9..0d766991 100644 --- a/MPF.Frontend/ViewModels/MainViewModel.cs +++ b/MPF.Frontend/ViewModels/MainViewModel.cs @@ -74,6 +74,20 @@ namespace MPF.Frontend.ViewModels #region Properties + /// + /// Indicates the status of the check dump menu item + /// + public bool AskBeforeQuit + { + get => _askBeforeQuit; + set + { + _askBeforeQuit = value; + TriggerPropertyChanged(nameof(AskBeforeQuit)); + } + } + private bool _askBeforeQuit; + /// /// Indicates the status of the check dump menu item /// @@ -554,6 +568,7 @@ namespace MPF.Frontend.ViewModels _status = string.Empty; _systems = []; + AskBeforeQuit = false; OptionsMenuItemEnabled = true; CheckDumpMenuItemEnabled = true; CreateIRDMenuItemEnabled = true; @@ -2146,6 +2161,9 @@ namespace MPF.Frontend.ViewModels /// public async void StartDumping() { + // Ask user to confirm before exiting application during a dump + AskBeforeQuit = true; + // One last check to determine environment, just in case _environment = DetermineEnvironment(); @@ -2155,17 +2173,16 @@ namespace MPF.Frontend.ViewModels // If still in custom parameter mode, check that users meant to continue or not if (ParametersCheckBoxEnabled == false && _displayUserMessage != null) { - bool? result = _displayUserMessage("Custom Changes", "It looks like you have custom parameters that have not been saved. Would you like to apply those changes before starting to dump?", 3, true); + bool? result = _displayUserMessage("Custom Changes", "It looks like you have custom parameters that have not been saved. Would you like to dump with these custom parameters?", 2, true); if (result == true) { ParametersCheckBoxEnabled = true; ProcessCustomParameters(); } - else if (result == null) + else { return; } - // If false, then we continue with the current known environment } try @@ -2227,6 +2244,9 @@ namespace MPF.Frontend.ViewModels } finally { + // Reallow quick exiting + AskBeforeQuit = false; + // Reset all UI elements EnableAllUIElements(); } diff --git a/MPF.Processors/Redumper.cs b/MPF.Processors/Redumper.cs index c1cfd127..545a7268 100644 --- a/MPF.Processors/Redumper.cs +++ b/MPF.Processors/Redumper.cs @@ -91,6 +91,9 @@ namespace MPF.Processors case MediaType.DVD: case MediaType.HDDVD: case MediaType.BluRay: + case MediaType.NintendoGameCubeGameDisc: + case MediaType.NintendoWiiOpticalDisc: + case MediaType.NintendoWiiUOpticalDisc: info.Extras!.PVD = GetPVD($"{basePath}.log") ?? "Disc has no PVD"; info.TracksAndWriteOffsets!.ClrMameProData = GetDatfile($"{basePath}.log"); @@ -116,7 +119,7 @@ namespace MPF.Processors info.CommonDiscInfo!.ErrorsCount = (scsiErrors == -1 ? "Error retrieving error count" : scsiErrors.ToString());; // Bluray-specific options - if (Type == MediaType.BluRay) + if (Type == MediaType.BluRay || Type == MediaType.NintendoWiiUOpticalDisc) { int trimLength = -1; switch (System) diff --git a/MPF.UI/Windows/MainWindow.xaml.cs b/MPF.UI/Windows/MainWindow.xaml.cs index 59872f76..c7c57339 100644 --- a/MPF.UI/Windows/MainWindow.xaml.cs +++ b/MPF.UI/Windows/MainWindow.xaml.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.IO; #if NET40 using System.Threading.Tasks; @@ -74,6 +75,7 @@ namespace MPF.UI.Windows { #if NET40_OR_GREATER || NETCOREAPP InitializeComponent(); + this.Closing += MainWindowClosing; #endif #if NET452_OR_GREATER || NETCOREAPP @@ -210,6 +212,19 @@ namespace MPF.UI.Windows CustomMessageBox.Show(this, message, "Version Update Check", MessageBoxButton.OK, different ? MessageBoxImage.Exclamation : MessageBoxImage.Information); } + /// + /// Ask to confirm quitting, when an operation is running + /// + public void MainWindowClosing(object? sender, CancelEventArgs e) + { + if (MainViewModel.AskBeforeQuit) + { + MessageBoxResult result = CustomMessageBox.Show(this, "A dump is still being processed, are you sure you want to quit?", "Quit", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); + if (result == MessageBoxResult.No) + e.Cancel = true; + } + } + /// /// Build a dummy SubmissionInfo and display it for testing /// diff --git a/MPF.UI/Windows/WindowBase.cs b/MPF.UI/Windows/WindowBase.cs index 404d8236..229672e5 100644 --- a/MPF.UI/Windows/WindowBase.cs +++ b/MPF.UI/Windows/WindowBase.cs @@ -56,7 +56,6 @@ namespace MPF.UI.Windows { 1 => MessageBoxButton.OK, 2 => MessageBoxButton.YesNo, - 3 => MessageBoxButton.YesNoCancel, // This should not happen, but default to "OK" _ => MessageBoxButton.OK,