From ae326c1d2f9e973db7416ec01c65a7a48bbb2815 Mon Sep 17 00:00:00 2001
From: Deterous <138427222+Deterous@users.noreply.github.com>
Date: Fri, 13 Oct 2023 08:46:44 +1300
Subject: [PATCH] Disable dumping button when Redumper selected with
unsupported media type (#576)
* Disable dumping button when HDDVD + Redumper selected
* Exclude Bluray+Redumper as well
* Move program-supports-mediatype logic to helper function
* Fix for net48
* Fix for net48
* Undo fixes for net48
---
MPF.Core/UI/ViewModels/MainViewModel.cs | 32 ++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/MPF.Core/UI/ViewModels/MainViewModel.cs b/MPF.Core/UI/ViewModels/MainViewModel.cs
index 9f919008..75e54daa 100644
--- a/MPF.Core/UI/ViewModels/MainViewModel.cs
+++ b/MPF.Core/UI/ViewModels/MainViewModel.cs
@@ -1583,6 +1583,35 @@ namespace MPF.Core.UI.ViewModels
this.DriveSpeed = speed;
}
+ ///
+ /// Returns False if a given InternalProgram does not support a given MediaType
+ ///
+ public bool ProgramSupportsMedia(InternalProgram program, MediaType? media)
+ {
+ switch (program)
+ {
+ case InternalProgram.Redumper:
+ switch (media)
+ {
+ case MediaType.HDDVD:
+ return false;
+ case MediaType.BluRay:
+ return false;
+ default:
+ return true;
+ }
+ case InternalProgram.Aaru:
+ case InternalProgram.DiscImageCreator:
+ switch (media)
+ {
+ default:
+ return true;
+ }
+ default:
+ return true;
+ }
+ }
+
///
/// Determine if the dumping button should be enabled
///
@@ -1591,7 +1620,8 @@ namespace MPF.Core.UI.ViewModels
return Drives != null
&& Drives.Count > 0
&& this.CurrentSystem != null
- && this.CurrentMediaType != null;
+ && this.CurrentMediaType != null
+ && ProgramSupportsMedia(this.CurrentProgram, this.CurrentMediaType);
}
///