From 63e6ce121a41d12c3cfecdacfb2acc539728134c Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 28 May 2024 00:19:34 -0400 Subject: [PATCH] Move GetSupportStatus to DumpEnvironment --- CHANGELIST.md | 1 + MPF.Core/Utilities/Tools.cs | 39 ------------------------------ MPF.Frontend/DumpEnvironment.cs | 42 ++++++++++++++++++++++++++++++--- 3 files changed, 40 insertions(+), 42 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index d5cee8de..31b2bd7b 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -120,6 +120,7 @@ - Move LogLevel enum to Frontend - Create ProcessingTool and move some methods - Remove unused byte array helper methods +- Move GetSupportStatus to DumpEnvironment ### 3.1.9a (2024-05-21) diff --git a/MPF.Core/Utilities/Tools.cs b/MPF.Core/Utilities/Tools.cs index 09861848..124c8ff2 100644 --- a/MPF.Core/Utilities/Tools.cs +++ b/MPF.Core/Utilities/Tools.cs @@ -44,45 +44,6 @@ namespace MPF.Core.Utilities #region Support - /// - /// Verify that, given a system and a media type, they are correct - /// - public static ResultEventArgs GetSupportStatus(RedumpSystem? system, MediaType? type) - { - // No system chosen, update status - if (system == null) - return ResultEventArgs.Failure("Please select a valid system"); - - // If we're on an unsupported type, update the status accordingly - return type switch - { - // Fully supported types - MediaType.BluRay - or MediaType.CDROM - or MediaType.DVD - or MediaType.FloppyDisk - or MediaType.HardDisk - or MediaType.CompactFlash - or MediaType.SDCard - or MediaType.FlashDrive - or MediaType.HDDVD => ResultEventArgs.Success($"{type.LongName()} ready to dump"), - - // Partially supported types - MediaType.GDROM - or MediaType.NintendoGameCubeGameDisc - or MediaType.NintendoWiiOpticalDisc => ResultEventArgs.Success($"{type.LongName()} partially supported for dumping"), - - // Special case for other supported tools - MediaType.UMD => ResultEventArgs.Failure($"{type.LongName()} supported for submission info parsing"), - - // Specifically unknown type - MediaType.NONE => ResultEventArgs.Failure($"Please select a valid media type"), - - // Undumpable but recognized types - _ => ResultEventArgs.Failure($"{type.LongName()} media are not supported for dumping"), - }; - } - /// /// Returns false if a given InternalProgram does not support a given MediaType /// diff --git a/MPF.Frontend/DumpEnvironment.cs b/MPF.Frontend/DumpEnvironment.cs index cfd2b448..a827f6bd 100644 --- a/MPF.Frontend/DumpEnvironment.cs +++ b/MPF.Frontend/DumpEnvironment.cs @@ -294,8 +294,44 @@ namespace MPF.Frontend return _executionContext.GetMediaType(); } - /// - public ResultEventArgs GetSupportStatus() => Tools.GetSupportStatus(_system, _type); + /// + /// Verify that, given a system and a media type, they are correct + /// + public ResultEventArgs GetSupportStatus() + { + // No system chosen, update status + if (_system == null) + return ResultEventArgs.Failure("Please select a valid system"); + + // If we're on an unsupported type, update the status accordingly + return _type switch + { + // Fully supported types + MediaType.BluRay + or MediaType.CDROM + or MediaType.DVD + or MediaType.FloppyDisk + or MediaType.HardDisk + or MediaType.CompactFlash + or MediaType.SDCard + or MediaType.FlashDrive + or MediaType.HDDVD => ResultEventArgs.Success($"{_type.LongName()} ready to dump"), + + // Partially supported types + MediaType.GDROM + or MediaType.NintendoGameCubeGameDisc + or MediaType.NintendoWiiOpticalDisc => ResultEventArgs.Success($"{_type.LongName()} partially supported for dumping"), + + // Special case for other supported tools + MediaType.UMD => ResultEventArgs.Failure($"{_type.LongName()} supported for submission info parsing"), + + // Specifically unknown type + MediaType.NONE => ResultEventArgs.Failure($"Please select a valid media type"), + + // Undumpable but recognized types + _ => ResultEventArgs.Failure($"{_type.LongName()} media are not supported for dumping"), + }; + } /// public bool IsDumpingCommand() @@ -554,7 +590,7 @@ namespace MPF.Frontend return ResultEventArgs.Failure("Error! Cannot dump same drive that executable resides on!"); // Validate that the current configuration is supported - return Tools.GetSupportStatus(_system, _type); + return GetSupportStatus(); } #endregion