diff --git a/MPF.Library/DiscImageCreator/Parameters.cs b/MPF.Library/DiscImageCreator/Parameters.cs index 2ea20405..0e7c818b 100644 --- a/MPF.Library/DiscImageCreator/Parameters.cs +++ b/MPF.Library/DiscImageCreator/Parameters.cs @@ -1687,12 +1687,6 @@ namespace MPF.DiscImageCreator /// public override bool CheckAllOutputFilesExist(string basePath, KnownSystem? system, MediaType? type, IProgress progress = null) { - // Some disc types are audio-only - bool audioOnly = (system == KnownSystem.AtariJaguarCD) - || (system == KnownSystem.AudioCD) - || (system == KnownSystem.DVDAudio) - || (system == KnownSystem.SuperAudioCD); - /* If there are no external programs, such as error checking, etc., DIC outputs a slightly different set of files. This reduced set needs to be documented in @@ -1750,7 +1744,7 @@ namespace MPF.DiscImageCreator missingFiles += $";{basePath}_volDesc.txt"; // Audio-only discs don't output these files - if (!audioOnly) + if (!system.IsAudio()) { if (!File.Exists($"{basePath}.img_EdcEcc.txt") && !File.Exists($"{basePath}.img_EccEdc.txt")) missingFiles += $";{basePath}.img_EdcEcc.txt"; @@ -1856,12 +1850,6 @@ namespace MPF.DiscImageCreator { string outputDirectory = Path.GetDirectoryName(basePath); - // Some disc types are audio-only - bool audioOnly = (system == KnownSystem.AtariJaguarCD) - || (system == KnownSystem.AudioCD) - || (system == KnownSystem.DVDAudio) - || (system == KnownSystem.SuperAudioCD); - // Fill in the hash data info.TracksAndWriteOffsets.ClrMameProData = GetDatfile(basePath + ".dat"); @@ -1873,7 +1861,7 @@ namespace MPF.DiscImageCreator info.Extras.PVD = GetPVD(basePath + "_mainInfo.txt") ?? "Disc has no PVD"; ; // Audio-only discs will fail if there are any C2 errors, so they would never get here - if (audioOnly) + if (system.IsAudio()) { info.CommonDiscInfo.ErrorsCount = "0"; } diff --git a/MPF.Library/Utilities/Extensions.cs b/MPF.Library/Utilities/Extensions.cs index 710e0953..9a53317f 100644 --- a/MPF.Library/Utilities/Extensions.cs +++ b/MPF.Library/Utilities/Extensions.cs @@ -4,23 +4,11 @@ namespace MPF.Utilities { public static class Extensions { - public static bool DoesSupportDriveSpeed(this MediaType? type) - { - switch (type) - { - case MediaType.CDROM: - case MediaType.DVD: - case MediaType.GDROM: - case MediaType.HDDVD: - case MediaType.BluRay: - case MediaType.NintendoGameCubeGameDisc: - case MediaType.NintendoWiiOpticalDisc: - return true; - default: - return false; - } - } - + /// + /// Determine the category based on the system + /// + /// KnownSystem value to check + /// KnownSystemCategory related to the system public static KnownSystemCategory Category(this KnownSystem? system) { if (system < KnownSystem.MarkerDiscBasedConsoleEnd) @@ -39,6 +27,52 @@ namespace MPF.Utilities return KnownSystemCategory.Custom; } + /// + /// Determine if the media supports drive speeds + /// + /// MediaType value to check + /// True if the media has variable dumping speeds, false otherwise + public static bool DoesSupportDriveSpeed(this MediaType? type) + { + switch (type) + { + case MediaType.CDROM: + case MediaType.DVD: + case MediaType.GDROM: + case MediaType.HDDVD: + case MediaType.BluRay: + case MediaType.NintendoGameCubeGameDisc: + case MediaType.NintendoWiiOpticalDisc: + return true; + default: + return false; + } + } + + /// + /// Determine if a system is considered audio-only + /// + /// KnownSystem value to check + /// True if the system is audio-only, false otherwise + public static bool IsAudio(this KnownSystem? system) + { + switch (system) + { + case KnownSystem.AtariJaguarCD: + case KnownSystem.AudioCD: + case KnownSystem.DVDAudio: + case KnownSystem.SuperAudioCD: + return true; + default: + return false; + } + } + + /// + /// Determine if a system is a marker value + /// + /// KnownSystem value to check + /// True if the system is a marker value, false otherwise public static bool IsMarker(this KnownSystem? system) { switch (system)