mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Quality of life fixes (#836)
* Account for N-type discs in Redumper processor * MediaType prefix * Delete after zipping, ask before closing during dump * Proper closing function * proper using * nullable object * YesNoCancel isn't a thing for CustomMessageBox * Ctrl-Z
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -74,6 +74,20 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the status of the check dump menu item
|
||||
/// </summary>
|
||||
public bool AskBeforeQuit
|
||||
{
|
||||
get => _askBeforeQuit;
|
||||
set
|
||||
{
|
||||
_askBeforeQuit = value;
|
||||
TriggerPropertyChanged(nameof(AskBeforeQuit));
|
||||
}
|
||||
}
|
||||
private bool _askBeforeQuit;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the status of the check dump menu item
|
||||
/// </summary>
|
||||
@@ -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
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ask to confirm quitting, when an operation is running
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build a dummy SubmissionInfo and display it for testing
|
||||
/// </summary>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user