using System; using System.Collections.Generic; using MPF.Core.Converters; using MPF.Core.Data; using SabreTools.RedumpLib.Data; namespace MPF.Core.Utilities { public static class EnumExtensions { /// /// Determine if a system is okay if it's not detected by Windows /// /// RedumpSystem value to check /// True if Windows show see a disc when dumping, false otherwise public static bool DetectedByWindows(this RedumpSystem? system) { switch (system) { case RedumpSystem.AmericanLaserGames3DO: case RedumpSystem.AppleMacintosh: case RedumpSystem.Atari3DO: case RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem: case RedumpSystem.NewJatreCDi: case RedumpSystem.NintendoGameCube: case RedumpSystem.NintendoWii: case RedumpSystem.NintendoWiiU: case RedumpSystem.PhilipsCDi: case RedumpSystem.PhilipsCDiDigitalVideo: case RedumpSystem.Panasonic3DOInteractiveMultiplayer: case RedumpSystem.PanasonicM2: case RedumpSystem.PioneerLaserActive: case RedumpSystem.SuperAudioCD: return false; default: return true; } } /// /// 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 has reversed ringcodes /// /// RedumpSystem value to check /// True if the system has reversed ringcodes, false otherwise public static bool HasReversedRingcodes(this RedumpSystem? system) { switch (system) { case RedumpSystem.SonyPlayStation2: case RedumpSystem.SonyPlayStation3: case RedumpSystem.SonyPlayStation4: //case RedumpSystem.SonyPlayStation5: case RedumpSystem.SonyPlayStationPortable: return true; default: return false; } } /// /// Determine if a system is considered audio-only /// /// RedumpSystem value to check /// True if the system is audio-only, false otherwise /// /// Philips CD-i should NOT be in this list. It's being included until there's a /// reasonable distinction between CD-i and CD-i ready on the database side. /// public static bool IsAudio(this RedumpSystem? system) { switch (system) { case RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem: case RedumpSystem.AudioCD: case RedumpSystem.DVDAudio: case RedumpSystem.HasbroiONEducationalGamingSystem: case RedumpSystem.HasbroVideoNow: case RedumpSystem.HasbroVideoNowColor: case RedumpSystem.HasbroVideoNowJr: case RedumpSystem.HasbroVideoNowXP: case RedumpSystem.PhilipsCDi: case RedumpSystem.PlayStationGameSharkUpdates: case RedumpSystem.SuperAudioCD: return true; default: return false; } } /// /// Determine if a system is considered XGD /// /// RedumpSystem value to check /// True if the system is XGD, false otherwise public static bool IsXGD(this RedumpSystem? system) { switch (system) { case RedumpSystem.MicrosoftXbox: case RedumpSystem.MicrosoftXbox360: case RedumpSystem.MicrosoftXboxOne: case RedumpSystem.MicrosoftXboxSeriesXS: return true; default: return false; } } /// /// List all programs with their short usable names /// public static List ListPrograms() { var programs = new List(); foreach (var val in Enum.GetValues(typeof(InternalProgram))) { if (((InternalProgram)val) == InternalProgram.NONE) continue; programs.Add($"{((InternalProgram?)val).LongName()}"); } return programs; } } }