diff --git a/MPF.Check/Program.cs b/MPF.Check/Program.cs index 5839ccfc..a8f20ae8 100644 --- a/MPF.Check/Program.cs +++ b/MPF.Check/Program.cs @@ -2,8 +2,8 @@ using System.IO; using BurnOutSharp; using MPF.Data; +using MPF.Redump; using MPF.Utilities; -using MPF.Web; namespace MPF.Check { diff --git a/MPF.Library/Aaru/Parameters.cs b/MPF.Library/Aaru/Parameters.cs index d30ad6ea..3f3dc5bb 100644 --- a/MPF.Library/Aaru/Parameters.cs +++ b/MPF.Library/Aaru/Parameters.cs @@ -10,7 +10,6 @@ using System.Xml.Serialization; using MPF.CueSheets; using MPF.Data; using MPF.Utilities; -using MPF.Web; using Schemas; namespace MPF.Aaru @@ -1617,7 +1616,7 @@ namespace MPF.Aaru break; case KnownSystem.KonamiPython2: - if (GetPlayStationExecutableInfo(drive?.Letter, out string pythonTwoSerial, out Region? pythonTwoRegion, out string pythonTwoDate)) + if (GetPlayStationExecutableInfo(drive?.Letter, out string pythonTwoSerial, out RedumpRegion? pythonTwoRegion, out string pythonTwoDate)) { info.CommonDiscInfo.Comments += $"Internal Disc Serial: {pythonTwoSerial}\n"; info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? pythonTwoRegion; @@ -1637,7 +1636,7 @@ namespace MPF.Aaru info.Extras.SecuritySectorRanges = ss ?? ""; } - if (GetXboxDMIInfo(sidecar, out string serial, out string version, out Region? region)) + if (GetXboxDMIInfo(sidecar, out string serial, out string version, out RedumpRegion? region)) { info.CommonDiscInfo.Serial = serial ?? ""; info.VersionAndEditions.Version = version ?? ""; @@ -1656,7 +1655,7 @@ namespace MPF.Aaru info.Extras.SecuritySectorRanges = ss360 ?? ""; } - if (GetXbox360DMIInfo(sidecar, out string serial360, out string version360, out Region? region360)) + if (GetXbox360DMIInfo(sidecar, out string serial360, out string version360, out RedumpRegion? region360)) { info.CommonDiscInfo.Serial = serial360 ?? ""; info.VersionAndEditions.Version = version360 ?? ""; @@ -1665,7 +1664,7 @@ namespace MPF.Aaru break; case KnownSystem.SonyPlayStation: - if (GetPlayStationExecutableInfo(drive?.Letter, out string playstationSerial, out Region? playstationRegion, out string playstationDate)) + if (GetPlayStationExecutableInfo(drive?.Letter, out string playstationSerial, out RedumpRegion? playstationRegion, out string playstationDate)) { info.CommonDiscInfo.Comments += $"Internal Disc Serial: {playstationSerial}\n"; info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? playstationRegion; @@ -1676,7 +1675,7 @@ namespace MPF.Aaru break; case KnownSystem.SonyPlayStation2: - if (GetPlayStationExecutableInfo(drive?.Letter, out string playstationTwoSerial, out Region? playstationTwoRegion, out string playstationTwoDate)) + if (GetPlayStationExecutableInfo(drive?.Letter, out string playstationTwoSerial, out RedumpRegion? playstationTwoRegion, out string playstationTwoDate)) { info.CommonDiscInfo.Comments += $"Internal Disc Serial: {playstationTwoSerial}\n"; info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? playstationTwoRegion; @@ -2981,9 +2980,9 @@ namespace MPF.Aaru /// /// CICM Sidecar data generated by Aaru /// True on successful extraction of info, false otherwise - private static bool GetXboxDMIInfo(CICMMetadataType cicmSidecar, out string serial, out string version, out Region? region) + private static bool GetXboxDMIInfo(CICMMetadataType cicmSidecar, out string serial, out string version, out RedumpRegion? region) { - serial = null; version = null; region = Region.World; + serial = null; version = null; region = RedumpRegion.World; // If the object is null, we can't get information from it if (cicmSidecar == null) @@ -3029,9 +3028,9 @@ namespace MPF.Aaru /// /// CICM Sidecar data generated by Aaru /// True on successful extraction of info, false otherwise - private static bool GetXbox360DMIInfo(CICMMetadataType cicmSidecar, out string serial, out string version, out Region? region) + private static bool GetXbox360DMIInfo(CICMMetadataType cicmSidecar, out string serial, out string version, out RedumpRegion? region) { - serial = null; version = null; region = Region.World; + serial = null; version = null; region = RedumpRegion.World; // If the object is null, we can't get information from it if (cicmSidecar == null) diff --git a/MPF.Library/CleanRIp/Parameters.cs b/MPF.Library/CleanRIp/Parameters.cs index dfa92c59..a9b6c02b 100644 --- a/MPF.Library/CleanRIp/Parameters.cs +++ b/MPF.Library/CleanRIp/Parameters.cs @@ -3,7 +3,6 @@ using System.IO; using System.Text.RegularExpressions; using MPF.Data; using MPF.Utilities; -using MPF.Web; namespace MPF.CleanRip { @@ -179,7 +178,7 @@ namespace MPF.CleanRip if (File.Exists(basePath + ".bca")) info.Extras.BCA = GetBCA(basePath + ".bca"); - if (GetGameCubeWiiInformation(basePath + "-dumpinfo.txt", out Region? gcRegion, out string gcVersion)) + if (GetGameCubeWiiInformation(basePath + "-dumpinfo.txt", out RedumpRegion? gcRegion, out string gcVersion)) { info.CommonDiscInfo.Region = gcRegion ?? info.CommonDiscInfo.Region; info.VersionAndEditions.Version = gcVersion ?? info.VersionAndEditions.Version; @@ -275,7 +274,7 @@ namespace MPF.CleanRip /// Output region, if possible /// Output internal version of the game /// - private static bool GetGameCubeWiiInformation(string dumpinfo, out Region? region, out string version) + private static bool GetGameCubeWiiInformation(string dumpinfo, out RedumpRegion? region, out string version) { region = null; version = null; @@ -310,49 +309,49 @@ namespace MPF.CleanRip switch (serial[3]) { case 'A': - region = Region.World; + region = RedumpRegion.World; break; case 'D': - region = Region.Germany; + region = RedumpRegion.Germany; break; case 'E': - region = Region.USA; + region = RedumpRegion.USA; break; case 'F': - region = Region.France; + region = RedumpRegion.France; break; case 'I': - region = Region.Italy; + region = RedumpRegion.Italy; break; case 'J': - region = Region.Japan; + region = RedumpRegion.Japan; break; case 'K': - region = Region.Korea; + region = RedumpRegion.Korea; break; case 'L': - region = Region.Europe; // Japanese import to Europe + region = RedumpRegion.Europe; // Japanese import to Europe break; case 'M': - region = Region.Europe; // American import to Europe + region = RedumpRegion.Europe; // American import to Europe break; case 'N': - region = Region.USA; // Japanese import to USA + region = RedumpRegion.USA; // Japanese import to USA break; case 'P': - region = Region.Europe; + region = RedumpRegion.Europe; break; case 'R': - region = Region.Russia; + region = RedumpRegion.Russia; break; case 'S': - region = Region.Spain; + region = RedumpRegion.Spain; break; case 'Q': - region = Region.Korea; // Korea with Japanese language + region = RedumpRegion.Korea; // Korea with Japanese language break; case 'T': - region = Region.Korea; // Korea with English language + region = RedumpRegion.Korea; // Korea with English language break; case 'X': region = null; // Not a real region code diff --git a/MPF.Library/DD/Parameters.cs b/MPF.Library/DD/Parameters.cs index d85ed201..826c880c 100644 --- a/MPF.Library/DD/Parameters.cs +++ b/MPF.Library/DD/Parameters.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Text.RegularExpressions; using MPF.Data; using MPF.Utilities; -using MPF.Web; namespace MPF.DD { @@ -421,7 +420,7 @@ namespace MPF.DD switch (this.System) { case KnownSystem.KonamiPython2: - if (GetPlayStationExecutableInfo(drive?.Letter, out string pythonTwoSerial, out Region? pythonTwoRegion, out string pythonTwoDate)) + if (GetPlayStationExecutableInfo(drive?.Letter, out string pythonTwoSerial, out RedumpRegion? pythonTwoRegion, out string pythonTwoDate)) { info.CommonDiscInfo.Comments += $"Internal Disc Serial: {pythonTwoSerial}\n"; info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? pythonTwoRegion; @@ -432,7 +431,7 @@ namespace MPF.DD break; case KnownSystem.SonyPlayStation: - if (GetPlayStationExecutableInfo(drive?.Letter, out string playstationSerial, out Region? playstationRegion, out string playstationDate)) + if (GetPlayStationExecutableInfo(drive?.Letter, out string playstationSerial, out RedumpRegion? playstationRegion, out string playstationDate)) { info.CommonDiscInfo.Comments += $"Internal Disc Serial: {playstationSerial}\n"; info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? playstationRegion; @@ -443,7 +442,7 @@ namespace MPF.DD break; case KnownSystem.SonyPlayStation2: - if (GetPlayStationExecutableInfo(drive?.Letter, out string playstationTwoSerial, out Region? playstationTwoRegion, out string playstationTwoDate)) + if (GetPlayStationExecutableInfo(drive?.Letter, out string playstationTwoSerial, out RedumpRegion? playstationTwoRegion, out string playstationTwoDate)) { info.CommonDiscInfo.Comments += $"Internal Disc Serial: {playstationTwoSerial}\n"; info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? playstationTwoRegion; diff --git a/MPF.Library/Data/BaseParameters.cs b/MPF.Library/Data/BaseParameters.cs index f02318bc..09a429b5 100644 --- a/MPF.Library/Data/BaseParameters.cs +++ b/MPF.Library/Data/BaseParameters.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Compress.ThreadReaders; using MPF.Hashing; using MPF.Utilities; -using MPF.Web; namespace MPF.Data { @@ -583,7 +582,7 @@ namespace MPF.Data /// Output region, if possible /// Output EXE date in "yyyy-mm-dd" format if possible, null on error /// - protected static bool GetPlayStationExecutableInfo(char? driveLetter, out string serial, out Region? region, out string date) + protected static bool GetPlayStationExecutableInfo(char? driveLetter, out string serial, out RedumpRegion? region, out string date) { serial = null; region = null; date = null; @@ -763,16 +762,16 @@ namespace MPF.Data /// /// String representing the category /// Category, if possible - protected static DiscCategory? GetUMDCategory(string category) + protected static RedumpDiscCategory? GetUMDCategory(string category) { switch (category) { case "GAME": - return DiscCategory.Games; + return RedumpDiscCategory.Games; case "VIDEO": - return DiscCategory.Video; + return RedumpDiscCategory.Video; case "AUDIO": - return DiscCategory.Audio; + return RedumpDiscCategory.Audio; default: return null; } @@ -787,7 +786,7 @@ namespace MPF.Data /// /// PlayStation serial code /// Region mapped from name, if possible - protected static Region? GetPlayStationRegion(string serial) + protected static RedumpRegion? GetPlayStationRegion(string serial) { // Standardized "S" serials if (serial.StartsWith("S")) @@ -797,25 +796,25 @@ namespace MPF.Data switch (serial[2]) { case 'A': - return Region.Asia; + return RedumpRegion.Asia; case 'C': - return Region.China; + return RedumpRegion.China; case 'E': - return Region.Europe; + return RedumpRegion.Europe; case 'J': - return Region.JapanKorea; + return RedumpRegion.JapanKorea; case 'K': - return Region.Korea; + return RedumpRegion.Korea; case 'P': - return Region.Japan; + return RedumpRegion.Japan; case 'U': - return Region.USA; + return RedumpRegion.USA; } } // Japan-only special serial else if (serial.StartsWith("PAPX")) - return Region.Japan; + return RedumpRegion.Japan; // Region appears entirely random else if (serial.StartsWith("PABX")) @@ -823,15 +822,15 @@ namespace MPF.Data // Japan-only special serial else if (serial.StartsWith("PCBX")) - return Region.Japan; + return RedumpRegion.Japan; // Single disc known, Japan else if (serial.StartsWith("PDBX")) - return Region.Japan; + return RedumpRegion.Japan; // Single disc known, Europe else if (serial.StartsWith("PEBX")) - return Region.Europe; + return RedumpRegion.Europe; return null; } @@ -841,24 +840,24 @@ namespace MPF.Data /// /// Character denoting the region /// Region, if possible - protected static Region? GetXgdRegion(char region) + protected static RedumpRegion? GetXgdRegion(char region) { switch (region) { case 'W': - return Region.World; + return RedumpRegion.World; case 'A': - return Region.USA; + return RedumpRegion.USA; case 'J': - return Region.JapanAsia; + return RedumpRegion.JapanAsia; case 'E': - return Region.Europe; + return RedumpRegion.Europe; case 'K': - return Region.USAJapan; + return RedumpRegion.USAJapan; case 'L': - return Region.USAEurope; + return RedumpRegion.USAEurope; case 'H': - return Region.JapanEurope; + return RedumpRegion.JapanEurope; default: return null; } diff --git a/MPF.Library/Data/Enumerations.cs b/MPF.Library/Data/Enumerations.cs index 9423c8a9..a948cf3b 100644 --- a/MPF.Library/Data/Enumerations.cs +++ b/MPF.Library/Data/Enumerations.cs @@ -406,6 +406,254 @@ namespace MPF.Data TapeDSTLarge = 66, } + /// + /// Redump disc category + /// + public enum RedumpDiscCategory + { + Games = 1, + Demos = 2, + Video = 3, + Audio = 4, + Multimedia = 5, + Applications = 6, + Coverdiscs = 7, + Educational = 8, + BonusDiscs = 9, + Preproduction = 10, + AddOns = 11, + } + + /// + /// Redump dump status + /// + public enum RedumpDumpStatus + { + BadDumpRed = 2, + PossibleBadDumpYellow = 3, + OriginalMediaBlue = 4, + TwoOrMoreDumpsGreen = 5, + } + + /// + /// Redump supported langauge + /// + public enum RedumpLanguage + { + Afrikaans, + Arabic, + Basque, + Bulgarian, + Catalan, + Chinese, + Croatian, + Czech, + Danish, + Dutch, + English, + Finnish, + French, + Gaelic, + German, + Greek, + Hebrew, + Hindi, + Hungarian, + Italian, + Japanese, + Korean, + Norwegian, + Polish, + Portuguese, + Punjabi, + Romanian, + Russian, + Slovak, + Slovenian, + Spanish, + Swedish, + Tamil, + Thai, + Turkish, + Ukrainian, + } + + /// + /// Redump PS2 language selection via + /// + public enum RedumpLanguageSelection + { + BiosSettings, + LanguageSelector, + OptionsMenu, + } + + /// + /// Supported Redump region + /// + public enum RedumpRegion + { + Argentina, + Asia, + AsiaEurope, + AsiaUSA, + Australia, + AustraliaNewZealand, + Austria, + AustriaSwitzerland, + Belgium, + BelgiumNetherlands, + Brazil, + Canada, + China, + Croatia, + Czech, + Denmark, + Europe, + EuropeAsia, + EuropeAustralia, + EuropeCanada, + EuropeGermany, + Finland, + France, + FranceSpain, + Germany, + GreaterChina, + Greece, + Hungary, + India, + Ireland, + Israel, + Italy, + Japan, + JapanAsia, + JapanEurope, + JapanKorea, + JapanUSA, + Korea, + LatinAmerica, + Netherlands, + Norway, + Poland, + Portugal, + Romania, + Russia, + Scandinavia, + Singapore, + Slovakia, + SouthAfrica, + Spain, + SpainPortugal, + Sweden, + Switzerland, + Taiwan, + Thailand, + Turkey, + UnitedArabEmirates, + UK, + UKAustralia, + Ukraine, + USA, + USAAsia, + USABrazil, + USACanada, + USAEurope, + USAGermany, + USAJapan, + USAKorea, + World, + } + + /// + /// List of all known Redump systems + /// + public enum RedumpSystem + { + // Special BIOS sets + MicrosoftXboxBIOS, + NintendoGameCubeBIOS, + SonyPlayStationBIOS, + SonyPlayStation2BIOS, + + // Regular systems + AcornArchimedes, + AppleMacintosh, + AtariJaguarCDInteractiveMultimediaSystem, + AudioCD, + BandaiPippin, + BandaiPlaydiaQuickInteractiveSystem, + BDVideo, + CommodoreAmigaCD, + CommodoreAmigaCD32, + CommodoreAmigaCDTV, + DVDVideo, + EnhancedCD, + FujitsuFMTownsseries, + funworldPhotoPlay, + HasbroVideoNow, + HasbroVideoNowColor, + HasbroVideoNowJr, + HasbroVideoNowXP, + IBMPCcompatible, + IncredibleTechnologiesEagle, + KonamieAmusement, + KonamiFireBeat, + KonamiM2, + KonamiSystem573, + KonamiSystemGV, + KonamiTwinkle, + MattelFisherPriceiXL, + MattelHyperScan, + MemorexVisualInformationSystem, + MicrosoftXbox, + MicrosoftXbox360, + MicrosoftXboxOne, + MicrosoftXboxSeriesXS, + NamcoSegaNintendoTriforce, + NamcoSystem12, + NamcoSystem246, + NavisoftNaviken21, + NECPCEngineCDTurboGrafxCD, + NECPC88series, + NECPC98series, + NECPCFXPCFXGA, + NintendoGameCube, + NintendoWii, + NintendoWiiU, + PalmOS, + Panasonic3DOInteractiveMultiplayer, + PanasonicM2, + PhilipsCDi, + PhotoCD, + PlayStationGameSharkUpdates, + SegaChihiro, + SegaDreamcast, + SegaLindbergh, + SegaMegaCDSegaCD, + SegaNaomi, + SegaNaomi2, + SegaPrologue21, + SegaRingEdge, + SegaRingEdge2, + SegaSaturn, + SegaTitanVideo, + SharpX68000, + SNKNeoGeoCD, + SonyPlayStation, + SonyPlayStation2, + SonyPlayStation3, + SonyPlayStation4, + SonyPlayStation5, + SonyPlayStationPortable, + TABAustriaQuizard, + TaoiKTV, + TomyKissSite, + VideoCD, + VMLabsNUON, + VTechVFlashVSmilePro, + ZAPiTGamesGameWaveFamilyEntertainmentSystem, + } + /// /// Generic yes/no values for Redump /// diff --git a/MPF.Library/Web/SubmissionInfo.cs b/MPF.Library/Data/SubmissionInfo.cs similarity index 96% rename from MPF.Library/Web/SubmissionInfo.cs rename to MPF.Library/Data/SubmissionInfo.cs index 89b2eff1..a7ed250a 100644 --- a/MPF.Library/Web/SubmissionInfo.cs +++ b/MPF.Library/Data/SubmissionInfo.cs @@ -5,7 +5,7 @@ using MPF.Utilities; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; -namespace MPF.Web +namespace MPF.Data { public class SubmissionInfo { @@ -93,19 +93,19 @@ namespace MPF.Web public string DiscTitle { get; set; } [JsonProperty(PropertyName = "d_category", Required = Required.AllowNull)] - public DiscCategory? Category { get; set; } + public RedumpDiscCategory? Category { get; set; } [JsonProperty(PropertyName = "d_region", Required = Required.AllowNull)] - [JsonConverter(typeof(RegionConverter))] - public Region? Region { get; set; } + [JsonConverter(typeof(RedumpRegionConverter))] + public RedumpRegion? Region { get; set; } [JsonProperty(PropertyName = "d_languages", Required = Required.AllowNull)] - [JsonConverter(typeof(LanguagesConverter))] - public Language?[] Languages { get; set; } + [JsonConverter(typeof(RedumpLanguageConverter))] + public RedumpLanguage?[] Languages { get; set; } [JsonProperty(PropertyName = "d_languages_selection", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)] - [JsonConverter(typeof(LanguageSelectionConverter))] - public LanguageSelection?[] LanguageSelection { get; set; } + [JsonConverter(typeof(RedumpLanguageSelectionConverter))] + public RedumpLanguageSelection?[] LanguageSelection { get; set; } [JsonProperty(PropertyName = "d_serial", NullValueHandling = NullValueHandling.Ignore)] public string Serial { get; set; } @@ -288,7 +288,7 @@ namespace MPF.Web public class DumpersAndStatusSection { [JsonProperty(PropertyName = "d_status", NullValueHandling = NullValueHandling.Ignore)] - public DumpStatus Status { get; set; } + public RedumpDumpStatus Status { get; set; } [JsonProperty(PropertyName = "d_dumpers", NullValueHandling = NullValueHandling.Ignore)] public string[] Dumpers { get; set; } diff --git a/MPF.Library/DiscImageCreator/Parameters.cs b/MPF.Library/DiscImageCreator/Parameters.cs index 0775922d..f91b8ff1 100644 --- a/MPF.Library/DiscImageCreator/Parameters.cs +++ b/MPF.Library/DiscImageCreator/Parameters.cs @@ -7,7 +7,6 @@ using BurnOutSharp.External.psxt001z; using MPF.CueSheets; using MPF.Data; using MPF.Utilities; -using MPF.Web; namespace MPF.DiscImageCreator { @@ -1982,7 +1981,7 @@ namespace MPF.DiscImageCreator break; case KnownSystem.KonamiPython2: - if (GetPlayStationExecutableInfo(drive?.Letter, out string pythonTwoSerial, out Region? pythonTwoRegion, out string pythonTwoDate)) + if (GetPlayStationExecutableInfo(drive?.Letter, out string pythonTwoSerial, out RedumpRegion? pythonTwoRegion, out string pythonTwoDate)) { info.CommonDiscInfo.Comments += $"Internal Disc Serial: {pythonTwoSerial}\n"; info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? pythonTwoRegion; @@ -2002,7 +2001,7 @@ namespace MPF.DiscImageCreator info.Extras.SecuritySectorRanges = ss ?? ""; } - if (GetXboxDMIInfo(Path.Combine(outputDirectory, "DMI.bin"), out string serial, out string version, out Region? region)) + if (GetXboxDMIInfo(Path.Combine(outputDirectory, "DMI.bin"), out string serial, out string version, out RedumpRegion? region)) { info.CommonDiscInfo.Serial = serial ?? ""; info.VersionAndEditions.Version = version ?? ""; @@ -2021,7 +2020,7 @@ namespace MPF.DiscImageCreator info.Extras.SecuritySectorRanges = ss360 ?? ""; } - if (GetXbox360DMIInfo(Path.Combine(outputDirectory, "DMI.bin"), out string serial360, out string version360, out Region? region360)) + if (GetXbox360DMIInfo(Path.Combine(outputDirectory, "DMI.bin"), out string serial360, out string version360, out RedumpRegion? region360)) { info.CommonDiscInfo.Serial = serial360 ?? ""; info.VersionAndEditions.Version = version360 ?? ""; @@ -2156,7 +2155,7 @@ namespace MPF.DiscImageCreator break; case KnownSystem.SonyPlayStation: - if (GetPlayStationExecutableInfo(drive?.Letter, out string playstationSerial, out Region? playstationRegion, out string playstationDate)) + if (GetPlayStationExecutableInfo(drive?.Letter, out string playstationSerial, out RedumpRegion? playstationRegion, out string playstationDate)) { info.CommonDiscInfo.Comments += $"Internal Serial: {playstationSerial ?? ""}\n"; info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? playstationRegion; @@ -2213,7 +2212,7 @@ namespace MPF.DiscImageCreator break; case KnownSystem.SonyPlayStation2: - if (GetPlayStationExecutableInfo(drive?.Letter, out string playstationTwoSerial, out Region? playstationTwoRegion, out string playstationTwoDate)) + if (GetPlayStationExecutableInfo(drive?.Letter, out string playstationTwoSerial, out RedumpRegion? playstationTwoRegion, out string playstationTwoDate)) { info.CommonDiscInfo.Comments += $"Internal Disc Serial: {playstationTwoSerial}\n"; info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? playstationTwoRegion; @@ -3345,9 +3344,9 @@ namespace MPF.DiscImageCreator /// /// DMI.bin file location /// True on successful extraction of info, false otherwise - private static bool GetXboxDMIInfo(string dmi, out string serial, out string version, out Region? region) + private static bool GetXboxDMIInfo(string dmi, out string serial, out string version, out RedumpRegion? region) { - serial = null; version = null; region = Region.World; + serial = null; version = null; region = RedumpRegion.World; if (!File.Exists(dmi)) return false; @@ -3376,9 +3375,9 @@ namespace MPF.DiscImageCreator /// /// DMI.bin file location /// True on successful extraction of info, false otherwise - private static bool GetXbox360DMIInfo(string dmi, out string serial, out string version, out Region? region) + private static bool GetXbox360DMIInfo(string dmi, out string serial, out string version, out RedumpRegion? region) { - serial = null; version = null; region = Region.World; + serial = null; version = null; region = RedumpRegion.World; if (!File.Exists(dmi)) return false; diff --git a/MPF.Library/Web/Extensions.cs b/MPF.Library/Redump/Extras.cs similarity index 99% rename from MPF.Library/Web/Extensions.cs rename to MPF.Library/Redump/Extras.cs index acf2195f..d538dd77 100644 --- a/MPF.Library/Web/Extensions.cs +++ b/MPF.Library/Redump/Extras.cs @@ -1,9 +1,11 @@ -namespace MPF.Web +using MPF.Data; + +namespace MPF.Redump { /// /// Information pertaining to Redump systems /// - public static class Extensions + public static class Extras { #region Special lists diff --git a/MPF.Library/Web/RedumpWebClient.cs b/MPF.Library/Redump/RedumpWebClient.cs similarity index 95% rename from MPF.Library/Web/RedumpWebClient.cs rename to MPF.Library/Redump/RedumpWebClient.cs index 030d82bf..96ae8ff5 100644 --- a/MPF.Library/Web/RedumpWebClient.cs +++ b/MPF.Library/Redump/RedumpWebClient.cs @@ -6,10 +6,11 @@ using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Threading; +using MPF.Data; using MPF.Utilities; using Newtonsoft.Json.Linq; -namespace MPF.Web +namespace MPF.Redump { // https://stackoverflow.com/questions/1777221/using-cookiecontainer-with-webclient-class public class RedumpWebClient : WebClient @@ -424,7 +425,7 @@ namespace MPF.Web if (match.Success) info.CommonDiscInfo.Category = Converters.ToDiscCategory(match.Groups[1].Value); else - info.CommonDiscInfo.Category = DiscCategory.Games; + info.CommonDiscInfo.Category = RedumpDiscCategory.Games; // Comments match = commentsRegex.Match(discData); @@ -479,10 +480,10 @@ namespace MPF.Web matches = languagesRegex.Matches(discData); if (matches.Count > 0) { - List tempLanguages = new List(); + List tempLanguages = new List(); foreach (Match submatch in matches) { - tempLanguages.Add(Converters.ToLanguage(submatch.Groups[1].Value)); + tempLanguages.Add(Converters.ToRedumpLanguage(submatch.Groups[1].Value)); } info.CommonDiscInfo.Languages = tempLanguages.Where(l => l != null).ToArray(); @@ -516,7 +517,7 @@ namespace MPF.Web // Region match = regionRegex.Match(discData); if (match.Success) - info.CommonDiscInfo.Region = Converters.ToRegion(match.Groups[1].Value); + info.CommonDiscInfo.Region = Converters.ToRedumpRegion(match.Groups[1].Value); // Serial match = serialRegex.Match(discData); @@ -622,13 +623,13 @@ namespace MPF.Web /// True to use named subfolders to store downloads, false to store directly in the output directory public void DownloadPacks(string outDir, bool useSubfolders) { - this.DownloadPacks(packCuesUrl, Extensions.HasCues, "CUEs", outDir, useSubfolders ? "cue" : null); - this.DownloadPacks(packDatfileUrl, Extensions.HasDat, "DATs", outDir, useSubfolders ? "dat" : null); - this.DownloadPacks(packDkeysUrl, Extensions.HasDkeys, "Decrypted KEYS", outDir, useSubfolders ? "dkey" : null); - this.DownloadPacks(packGdiUrl, Extensions.HasGdi, "GDIs", outDir, useSubfolders ? "gdi" : null); - this.DownloadPacks(packKeysUrl, Extensions.HasKeys, "KEYS", outDir, useSubfolders ? "keys" : null); - this.DownloadPacks(packLsdUrl, Extensions.HasKeys, "LSD", outDir, useSubfolders ? "lsd" : null); - this.DownloadPacks(packSbiUrl, Extensions.HasSbi, "SBIs", outDir, useSubfolders ? "sbi" : null); + this.DownloadPacks(packCuesUrl, Extras.HasCues, "CUEs", outDir, useSubfolders ? "cue" : null); + this.DownloadPacks(packDatfileUrl, Extras.HasDat, "DATs", outDir, useSubfolders ? "dat" : null); + this.DownloadPacks(packDkeysUrl, Extras.HasDkeys, "Decrypted KEYS", outDir, useSubfolders ? "dkey" : null); + this.DownloadPacks(packGdiUrl, Extras.HasGdi, "GDIs", outDir, useSubfolders ? "gdi" : null); + this.DownloadPacks(packKeysUrl, Extras.HasKeys, "KEYS", outDir, useSubfolders ? "keys" : null); + this.DownloadPacks(packLsdUrl, Extras.HasKeys, "LSD", outDir, useSubfolders ? "lsd" : null); + this.DownloadPacks(packSbiUrl, Extras.HasSbi, "SBIs", outDir, useSubfolders ? "sbi" : null); } /// @@ -641,26 +642,26 @@ namespace MPF.Web { RedumpSystem?[] systemAsArray = new RedumpSystem?[] { system }; - if (Extensions.HasCues.Contains(system)) + if (Extras.HasCues.Contains(system)) this.DownloadPacks(packCuesUrl, systemAsArray, "CUEs", outDir, useSubfolders ? "cue" : null); - if (Extensions.HasDat.Contains(system)) - this.DownloadPacks(packCuesUrl, Extensions.HasDat, "DATs", outDir, useSubfolders ? "dat" : null); + if (Extras.HasDat.Contains(system)) + this.DownloadPacks(packCuesUrl, Extras.HasDat, "DATs", outDir, useSubfolders ? "dat" : null); - if (Extensions.HasDkeys.Contains(system)) - this.DownloadPacks(packCuesUrl, Extensions.HasDkeys, "Decrypted KEYS", outDir, useSubfolders ? "dkey" : null); + if (Extras.HasDkeys.Contains(system)) + this.DownloadPacks(packCuesUrl, Extras.HasDkeys, "Decrypted KEYS", outDir, useSubfolders ? "dkey" : null); - if (Extensions.HasGdi.Contains(system)) - this.DownloadPacks(packCuesUrl, Extensions.HasGdi, "GDIs", outDir, useSubfolders ? "gdi" : null); + if (Extras.HasGdi.Contains(system)) + this.DownloadPacks(packCuesUrl, Extras.HasGdi, "GDIs", outDir, useSubfolders ? "gdi" : null); - if (Extensions.HasKeys.Contains(system)) - this.DownloadPacks(packCuesUrl, Extensions.HasKeys, "KEYS", outDir, useSubfolders ? "keys" : null); + if (Extras.HasKeys.Contains(system)) + this.DownloadPacks(packCuesUrl, Extras.HasKeys, "KEYS", outDir, useSubfolders ? "keys" : null); - if (Extensions.HasLsd.Contains(system)) - this.DownloadPacks(packCuesUrl, Extensions.HasKeys, "LSD", outDir, useSubfolders ? "lsd" : null); + if (Extras.HasLsd.Contains(system)) + this.DownloadPacks(packCuesUrl, Extras.HasKeys, "LSD", outDir, useSubfolders ? "lsd" : null); - if (Extensions.HasSbi.Contains(system)) - this.DownloadPacks(packCuesUrl, Extensions.HasSbi, "SBIs", outDir, useSubfolders ? "sbi" : null); + if (Extras.HasSbi.Contains(system)) + this.DownloadPacks(packCuesUrl, Extras.HasSbi, "SBIs", outDir, useSubfolders ? "sbi" : null); } /// @@ -846,20 +847,20 @@ namespace MPF.Web if (match.Success) info.CommonDiscInfo.Category = Converters.ToDiscCategory(match.Groups[1].Value); else - info.CommonDiscInfo.Category = DiscCategory.Games; + info.CommonDiscInfo.Category = RedumpDiscCategory.Games; // Region match = regionRegex.Match(discData); if (match.Success) - info.CommonDiscInfo.Region = Converters.ToRegion(match.Groups[1].Value); + info.CommonDiscInfo.Region = Converters.ToRedumpRegion(match.Groups[1].Value); // Languages var matches = languagesRegex.Matches(discData); if (matches.Count > 0) { - List tempLanguages = new List(); + List tempLanguages = new List(); foreach (Match submatch in matches) - tempLanguages.Add(Converters.ToLanguage(submatch.Groups[1].Value)); + tempLanguages.Add(Converters.ToRedumpLanguage(submatch.Groups[1].Value)); info.CommonDiscInfo.Languages = tempLanguages.Where(l => l != null).ToArray(); } @@ -1501,7 +1502,7 @@ namespace MPF.Web // If we didn't have credentials if (!LoggedIn) - systems = systems.Where(s => !Extensions.BannedSystems.Contains(s)).ToArray(); + systems = systems.Where(s => !Extras.BannedSystems.Contains(s)).ToArray(); Console.WriteLine($"Downloading {title}"); foreach (var system in systems) @@ -1530,7 +1531,7 @@ namespace MPF.Web { // If we didn't have credentials if (!LoggedIn) - systems = systems.Where(s => !Extensions.BannedSystems.Contains(s)).ToArray(); + systems = systems.Where(s => !Extras.BannedSystems.Contains(s)).ToArray(); Console.WriteLine($"Downloading {title}"); foreach (var system in systems) diff --git a/MPF.Library/UmdImageCreator/Parameters.cs b/MPF.Library/UmdImageCreator/Parameters.cs index 96f22c9c..295026a2 100644 --- a/MPF.Library/UmdImageCreator/Parameters.cs +++ b/MPF.Library/UmdImageCreator/Parameters.cs @@ -2,7 +2,6 @@ using System.IO; using MPF.Data; using MPF.Utilities; -using MPF.Web; namespace MPF.UmdImageCreator { @@ -171,10 +170,10 @@ namespace MPF.UmdImageCreator info.SizeAndChecksums.SHA1 = sha1; } - if (GetUMDAuxInfo(basePath + "_disc.txt", out string title, out DiscCategory? umdcat, out string umdversion, out string umdlayer, out long umdsize)) + if (GetUMDAuxInfo(basePath + "_disc.txt", out string title, out RedumpDiscCategory? umdcat, out string umdversion, out string umdlayer, out long umdsize)) { info.CommonDiscInfo.Title = title ?? ""; - info.CommonDiscInfo.Category = umdcat ?? DiscCategory.Games; + info.CommonDiscInfo.Category = umdcat ?? RedumpDiscCategory.Games; info.VersionAndEditions.Version = umdversion ?? ""; info.SizeAndChecksums.Size = umdsize; @@ -239,7 +238,7 @@ namespace MPF.UmdImageCreator /// /// _disc.txt file location /// True on successful extraction of info, false otherwise - private static bool GetUMDAuxInfo(string disc, out string title, out DiscCategory? umdcat, out string umdversion, out string umdlayer, out long umdsize) + private static bool GetUMDAuxInfo(string disc, out string title, out RedumpDiscCategory? umdcat, out string umdversion, out string umdlayer, out long umdsize) { title = null; umdcat = null; umdversion = null; umdlayer = null; umdsize = -1; diff --git a/MPF.Library/Utilities/Converters.cs b/MPF.Library/Utilities/Converters.cs index 70005307..437f9c68 100644 --- a/MPF.Library/Utilities/Converters.cs +++ b/MPF.Library/Utilities/Converters.cs @@ -3,7 +3,6 @@ using System.Collections.Concurrent; using System.IO; using System.Reflection; using MPF.Data; -using MPF.Web; #if NET_FRAMEWORK using IMAPI2; #endif @@ -497,42 +496,6 @@ namespace MPF.Utilities } } - /// - /// Get the string representation of the DiscCategory enum values - /// - /// DiscCategory value to convert - /// String representing the value, if possible - public static string LongName(this DiscCategory? category) - { - switch (category) - { - case DiscCategory.Games: - return "Games"; - case DiscCategory.Demos: - return "Demos"; - case DiscCategory.Video: - return "Video"; - case DiscCategory.Audio: - return "Audio"; - case DiscCategory.Multimedia: - return "Multimedia"; - case DiscCategory.Applications: - return "Applications"; - case DiscCategory.Coverdiscs: - return "Coverdiscs"; - case DiscCategory.Educational: - return "Educational"; - case DiscCategory.BonusDiscs: - return "Bonus Discs"; - case DiscCategory.Preproduction: - return "Preproduction"; - case DiscCategory.AddOns: - return "Add-Ons"; - default: - return null; - } - } - /// /// Get the string representation of the InternalProgram enum values /// @@ -869,112 +832,6 @@ namespace MPF.Utilities } } - /// - /// Get the string representation of the Language enum values - /// - /// Language value to convert - /// String representing the value, if possible - public static string LongName(this Language? language) - { - switch (language) - { - case Language.Afrikaans: - return "Afrikaans"; - case Language.Arabic: - return "Arabic"; - case Language.Basque: - return "Basque"; - case Language.Bulgarian: - return "Bulgarian"; - case Language.Catalan: - return "Catalan"; - case Language.Chinese: - return "Chinese"; - case Language.Croatian: - return "Croatian"; - case Language.Czech: - return "Czech"; - case Language.Danish: - return "Danish"; - case Language.Dutch: - return "Dutch"; - case Language.English: - return "English"; - case Language.Finnish: - return "Finnish"; - case Language.French: - return "French"; - case Language.Gaelic: - return "Gaelic"; - case Language.German: - return "German"; - case Language.Greek: - return "Greek"; - case Language.Hebrew: - return "Hebrew"; - case Language.Hindi: - return "Hindi"; - case Language.Hungarian: - return "Hungarian"; - case Language.Italian: - return "Italian"; - case Language.Japanese: - return "Japanese"; - case Language.Korean: - return "Korean"; - case Language.Norwegian: - return "Norwegian"; - case Language.Polish: - return "Polish"; - case Language.Portuguese: - return "Portuguese"; - case Language.Punjabi: - return "Punjabi"; - case Language.Romanian: - return "Romanian"; - case Language.Russian: - return "Russian"; - case Language.Slovak: - return "Slovak"; - case Language.Slovenian: - return "Slovenian"; - case Language.Spanish: - return "Spanish"; - case Language.Swedish: - return "Swedish"; - case Language.Tamil: - return "Tamil"; - case Language.Thai: - return "Thai"; - case Language.Turkish: - return "Turkish"; - case Language.Ukrainian: - return "Ukrainian"; - default: - return "Klingon (CHANGE THIS)"; // TODO: Not Redump compatible - } - } - - /// - /// Get the string representation of the LanguageSelection enum values - /// - /// LanguageSelection value to convert - /// String representing the value, if possible - public static string LongName(this LanguageSelection? langSelect) - { - switch (langSelect) - { - case LanguageSelection.BiosSettings: - return "Bios settings"; - case LanguageSelection.LanguageSelector: - return "Language selector"; - case LanguageSelection.OptionsMenu: - return "Options menu"; - default: - return string.Empty; - } - } - /// /// Get the string representation of the MediaType enum values /// @@ -1065,6 +922,300 @@ namespace MPF.Utilities } } + /// + /// Get the string representation of the DiscCategory enum values + /// + /// DiscCategory value to convert + /// String representing the value, if possible + public static string LongName(this RedumpDiscCategory? category) + { + switch (category) + { + case RedumpDiscCategory.Games: + return "Games"; + case RedumpDiscCategory.Demos: + return "Demos"; + case RedumpDiscCategory.Video: + return "Video"; + case RedumpDiscCategory.Audio: + return "Audio"; + case RedumpDiscCategory.Multimedia: + return "Multimedia"; + case RedumpDiscCategory.Applications: + return "Applications"; + case RedumpDiscCategory.Coverdiscs: + return "Coverdiscs"; + case RedumpDiscCategory.Educational: + return "Educational"; + case RedumpDiscCategory.BonusDiscs: + return "Bonus Discs"; + case RedumpDiscCategory.Preproduction: + return "Preproduction"; + case RedumpDiscCategory.AddOns: + return "Add-Ons"; + default: + return null; + } + } + + /// + /// Get the string representation of the Language enum values + /// + /// Language value to convert + /// String representing the value, if possible + public static string LongName(this RedumpLanguage? language) + { + switch (language) + { + case RedumpLanguage.Afrikaans: + return "Afrikaans"; + case RedumpLanguage.Arabic: + return "Arabic"; + case RedumpLanguage.Basque: + return "Basque"; + case RedumpLanguage.Bulgarian: + return "Bulgarian"; + case RedumpLanguage.Catalan: + return "Catalan"; + case RedumpLanguage.Chinese: + return "Chinese"; + case RedumpLanguage.Croatian: + return "Croatian"; + case RedumpLanguage.Czech: + return "Czech"; + case RedumpLanguage.Danish: + return "Danish"; + case RedumpLanguage.Dutch: + return "Dutch"; + case RedumpLanguage.English: + return "English"; + case RedumpLanguage.Finnish: + return "Finnish"; + case RedumpLanguage.French: + return "French"; + case RedumpLanguage.Gaelic: + return "Gaelic"; + case RedumpLanguage.German: + return "German"; + case RedumpLanguage.Greek: + return "Greek"; + case RedumpLanguage.Hebrew: + return "Hebrew"; + case RedumpLanguage.Hindi: + return "Hindi"; + case RedumpLanguage.Hungarian: + return "Hungarian"; + case RedumpLanguage.Italian: + return "Italian"; + case RedumpLanguage.Japanese: + return "Japanese"; + case RedumpLanguage.Korean: + return "Korean"; + case RedumpLanguage.Norwegian: + return "Norwegian"; + case RedumpLanguage.Polish: + return "Polish"; + case RedumpLanguage.Portuguese: + return "Portuguese"; + case RedumpLanguage.Punjabi: + return "Punjabi"; + case RedumpLanguage.Romanian: + return "Romanian"; + case RedumpLanguage.Russian: + return "Russian"; + case RedumpLanguage.Slovak: + return "Slovak"; + case RedumpLanguage.Slovenian: + return "Slovenian"; + case RedumpLanguage.Spanish: + return "Spanish"; + case RedumpLanguage.Swedish: + return "Swedish"; + case RedumpLanguage.Tamil: + return "Tamil"; + case RedumpLanguage.Thai: + return "Thai"; + case RedumpLanguage.Turkish: + return "Turkish"; + case RedumpLanguage.Ukrainian: + return "Ukrainian"; + default: + return "Klingon (CHANGE THIS)"; // TODO: Not Redump compatible + } + } + + /// + /// Get the string representation of the LanguageSelection enum values + /// + /// LanguageSelection value to convert + /// String representing the value, if possible + public static string LongName(this RedumpLanguageSelection? langSelect) + { + switch (langSelect) + { + case RedumpLanguageSelection.BiosSettings: + return "Bios settings"; + case RedumpLanguageSelection.LanguageSelector: + return "Language selector"; + case RedumpLanguageSelection.OptionsMenu: + return "Options menu"; + default: + return string.Empty; + } + } + + /// + /// Get the string representation of the Region enum values + /// + /// Region value to convert + /// String representing the value, if possible + public static string LongName(this RedumpRegion? region) + { + switch (region) + { + case RedumpRegion.Argentina: + return "Argentina"; + case RedumpRegion.Asia: + return "Asia"; + case RedumpRegion.AsiaEurope: + return "Asia, Europe"; + case RedumpRegion.AsiaUSA: + return "Asia, USA"; + case RedumpRegion.Australia: + return "Australia"; + case RedumpRegion.AustraliaNewZealand: + return "Australia, New Zealand"; + case RedumpRegion.Austria: + return "Austria"; + case RedumpRegion.AustriaSwitzerland: + return "Austria, Switzerland"; + case RedumpRegion.Belgium: + return "Belgium"; + case RedumpRegion.BelgiumNetherlands: + return "Belgium, Netherlands"; + case RedumpRegion.Brazil: + return "Brazil"; + case RedumpRegion.Canada: + return "Canada"; + case RedumpRegion.China: + return "China"; + case RedumpRegion.Croatia: + return "Croatia"; + case RedumpRegion.Czech: + return "Czech"; + case RedumpRegion.Denmark: + return "Denmark"; + case RedumpRegion.Europe: + return "Europe"; + case RedumpRegion.EuropeAsia: + return "Europe, Asia"; + case RedumpRegion.EuropeAustralia: + return "Europe, Australia"; + case RedumpRegion.EuropeCanada: + return "Europe, Canada"; + case RedumpRegion.EuropeGermany: + return "Europe, Germany"; + case RedumpRegion.Finland: + return "Finland"; + case RedumpRegion.France: + return "France"; + case RedumpRegion.FranceSpain: + return "France, Spain"; + case RedumpRegion.Germany: + return "Germany"; + case RedumpRegion.GreaterChina: + return "Greater China"; + case RedumpRegion.Greece: + return "Greece"; + case RedumpRegion.Hungary: + return "Hungary"; + case RedumpRegion.India: + return "India"; + case RedumpRegion.Ireland: + return "Ireland"; + case RedumpRegion.Israel: + return "Israel"; + case RedumpRegion.Italy: + return "Italy"; + case RedumpRegion.Japan: + return "Japan"; + case RedumpRegion.JapanAsia: + return "Japan, Asia"; + case RedumpRegion.JapanEurope: + return "Japan, Europe"; + case RedumpRegion.JapanKorea: + return "Japan, Korea"; + case RedumpRegion.JapanUSA: + return "Japan, USA"; + case RedumpRegion.Korea: + return "Korea"; + case RedumpRegion.LatinAmerica: + return "Latin America"; + case RedumpRegion.Netherlands: + return "Netherlands"; + case RedumpRegion.Norway: + return "Norway"; + case RedumpRegion.Poland: + return "Poland"; + case RedumpRegion.Portugal: + return "Portugal"; + case RedumpRegion.Romania: + return "Romania"; + case RedumpRegion.Russia: + return "Russia"; + case RedumpRegion.Scandinavia: + return "Scandinavia"; + case RedumpRegion.Singapore: + return "Singapore"; + case RedumpRegion.Slovakia: + return "Slovakia"; + case RedumpRegion.SouthAfrica: + return "South Africa"; + case RedumpRegion.Spain: + return "Spain"; + case RedumpRegion.SpainPortugal: + return "Spain, Portugal"; + case RedumpRegion.Sweden: + return "Sweden"; + case RedumpRegion.Switzerland: + return "Switzerland"; + case RedumpRegion.Taiwan: + return "Taiwan"; + case RedumpRegion.Thailand: + return "Thailand"; + case RedumpRegion.Turkey: + return "Turkey"; + case RedumpRegion.UnitedArabEmirates: + return "United Arab Emirates"; + case RedumpRegion.UK: + return "UK"; + case RedumpRegion.UKAustralia: + return "UK, Australia"; + case RedumpRegion.Ukraine: + return "Ukraine"; + case RedumpRegion.USA: + return "USA"; + case RedumpRegion.USAAsia: + return "USA, Asia"; + case RedumpRegion.USABrazil: + return "USA, Brazil"; + case RedumpRegion.USACanada: + return "USA, Canada"; + case RedumpRegion.USAEurope: + return "USA, Europe"; + case RedumpRegion.USAGermany: + return "USA, Germany"; + case RedumpRegion.USAJapan: + return "USA, Japan"; + case RedumpRegion.USAKorea: + return "USA, Korea"; + case RedumpRegion.World: + return "World"; + default: + return "SPACE! (CHANGE THIS)"; // TODO: Not Redump compatible + } + } + /// /// Get the string representation of the MediaType enum values /// @@ -1242,158 +1393,6 @@ namespace MPF.Utilities } } - /// - /// Get the string representation of the Region enum values - /// - /// Region value to convert - /// String representing the value, if possible - public static string LongName(this Region? region) - { - switch (region) - { - case Region.Argentina: - return "Argentina"; - case Region.Asia: - return "Asia"; - case Region.AsiaEurope: - return "Asia, Europe"; - case Region.AsiaUSA: - return "Asia, USA"; - case Region.Australia: - return "Australia"; - case Region.AustraliaNewZealand: - return "Australia, New Zealand"; - case Region.Austria: - return "Austria"; - case Region.AustriaSwitzerland: - return "Austria, Switzerland"; - case Region.Belgium: - return "Belgium"; - case Region.BelgiumNetherlands: - return "Belgium, Netherlands"; - case Region.Brazil: - return "Brazil"; - case Region.Canada: - return "Canada"; - case Region.China: - return "China"; - case Region.Croatia: - return "Croatia"; - case Region.Czech: - return "Czech"; - case Region.Denmark: - return "Denmark"; - case Region.Europe: - return "Europe"; - case Region.EuropeAsia: - return "Europe, Asia"; - case Region.EuropeAustralia: - return "Europe, Australia"; - case Region.EuropeCanada: - return "Europe, Canada"; - case Region.EuropeGermany: - return "Europe, Germany"; - case Region.Finland: - return "Finland"; - case Region.France: - return "France"; - case Region.FranceSpain: - return "France, Spain"; - case Region.Germany: - return "Germany"; - case Region.GreaterChina: - return "Greater China"; - case Region.Greece: - return "Greece"; - case Region.Hungary: - return "Hungary"; - case Region.India: - return "India"; - case Region.Ireland: - return "Ireland"; - case Region.Israel: - return "Israel"; - case Region.Italy: - return "Italy"; - case Region.Japan: - return "Japan"; - case Region.JapanAsia: - return "Japan, Asia"; - case Region.JapanEurope: - return "Japan, Europe"; - case Region.JapanKorea: - return "Japan, Korea"; - case Region.JapanUSA: - return "Japan, USA"; - case Region.Korea: - return "Korea"; - case Region.LatinAmerica: - return "Latin America"; - case Region.Netherlands: - return "Netherlands"; - case Region.Norway: - return "Norway"; - case Region.Poland: - return "Poland"; - case Region.Portugal: - return "Portugal"; - case Region.Romania: - return "Romania"; - case Region.Russia: - return "Russia"; - case Region.Scandinavia: - return "Scandinavia"; - case Region.Singapore: - return "Singapore"; - case Region.Slovakia: - return "Slovakia"; - case Region.SouthAfrica: - return "South Africa"; - case Region.Spain: - return "Spain"; - case Region.SpainPortugal: - return "Spain, Portugal"; - case Region.Sweden: - return "Sweden"; - case Region.Switzerland: - return "Switzerland"; - case Region.Taiwan: - return "Taiwan"; - case Region.Thailand: - return "Thailand"; - case Region.Turkey: - return "Turkey"; - case Region.UnitedArabEmirates: - return "United Arab Emirates"; - case Region.UK: - return "UK"; - case Region.UKAustralia: - return "UK, Australia"; - case Region.Ukraine: - return "Ukraine"; - case Region.USA: - return "USA"; - case Region.USAAsia: - return "USA, Asia"; - case Region.USABrazil: - return "USA, Brazil"; - case Region.USACanada: - return "USA, Canada"; - case Region.USAEurope: - return "USA, Europe"; - case Region.USAGermany: - return "USA, Germany"; - case Region.USAJapan: - return "USA, Japan"; - case Region.USAKorea: - return "USA, Korea"; - case Region.World: - return "World"; - default: - return "SPACE! (CHANGE THIS)"; // TODO: Not Redump compatible - } - } - /// /// Get the string representation of the YesNo enum values /// @@ -1723,92 +1722,6 @@ namespace MPF.Utilities } } - /// - /// Get the short string representation of the Language enum values - /// - /// Language value to convert - /// Short string representing the value, if possible - public static string ShortName(this Language? language) - { - switch (language) - { - case Language.Afrikaans: - return "afr"; - case Language.Arabic: - return "ara"; - case Language.Basque: - return "baq"; - case Language.Bulgarian: - return "bul"; - case Language.Catalan: - return "cat"; - case Language.Chinese: - return "chi"; - case Language.Croatian: - return "hrv"; - case Language.Czech: - return "cze"; - case Language.Danish: - return "dan"; - case Language.Dutch: - return "dut"; - case Language.English: - return "eng"; - case Language.Finnish: - return "fin"; - case Language.French: - return "fre"; - case Language.Gaelic: - return "gla"; - case Language.German: - return "ger"; - case Language.Greek: - return "gre"; - case Language.Hebrew: - return "heb"; - case Language.Hindi: - return "hin"; - case Language.Hungarian: - return "hun"; - case Language.Italian: - return "ita"; - case Language.Japanese: - return "jap"; - case Language.Korean: - return "kor"; - case Language.Norwegian: - return "nor"; - case Language.Polish: - return "pol"; - case Language.Portuguese: - return "por"; - case Language.Punjabi: - return "pan"; - case Language.Romanian: - return "ron"; - case Language.Russian: - return "rus"; - case Language.Slovak: - return "slk"; - case Language.Slovenian: - return "slv"; - case Language.Spanish: - return "spa"; - case Language.Swedish: - return "swe"; - case Language.Tamil: - return "tam"; - case Language.Thai: - return "tha"; - case Language.Turkish: - return "tur"; - case Language.Ukrainian: - return "ukr"; - default: - return null; - } - } - /// /// Get the short string representation of the MediaType enum values /// @@ -1899,6 +1812,244 @@ namespace MPF.Utilities } } + /// + /// Get the short string representation of the Language enum values + /// + /// Language value to convert + /// Short string representing the value, if possible + public static string ShortName(this RedumpLanguage? language) + { + switch (language) + { + case RedumpLanguage.Afrikaans: + return "afr"; + case RedumpLanguage.Arabic: + return "ara"; + case RedumpLanguage.Basque: + return "baq"; + case RedumpLanguage.Bulgarian: + return "bul"; + case RedumpLanguage.Catalan: + return "cat"; + case RedumpLanguage.Chinese: + return "chi"; + case RedumpLanguage.Croatian: + return "hrv"; + case RedumpLanguage.Czech: + return "cze"; + case RedumpLanguage.Danish: + return "dan"; + case RedumpLanguage.Dutch: + return "dut"; + case RedumpLanguage.English: + return "eng"; + case RedumpLanguage.Finnish: + return "fin"; + case RedumpLanguage.French: + return "fre"; + case RedumpLanguage.Gaelic: + return "gla"; + case RedumpLanguage.German: + return "ger"; + case RedumpLanguage.Greek: + return "gre"; + case RedumpLanguage.Hebrew: + return "heb"; + case RedumpLanguage.Hindi: + return "hin"; + case RedumpLanguage.Hungarian: + return "hun"; + case RedumpLanguage.Italian: + return "ita"; + case RedumpLanguage.Japanese: + return "jap"; + case RedumpLanguage.Korean: + return "kor"; + case RedumpLanguage.Norwegian: + return "nor"; + case RedumpLanguage.Polish: + return "pol"; + case RedumpLanguage.Portuguese: + return "por"; + case RedumpLanguage.Punjabi: + return "pan"; + case RedumpLanguage.Romanian: + return "ron"; + case RedumpLanguage.Russian: + return "rus"; + case RedumpLanguage.Slovak: + return "slk"; + case RedumpLanguage.Slovenian: + return "slv"; + case RedumpLanguage.Spanish: + return "spa"; + case RedumpLanguage.Swedish: + return "swe"; + case RedumpLanguage.Tamil: + return "tam"; + case RedumpLanguage.Thai: + return "tha"; + case RedumpLanguage.Turkish: + return "tur"; + case RedumpLanguage.Ukrainian: + return "ukr"; + default: + return null; + } + } + + /// + /// Get the short string representation of the Region enum values + /// + /// Region value to convert + /// Short string representing the value, if possible + public static string ShortName(this RedumpRegion? region) + { + switch (region) + { + case RedumpRegion.Argentina: + return "Ar"; + case RedumpRegion.Asia: + return "A"; + case RedumpRegion.AsiaEurope: + return "A,E"; + case RedumpRegion.AsiaUSA: + return "A,U"; + case RedumpRegion.Australia: + return "Au"; + case RedumpRegion.AustraliaNewZealand: + return "Au,Nz"; + case RedumpRegion.Austria: + return "At"; + case RedumpRegion.AustriaSwitzerland: + return "At,Ch"; + case RedumpRegion.Belgium: + return "Be"; + case RedumpRegion.BelgiumNetherlands: + return "Be,N"; + case RedumpRegion.Brazil: + return "B"; + case RedumpRegion.Canada: + return "Ca"; + case RedumpRegion.China: + return "C"; + case RedumpRegion.Croatia: + return "Hr"; + case RedumpRegion.Czech: + return "Cz"; + case RedumpRegion.Denmark: + return "Dk"; + case RedumpRegion.Europe: + return "E"; + case RedumpRegion.EuropeAsia: + return "E,A"; + case RedumpRegion.EuropeAustralia: + return "E,Au"; + case RedumpRegion.EuropeCanada: + return "E,Ca"; + case RedumpRegion.EuropeGermany: + return "E,G"; + case RedumpRegion.Finland: + return "Fi"; + case RedumpRegion.France: + return "F"; + case RedumpRegion.FranceSpain: + return "F,S"; + case RedumpRegion.Germany: + return "G"; + case RedumpRegion.GreaterChina: + return "GC"; + case RedumpRegion.Greece: + return "Gr"; + case RedumpRegion.Hungary: + return "H"; + case RedumpRegion.India: + return "In"; + case RedumpRegion.Ireland: + return "Ie"; + case RedumpRegion.Israel: + return "Il"; + case RedumpRegion.Italy: + return "I"; + case RedumpRegion.Japan: + return "J"; + case RedumpRegion.JapanAsia: + return "J,A"; + case RedumpRegion.JapanEurope: + return "J,E"; + case RedumpRegion.JapanKorea: + return "J,K"; + case RedumpRegion.JapanUSA: + return "J,U"; + case RedumpRegion.Korea: + return "K"; + case RedumpRegion.LatinAmerica: + return "LAm"; + case RedumpRegion.Netherlands: + return "N"; + case RedumpRegion.Norway: + return "No"; + case RedumpRegion.Poland: + return "P"; + case RedumpRegion.Portugal: + return "Pt"; + case RedumpRegion.Romania: + return "Ro"; + case RedumpRegion.Russia: + return "R"; + case RedumpRegion.Scandinavia: + return "Sca"; + case RedumpRegion.Singapore: + return "Sg"; + case RedumpRegion.Slovakia: + return "Sk"; + case RedumpRegion.SouthAfrica: + return "Za"; + case RedumpRegion.Spain: + return "S"; + case RedumpRegion.SpainPortugal: + return "S,Pt"; + case RedumpRegion.Sweden: + return "Sw"; + case RedumpRegion.Switzerland: + return "Ch"; + case RedumpRegion.Taiwan: + return "Tw"; + case RedumpRegion.Thailand: + return "Th"; + case RedumpRegion.Turkey: + return "Tr"; + case RedumpRegion.UnitedArabEmirates: + return "Ae"; + case RedumpRegion.UK: + return "Uk"; + case RedumpRegion.UKAustralia: + return "Uk,Au"; + case RedumpRegion.Ukraine: + return "Ue"; + case RedumpRegion.USA: + return "U"; + case RedumpRegion.USAAsia: + return "U,A"; + case RedumpRegion.USABrazil: + return "U,B"; + case RedumpRegion.USACanada: + return "U,Ca"; + case RedumpRegion.USAEurope: + return "U,E"; + case RedumpRegion.USAGermany: + return "U,G"; + case RedumpRegion.USAJapan: + return "U,J"; + case RedumpRegion.USAKorea: + return "U,K"; + case RedumpRegion.World: + return "W"; + default: + return null; + } + } + /// /// Get the short string representation of the RedumpSystem enum values /// @@ -2076,158 +2227,6 @@ namespace MPF.Utilities } } - /// - /// Get the short string representation of the Region enum values - /// - /// Region value to convert - /// Short string representing the value, if possible - public static string ShortName(this Region? region) - { - switch (region) - { - case Region.Argentina: - return "Ar"; - case Region.Asia: - return "A"; - case Region.AsiaEurope: - return "A,E"; - case Region.AsiaUSA: - return "A,U"; - case Region.Australia: - return "Au"; - case Region.AustraliaNewZealand: - return "Au,Nz"; - case Region.Austria: - return "At"; - case Region.AustriaSwitzerland: - return "At,Ch"; - case Region.Belgium: - return "Be"; - case Region.BelgiumNetherlands: - return "Be,N"; - case Region.Brazil: - return "B"; - case Region.Canada: - return "Ca"; - case Region.China: - return "C"; - case Region.Croatia: - return "Hr"; - case Region.Czech: - return "Cz"; - case Region.Denmark: - return "Dk"; - case Region.Europe: - return "E"; - case Region.EuropeAsia: - return "E,A"; - case Region.EuropeAustralia: - return "E,Au"; - case Region.EuropeCanada: - return "E,Ca"; - case Region.EuropeGermany: - return "E,G"; - case Region.Finland: - return "Fi"; - case Region.France: - return "F"; - case Region.FranceSpain: - return "F,S"; - case Region.Germany: - return "G"; - case Region.GreaterChina: - return "GC"; - case Region.Greece: - return "Gr"; - case Region.Hungary: - return "H"; - case Region.India: - return "In"; - case Region.Ireland: - return "Ie"; - case Region.Israel: - return "Il"; - case Region.Italy: - return "I"; - case Region.Japan: - return "J"; - case Region.JapanAsia: - return "J,A"; - case Region.JapanEurope: - return "J,E"; - case Region.JapanKorea: - return "J,K"; - case Region.JapanUSA: - return "J,U"; - case Region.Korea: - return "K"; - case Region.LatinAmerica: - return "LAm"; - case Region.Netherlands: - return "N"; - case Region.Norway: - return "No"; - case Region.Poland: - return "P"; - case Region.Portugal: - return "Pt"; - case Region.Romania: - return "Ro"; - case Region.Russia: - return "R"; - case Region.Scandinavia: - return "Sca"; - case Region.Singapore: - return "Sg"; - case Region.Slovakia: - return "Sk"; - case Region.SouthAfrica: - return "Za"; - case Region.Spain: - return "S"; - case Region.SpainPortugal: - return "S,Pt"; - case Region.Sweden: - return "Sw"; - case Region.Switzerland: - return "Ch"; - case Region.Taiwan: - return "Tw"; - case Region.Thailand: - return "Th"; - case Region.Turkey: - return "Tr"; - case Region.UnitedArabEmirates: - return "Ae"; - case Region.UK: - return "Uk"; - case Region.UKAustralia: - return "Uk,Au"; - case Region.Ukraine: - return "Ue"; - case Region.USA: - return "U"; - case Region.USAAsia: - return "U,A"; - case Region.USABrazil: - return "U,B"; - case Region.USACanada: - return "U,Ca"; - case Region.USAEurope: - return "U,E"; - case Region.USAGermany: - return "U,G"; - case Region.USAJapan: - return "U,J"; - case Region.USAKorea: - return "U,K"; - case Region.World: - return "W"; - default: - return null; - } - } - #endregion #region Convert From String @@ -2237,36 +2236,36 @@ namespace MPF.Utilities /// /// String value to convert /// DiscCategory represented by the string, if possible - public static DiscCategory? ToDiscCategory(string category) + public static RedumpDiscCategory? ToDiscCategory(string category) { switch (category.ToLowerInvariant()) { case "games": - return DiscCategory.Games; + return RedumpDiscCategory.Games; case "demos": - return DiscCategory.Demos; + return RedumpDiscCategory.Demos; case "video": - return DiscCategory.Video; + return RedumpDiscCategory.Video; case "audio": - return DiscCategory.Audio; + return RedumpDiscCategory.Audio; case "multimedia": - return DiscCategory.Multimedia; + return RedumpDiscCategory.Multimedia; case "applications": - return DiscCategory.Applications; + return RedumpDiscCategory.Applications; case "coverdiscs": - return DiscCategory.Coverdiscs; + return RedumpDiscCategory.Coverdiscs; case "educational": - return DiscCategory.Educational; + return RedumpDiscCategory.Educational; case "bonusdiscs": case "bonus discs": - return DiscCategory.BonusDiscs; + return RedumpDiscCategory.BonusDiscs; case "preproduction": - return DiscCategory.Preproduction; + return RedumpDiscCategory.Preproduction; case "addons": case "add-ons": - return DiscCategory.AddOns; + return RedumpDiscCategory.AddOns; default: - return DiscCategory.Games; + return RedumpDiscCategory.Games; } } @@ -3077,92 +3076,6 @@ namespace MPF.Utilities } } - /// - /// Get the Language enum value for a given string - /// - /// String value to convert - /// Language represented by the string, if possible - public static Language? ToLanguage(string lang) - { - switch (lang) - { - case "afr": - return Language.Afrikaans; - case "ara": - return Language.Arabic; - case "baq": - return Language.Basque; - case "bul": - return Language.Bulgarian; - case "cat": - return Language.Catalan; - case "chi": - return Language.Chinese; - case "hrv": - return Language.Croatian; - case "cze": - return Language.Czech; - case "dan": - return Language.Danish; - case "dut": - return Language.Dutch; - case "eng": - return Language.English; - case "fin": - return Language.Finnish; - case "fre": - return Language.French; - case "gla": - return Language.Gaelic; - case "ger": - return Language.German; - case "gre": - return Language.Greek; - case "heb": - return Language.Hebrew; - case "hin": - return Language.Hindi; - case "hun": - return Language.Hungarian; - case "ita": - return Language.Italian; - case "jap": - return Language.Japanese; - case "kor": - return Language.Korean; - case "nor": - return Language.Norwegian; - case "pol": - return Language.Polish; - case "por": - return Language.Portuguese; - case "pan": - return Language.Punjabi; - case "ron": - return Language.Romanian; - case "rus": - return Language.Russian; - case "slk": - return Language.Slovak; - case "slv": - return Language.Slovenian; - case "spa": - return Language.Spanish; - case "swe": - return Language.Swedish; - case "tam": - return Language.Tamil; - case "tha": - return Language.Thai; - case "tur": - return Language.Turkish; - case "ukr": - return Language.Ukrainian; - default: - return null; - } - } - /// /// Get the MediaType enum value for a given string /// @@ -3336,6 +3249,244 @@ namespace MPF.Utilities } } + /// + /// Get the Language enum value for a given string + /// + /// String value to convert + /// Language represented by the string, if possible + public static RedumpLanguage? ToRedumpLanguage(string lang) + { + switch (lang) + { + case "afr": + return RedumpLanguage.Afrikaans; + case "ara": + return RedumpLanguage.Arabic; + case "baq": + return RedumpLanguage.Basque; + case "bul": + return RedumpLanguage.Bulgarian; + case "cat": + return RedumpLanguage.Catalan; + case "chi": + return RedumpLanguage.Chinese; + case "hrv": + return RedumpLanguage.Croatian; + case "cze": + return RedumpLanguage.Czech; + case "dan": + return RedumpLanguage.Danish; + case "dut": + return RedumpLanguage.Dutch; + case "eng": + return RedumpLanguage.English; + case "fin": + return RedumpLanguage.Finnish; + case "fre": + return RedumpLanguage.French; + case "gla": + return RedumpLanguage.Gaelic; + case "ger": + return RedumpLanguage.German; + case "gre": + return RedumpLanguage.Greek; + case "heb": + return RedumpLanguage.Hebrew; + case "hin": + return RedumpLanguage.Hindi; + case "hun": + return RedumpLanguage.Hungarian; + case "ita": + return RedumpLanguage.Italian; + case "jap": + return RedumpLanguage.Japanese; + case "kor": + return RedumpLanguage.Korean; + case "nor": + return RedumpLanguage.Norwegian; + case "pol": + return RedumpLanguage.Polish; + case "por": + return RedumpLanguage.Portuguese; + case "pan": + return RedumpLanguage.Punjabi; + case "ron": + return RedumpLanguage.Romanian; + case "rus": + return RedumpLanguage.Russian; + case "slk": + return RedumpLanguage.Slovak; + case "slv": + return RedumpLanguage.Slovenian; + case "spa": + return RedumpLanguage.Spanish; + case "swe": + return RedumpLanguage.Swedish; + case "tam": + return RedumpLanguage.Tamil; + case "tha": + return RedumpLanguage.Thai; + case "tur": + return RedumpLanguage.Turkish; + case "ukr": + return RedumpLanguage.Ukrainian; + default: + return null; + } + } + + /// + /// Get the Region enum value for a given string + /// + /// String value to convert + /// Region represented by the string, if possible + public static RedumpRegion? ToRedumpRegion(string region) + { + switch (region) + { + case "Ar": + return RedumpRegion.Argentina; + case "A": + return RedumpRegion.Asia; + case "A,E": + return RedumpRegion.AsiaEurope; + case "A,U": + return RedumpRegion.AsiaUSA; + case "Au": + return RedumpRegion.Australia; + case "Au,Nz": + return RedumpRegion.AustraliaNewZealand; + case "At": + return RedumpRegion.Austria; + case "At,Ch": + return RedumpRegion.AustriaSwitzerland; + case "Be": + return RedumpRegion.Belgium; + case "Be,N": + return RedumpRegion.BelgiumNetherlands; + case "B": + return RedumpRegion.Brazil; + case "Ca": + return RedumpRegion.Canada; + case "C": + return RedumpRegion.China; + case "Hr": + return RedumpRegion.Croatia; + case "Cz": + return RedumpRegion.Czech; + case "Dk": + return RedumpRegion.Denmark; + case "E": + return RedumpRegion.Europe; + case "E,A": + return RedumpRegion.EuropeAsia; + case "E,Au": + return RedumpRegion.EuropeAustralia; + case "E,Ca": + return RedumpRegion.EuropeCanada; + case "E,G": + return RedumpRegion.EuropeGermany; + case "Fi": + return RedumpRegion.Finland; + case "F": + return RedumpRegion.France; + case "F,S": + return RedumpRegion.FranceSpain; + case "G": + return RedumpRegion.Germany; + case "GC": + return RedumpRegion.GreaterChina; + case "Gr": + return RedumpRegion.Greece; + case "H": + return RedumpRegion.Hungary; + case "In": + return RedumpRegion.India; + case "Ie": + return RedumpRegion.Ireland; + case "Il": + return RedumpRegion.Israel; + case "I": + return RedumpRegion.Italy; + case "J": + return RedumpRegion.Japan; + case "J,A": + return RedumpRegion.JapanAsia; + case "J,E": + return RedumpRegion.JapanEurope; + case "J,K": + return RedumpRegion.JapanKorea; + case "J,U": + return RedumpRegion.JapanUSA; + case "K": + return RedumpRegion.Korea; + case "LAm": + return RedumpRegion.LatinAmerica; + case "N": + return RedumpRegion.Netherlands; + case "No": + return RedumpRegion.Norway; + case "P": + return RedumpRegion.Poland; + case "Pt": + return RedumpRegion.Portugal; + case "Ro": + return RedumpRegion.Romania; + case "R": + return RedumpRegion.Russia; + case "Sca": + return RedumpRegion.Scandinavia; + case "Sg": + return RedumpRegion.Singapore; + case "Sk": + return RedumpRegion.Slovakia; + case "Za": + return RedumpRegion.SouthAfrica; + case "S": + return RedumpRegion.Spain; + case "S,Pt": + return RedumpRegion.SpainPortugal; + case "Sw": + return RedumpRegion.Sweden; + case "Ch": + return RedumpRegion.Switzerland; + case "Tw": + return RedumpRegion.Taiwan; + case "Th": + return RedumpRegion.Thailand; + case "Tr": + return RedumpRegion.Turkey; + case "Ae": + return RedumpRegion.UnitedArabEmirates; + case "Uk": + return RedumpRegion.UK; + case "Uk,Au": + return RedumpRegion.UKAustralia; + case "Ue": + return RedumpRegion.Ukraine; + case "U": + return RedumpRegion.USA; + case "U,A": + return RedumpRegion.USAAsia; + case "U,B": + return RedumpRegion.USABrazil; + case "U,Ca": + return RedumpRegion.USACanada; + case "U,E": + return RedumpRegion.USAEurope; + case "U,G": + return RedumpRegion.USAGermany; + case "U,J": + return RedumpRegion.USAJapan; + case "U,K": + return RedumpRegion.USAKorea; + case "W": + return RedumpRegion.World; + default: + return null; + } + } + /// /// Get the RedumpSystem enum value for a given string /// @@ -3891,158 +4042,6 @@ namespace MPF.Utilities } } - /// - /// Get the Region enum value for a given string - /// - /// String value to convert - /// Region represented by the string, if possible - public static Region? ToRegion(string region) - { - switch (region) - { - case "Ar": - return Region.Argentina; - case "A": - return Region.Asia; - case "A,E": - return Region.AsiaEurope; - case "A,U": - return Region.AsiaUSA; - case "Au": - return Region.Australia; - case "Au,Nz": - return Region.AustraliaNewZealand; - case "At": - return Region.Austria; - case "At,Ch": - return Region.AustriaSwitzerland; - case "Be": - return Region.Belgium; - case "Be,N": - return Region.BelgiumNetherlands; - case "B": - return Region.Brazil; - case "Ca": - return Region.Canada; - case "C": - return Region.China; - case "Hr": - return Region.Croatia; - case "Cz": - return Region.Czech; - case "Dk": - return Region.Denmark; - case "E": - return Region.Europe; - case "E,A": - return Region.EuropeAsia; - case "E,Au": - return Region.EuropeAustralia; - case "E,Ca": - return Region.EuropeCanada; - case "E,G": - return Region.EuropeGermany; - case "Fi": - return Region.Finland; - case "F": - return Region.France; - case "F,S": - return Region.FranceSpain; - case "G": - return Region.Germany; - case "GC": - return Region.GreaterChina; - case "Gr": - return Region.Greece; - case "H": - return Region.Hungary; - case "In": - return Region.India; - case "Ie": - return Region.Ireland; - case "Il": - return Region.Israel; - case "I": - return Region.Italy; - case "J": - return Region.Japan; - case "J,A": - return Region.JapanAsia; - case "J,E": - return Region.JapanEurope; - case "J,K": - return Region.JapanKorea; - case "J,U": - return Region.JapanUSA; - case "K": - return Region.Korea; - case "LAm": - return Region.LatinAmerica; - case "N": - return Region.Netherlands; - case "No": - return Region.Norway; - case "P": - return Region.Poland; - case "Pt": - return Region.Portugal; - case "Ro": - return Region.Romania; - case "R": - return Region.Russia; - case "Sca": - return Region.Scandinavia; - case "Sg": - return Region.Singapore; - case "Sk": - return Region.Slovakia; - case "Za": - return Region.SouthAfrica; - case "S": - return Region.Spain; - case "S,Pt": - return Region.SpainPortugal; - case "Sw": - return Region.Sweden; - case "Ch": - return Region.Switzerland; - case "Tw": - return Region.Taiwan; - case "Th": - return Region.Thailand; - case "Tr": - return Region.Turkey; - case "Ae": - return Region.UnitedArabEmirates; - case "Uk": - return Region.UK; - case "Uk,Au": - return Region.UKAustralia; - case "Ue": - return Region.Ukraine; - case "U": - return Region.USA; - case "U,A": - return Region.USAAsia; - case "U,B": - return Region.USABrazil; - case "U,Ca": - return Region.USACanada; - case "U,E": - return Region.USAEurope; - case "U,G": - return Region.USAGermany; - case "U,J": - return Region.USAJapan; - case "U,K": - return Region.USAKorea; - case "W": - return Region.World; - default: - return null; - } - } - #endregion } @@ -4065,56 +4064,6 @@ namespace MPF.Utilities } } - /// - /// Serialize Language enum values - /// - public class LanguagesConverter : JsonConverter - { - public override bool CanRead { get { return false; } } - - public override Language?[] ReadJson(JsonReader reader, Type objectType, Language?[] existingValue, bool hasExistingValue, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - - public override void WriteJson(JsonWriter writer, Language?[] value, JsonSerializer serializer) - { - JArray array = new JArray(); - foreach (var val in value) - { - JToken t = JToken.FromObject(val.ShortName() ?? string.Empty); - array.Add(t); - } - - array.WriteTo(writer); - } - } - - /// - /// Serialize Language enum values - /// - public class LanguageSelectionConverter : JsonConverter - { - public override bool CanRead { get { return false; } } - - public override LanguageSelection?[] ReadJson(JsonReader reader, Type objectType, LanguageSelection?[] existingValue, bool hasExistingValue, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - - public override void WriteJson(JsonWriter writer, LanguageSelection?[] value, JsonSerializer serializer) - { - JArray array = new JArray(); - foreach (var val in value) - { - JToken t = JToken.FromObject(val.LongName() ?? string.Empty); - array.Add(t); - } - - array.WriteTo(writer); - } - } - /// /// Serialize MediaType enum values /// @@ -4135,18 +4084,68 @@ namespace MPF.Utilities } /// - /// Serialize Region enum values + /// Serialize RedumpLanguage enum values /// - public class RegionConverter : JsonConverter + public class RedumpLanguageConverter : JsonConverter { public override bool CanRead { get { return false; } } - public override Region? ReadJson(JsonReader reader, Type objectType, Region? existingValue, bool hasExistingValue, JsonSerializer serializer) + public override RedumpLanguage?[] ReadJson(JsonReader reader, Type objectType, RedumpLanguage?[] existingValue, bool hasExistingValue, JsonSerializer serializer) { throw new NotImplementedException(); } - public override void WriteJson(JsonWriter writer, Region? value, JsonSerializer serializer) + public override void WriteJson(JsonWriter writer, RedumpLanguage?[] value, JsonSerializer serializer) + { + JArray array = new JArray(); + foreach (var val in value) + { + JToken t = JToken.FromObject(val.ShortName() ?? string.Empty); + array.Add(t); + } + + array.WriteTo(writer); + } + } + + /// + /// Serialize RedumpLanguageSelection enum values + /// + public class RedumpLanguageSelectionConverter : JsonConverter + { + public override bool CanRead { get { return false; } } + + public override RedumpLanguageSelection?[] ReadJson(JsonReader reader, Type objectType, RedumpLanguageSelection?[] existingValue, bool hasExistingValue, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + + public override void WriteJson(JsonWriter writer, RedumpLanguageSelection?[] value, JsonSerializer serializer) + { + JArray array = new JArray(); + foreach (var val in value) + { + JToken t = JToken.FromObject(val.LongName() ?? string.Empty); + array.Add(t); + } + + array.WriteTo(writer); + } + } + + /// + /// Serialize RedumpRegion enum values + /// + public class RedumpRegionConverter : JsonConverter + { + public override bool CanRead { get { return false; } } + + public override RedumpRegion? ReadJson(JsonReader reader, Type objectType, RedumpRegion? existingValue, bool hasExistingValue, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + + public override void WriteJson(JsonWriter writer, RedumpRegion? value, JsonSerializer serializer) { JToken t = JToken.FromObject(value.ShortName() ?? string.Empty); t.WriteTo(writer); diff --git a/MPF.Library/Utilities/DumpEnvironment.cs b/MPF.Library/Utilities/DumpEnvironment.cs index db23beac..dcce3205 100644 --- a/MPF.Library/Utilities/DumpEnvironment.cs +++ b/MPF.Library/Utilities/DumpEnvironment.cs @@ -9,7 +9,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using BurnOutSharp; using MPF.Data; -using MPF.Web; +using MPF.Redump; using Newtonsoft.Json; namespace MPF.Utilities @@ -867,7 +867,7 @@ namespace MPF.Utilities switch (System) { case KnownSystem.AcornArchimedes: - info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.UK; + info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? RedumpRegion.UK; break; case KnownSystem.AppleMacintosh: @@ -886,16 +886,16 @@ namespace MPF.Utilities case KnownSystem.AudioCD: case KnownSystem.DVDAudio: case KnownSystem.SuperAudioCD: - info.CommonDiscInfo.Category = info.CommonDiscInfo.Category ?? DiscCategory.Audio; + info.CommonDiscInfo.Category = info.CommonDiscInfo.Category ?? RedumpDiscCategory.Audio; break; case KnownSystem.BandaiPlaydiaQuickInteractiveSystem: info.CommonDiscInfo.EXEDateBuildDate = (this.AddPlaceholders ? Template.RequiredValue : ""); - info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan; + info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? RedumpRegion.Japan; break; case KnownSystem.BDVideo: - info.CommonDiscInfo.Category = info.CommonDiscInfo.Category ?? DiscCategory.BonusDiscs; + info.CommonDiscInfo.Category = info.CommonDiscInfo.Category ?? RedumpDiscCategory.BonusDiscs; info.CopyProtection.Protection = (AddPlaceholders ? Template.RequiredIfExistsValue : ""); break; @@ -905,25 +905,25 @@ namespace MPF.Utilities case KnownSystem.CommodoreAmigaCD32: info.CommonDiscInfo.EXEDateBuildDate = (this.AddPlaceholders ? Template.RequiredValue : ""); - info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Europe; + info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? RedumpRegion.Europe; break; case KnownSystem.CommodoreAmigaCDTV: info.CommonDiscInfo.EXEDateBuildDate = (this.AddPlaceholders ? Template.RequiredValue : ""); - info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Europe; + info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? RedumpRegion.Europe; break; case KnownSystem.DVDVideo: - info.CommonDiscInfo.Category = info.CommonDiscInfo.Category ?? DiscCategory.BonusDiscs; + info.CommonDiscInfo.Category = info.CommonDiscInfo.Category ?? RedumpDiscCategory.BonusDiscs; break; case KnownSystem.FujitsuFMTowns: info.CommonDiscInfo.EXEDateBuildDate = (this.AddPlaceholders ? Template.RequiredValue : ""); - info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan; + info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? RedumpRegion.Japan; break; case KnownSystem.FujitsuFMTownsMarty: - info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan; + info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? RedumpRegion.Japan; break; case KnownSystem.IncredibleTechnologiesEagle: @@ -960,20 +960,20 @@ namespace MPF.Utilities case KnownSystem.NavisoftNaviken21: info.CommonDiscInfo.EXEDateBuildDate = (this.AddPlaceholders ? Template.RequiredValue : ""); - info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan; + info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? RedumpRegion.Japan; break; case KnownSystem.NECPC88: - info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan; + info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? RedumpRegion.Japan; break; case KnownSystem.NECPC98: info.CommonDiscInfo.EXEDateBuildDate = (this.AddPlaceholders ? Template.RequiredValue : ""); - info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan; + info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? RedumpRegion.Japan; break; case KnownSystem.NECPCFX: - info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan; + info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? RedumpRegion.Japan; break; case KnownSystem.SegaChihiro: @@ -997,7 +997,7 @@ namespace MPF.Utilities break; case KnownSystem.SharpX68000: - info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan; + info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? RedumpRegion.Japan; break; case KnownSystem.SNKNeoGeoCD: @@ -1005,7 +1005,7 @@ namespace MPF.Utilities break; case KnownSystem.SonyPlayStation2: - info.CommonDiscInfo.LanguageSelection = new LanguageSelection?[] { LanguageSelection.BiosSettings, LanguageSelection.LanguageSelector, LanguageSelection.OptionsMenu }; + info.CommonDiscInfo.LanguageSelection = new RedumpLanguageSelection?[] { RedumpLanguageSelection.BiosSettings, RedumpLanguageSelection.LanguageSelector, RedumpLanguageSelection.OptionsMenu }; break; case KnownSystem.SonyPlayStation3: @@ -1014,7 +1014,7 @@ namespace MPF.Utilities break; case KnownSystem.TomyKissSite: - info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan; + info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? RedumpRegion.Japan; break; case KnownSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem: @@ -1023,7 +1023,7 @@ namespace MPF.Utilities } // Set the category if it's not overriden - info.CommonDiscInfo.Category = info.CommonDiscInfo.Category ?? DiscCategory.Games; + info.CommonDiscInfo.Category = info.CommonDiscInfo.Category ?? RedumpDiscCategory.Games; // Comments is one of the few fields with odd handling if (string.IsNullOrEmpty(info.CommonDiscInfo.Comments)) @@ -1056,8 +1056,8 @@ namespace MPF.Utilities AddIfExists(output, Template.CategoryField, info.CommonDiscInfo.Category.LongName(), 1); AddIfExists(output, Template.MatchingIDsField, info.MatchedIDs, 1); AddIfExists(output, Template.RegionField, info.CommonDiscInfo.Region.LongName(), 1); - AddIfExists(output, Template.LanguagesField, (info.CommonDiscInfo.Languages ?? new Language?[] { null }).Select(l => l.LongName()).ToArray(), 1); - AddIfExists(output, Template.PlaystationLanguageSelectionViaField, (info.CommonDiscInfo.LanguageSelection ?? new LanguageSelection?[] { }).Select(l => l.ToString()).ToArray(), 1); + AddIfExists(output, Template.LanguagesField, (info.CommonDiscInfo.Languages ?? new RedumpLanguage?[] { null }).Select(l => l.LongName()).ToArray(), 1); + AddIfExists(output, Template.PlaystationLanguageSelectionViaField, (info.CommonDiscInfo.LanguageSelection ?? new RedumpLanguageSelection?[] { }).Select(l => l.ToString()).ToArray(), 1); AddIfExists(output, Template.DiscSerialField, info.CommonDiscInfo.Serial, 1); // All ringcode information goes in an indented area diff --git a/MPF.Library/Utilities/Tools.cs b/MPF.Library/Utilities/Tools.cs index 084a6660..41b7fcc7 100644 --- a/MPF.Library/Utilities/Tools.cs +++ b/MPF.Library/Utilities/Tools.cs @@ -1,6 +1,6 @@ using System; using System.Reflection; -using MPF.Web; +using MPF.Redump; namespace MPF.Utilities { diff --git a/MPF.Library/Web/Enumerations.cs b/MPF.Library/Web/Enumerations.cs deleted file mode 100644 index e265665e..00000000 --- a/MPF.Library/Web/Enumerations.cs +++ /dev/null @@ -1,250 +0,0 @@ -namespace MPF.Web -{ - /// - /// List of all disc categories - /// - public enum DiscCategory - { - Games = 1, - Demos = 2, - Video = 3, - Audio = 4, - Multimedia = 5, - Applications = 6, - Coverdiscs = 7, - Educational = 8, - BonusDiscs = 9, - Preproduction = 10, - AddOns = 11, - } - - /// - /// Dump status - /// - public enum DumpStatus - { - BadDumpRed = 2, - PossibleBadDumpYellow = 3, - OriginalMediaBlue = 4, - TwoOrMoreDumpsGreen = 5, - } - - /// - /// List of all disc langauges - /// - public enum Language - { - Afrikaans, - Arabic, - Basque, - Bulgarian, - Catalan, - Chinese, - Croatian, - Czech, - Danish, - Dutch, - English, - Finnish, - French, - Gaelic, - German, - Greek, - Hebrew, - Hindi, - Hungarian, - Italian, - Japanese, - Korean, - Norwegian, - Polish, - Portuguese, - Punjabi, - Romanian, - Russian, - Slovak, - Slovenian, - Spanish, - Swedish, - Tamil, - Thai, - Turkish, - Ukrainian, - } - - /// - /// All possible language selections - /// - public enum LanguageSelection - { - BiosSettings, - LanguageSelector, - OptionsMenu, - } - - /// - /// List of all known Redump systems - /// - public enum RedumpSystem - { - // Special BIOS sets - MicrosoftXboxBIOS, - NintendoGameCubeBIOS, - SonyPlayStationBIOS, - SonyPlayStation2BIOS, - - // Regular systems - AcornArchimedes, - AppleMacintosh, - AtariJaguarCDInteractiveMultimediaSystem, - AudioCD, - BandaiPippin, - BandaiPlaydiaQuickInteractiveSystem, - BDVideo, - CommodoreAmigaCD, - CommodoreAmigaCD32, - CommodoreAmigaCDTV, - DVDVideo, - EnhancedCD, - FujitsuFMTownsseries, - funworldPhotoPlay, - HasbroVideoNow, - HasbroVideoNowColor, - HasbroVideoNowJr, - HasbroVideoNowXP, - IBMPCcompatible, - IncredibleTechnologiesEagle, - KonamieAmusement, - KonamiFireBeat, - KonamiM2, - KonamiSystem573, - KonamiSystemGV, - KonamiTwinkle, - MattelFisherPriceiXL, - MattelHyperScan, - MemorexVisualInformationSystem, - MicrosoftXbox, - MicrosoftXbox360, - MicrosoftXboxOne, - MicrosoftXboxSeriesXS, - NamcoSegaNintendoTriforce, - NamcoSystem12, - NamcoSystem246, - NavisoftNaviken21, - NECPCEngineCDTurboGrafxCD, - NECPC88series, - NECPC98series, - NECPCFXPCFXGA, - NintendoGameCube, - NintendoWii, - NintendoWiiU, - PalmOS, - Panasonic3DOInteractiveMultiplayer, - PanasonicM2, - PhilipsCDi, - PhotoCD, - PlayStationGameSharkUpdates, - SegaChihiro, - SegaDreamcast, - SegaLindbergh, - SegaMegaCDSegaCD, - SegaNaomi, - SegaNaomi2, - SegaPrologue21, - SegaRingEdge, - SegaRingEdge2, - SegaSaturn, - SegaTitanVideo, - SharpX68000, - SNKNeoGeoCD, - SonyPlayStation, - SonyPlayStation2, - SonyPlayStation3, - SonyPlayStation4, - SonyPlayStation5, - SonyPlayStationPortable, - TABAustriaQuizard, - TaoiKTV, - TomyKissSite, - VideoCD, - VMLabsNUON, - VTechVFlashVSmilePro, - ZAPiTGamesGameWaveFamilyEntertainmentSystem, - } - - /// - /// List of all known Redump regions - /// - public enum Region - { - Argentina, - Asia, - AsiaEurope, - AsiaUSA, - Australia, - AustraliaNewZealand, - Austria, - AustriaSwitzerland, - Belgium, - BelgiumNetherlands, - Brazil, - Canada, - China, - Croatia, - Czech, - Denmark, - Europe, - EuropeAsia, - EuropeAustralia, - EuropeCanada, - EuropeGermany, - Finland, - France, - FranceSpain, - Germany, - GreaterChina, - Greece, - Hungary, - India, - Ireland, - Israel, - Italy, - Japan, - JapanAsia, - JapanEurope, - JapanKorea, - JapanUSA, - Korea, - LatinAmerica, - Netherlands, - Norway, - Poland, - Portugal, - Romania, - Russia, - Scandinavia, - Singapore, - Slovakia, - SouthAfrica, - Spain, - SpainPortugal, - Sweden, - Switzerland, - Taiwan, - Thailand, - Turkey, - UnitedArabEmirates, - UK, - UKAustralia, - Ukraine, - USA, - USAAsia, - USABrazil, - USACanada, - USAEurope, - USAGermany, - USAJapan, - USAKorea, - World, - } -} diff --git a/MPF/Windows/DiscInformationWindow.xaml.cs b/MPF/Windows/DiscInformationWindow.xaml.cs index 461fac15..0bdd3a94 100644 --- a/MPF/Windows/DiscInformationWindow.xaml.cs +++ b/MPF/Windows/DiscInformationWindow.xaml.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Windows; using MPF.Data; -using MPF.Web; namespace MPF.Windows { @@ -17,7 +16,7 @@ namespace MPF.Windows /// /// List of available disc categories /// - public List> Categories { get; private set; } = Element.GenerateElements().ToList(); + public List> Categories { get; private set; } = Element.GenerateElements().ToList(); /// /// SubmissionInfo object to fill and save @@ -27,17 +26,17 @@ namespace MPF.Windows /// /// List of available regions /// - public List> Regions { get; private set; } = Element.GenerateElements().ToList(); + public List> Regions { get; private set; } = Element.GenerateElements().ToList(); /// /// List of available languages /// - public List> Languages { get; private set; } = Element.GenerateElements().ToList(); + public List> Languages { get; private set; } = Element.GenerateElements().ToList(); /// /// List of available languages /// - public List> LanguageSelections { get; private set; } = Element.GenerateElements().ToList(); + public List> LanguageSelections { get; private set; } = Element.GenerateElements().ToList(); #endregion @@ -239,11 +238,11 @@ namespace MPF.Windows SubmissionInfo.CommonDiscInfo.ForeignTitleNonLatin = ForeignTitle.Text ?? ""; SubmissionInfo.CommonDiscInfo.DiscNumberLetter = DiscNumberLetter.Text ?? ""; SubmissionInfo.CommonDiscInfo.DiscTitle = DiscTitle.Text ?? ""; - SubmissionInfo.CommonDiscInfo.Category = (CategoryComboBox.SelectedItem as Element)?.Value ?? DiscCategory.Games; - SubmissionInfo.CommonDiscInfo.Region = (RegionComboBox.SelectedItem as Element)?.Value ?? Region.World; + SubmissionInfo.CommonDiscInfo.Category = (CategoryComboBox.SelectedItem as Element)?.Value ?? RedumpDiscCategory.Games; + SubmissionInfo.CommonDiscInfo.Region = (RegionComboBox.SelectedItem as Element)?.Value ?? RedumpRegion.World; SubmissionInfo.CommonDiscInfo.Languages = Languages.Where(l => l.IsChecked).Select(l => l?.Value).ToArray(); if (!SubmissionInfo.CommonDiscInfo.Languages.Any()) - SubmissionInfo.CommonDiscInfo.Languages = new Language?[] { null }; + SubmissionInfo.CommonDiscInfo.Languages = new RedumpLanguage?[] { null }; SubmissionInfo.CommonDiscInfo.LanguageSelection = LanguageSelections.Where(ls => ls.IsChecked).Select(ls => ls?.Value).ToArray(); SubmissionInfo.CommonDiscInfo.Serial = Serial.Text ?? ""; SubmissionInfo.CommonDiscInfo.Layer0MasteringRing = L0MasteringRing.Text ?? ""; diff --git a/MPF/Windows/MainWindow.xaml.cs b/MPF/Windows/MainWindow.xaml.cs index 232964e8..b716656d 100644 --- a/MPF/Windows/MainWindow.xaml.cs +++ b/MPF/Windows/MainWindow.xaml.cs @@ -8,7 +8,6 @@ using WinForms = System.Windows.Forms; using BurnOutSharp; using MPF.Data; using MPF.Utilities; -using MPF.Web; namespace MPF.Windows { @@ -769,7 +768,7 @@ namespace MPF.Windows var optionsWindow = new OptionsWindow(); optionsWindow.UIOptions = UIOptions; optionsWindow.Owner = this; - optionsWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; + optionsWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; optionsWindow.Refresh(); optionsWindow.Show(); } diff --git a/MPF/Windows/OptionsWindow.xaml.cs b/MPF/Windows/OptionsWindow.xaml.cs index 97f2b54a..60a7432b 100644 --- a/MPF/Windows/OptionsWindow.xaml.cs +++ b/MPF/Windows/OptionsWindow.xaml.cs @@ -4,8 +4,8 @@ using System.IO; using System.Windows; using System.Windows.Forms; using MPF.Data; +using MPF.Redump; using MPF.Utilities; -using MPF.Web; using Button = System.Windows.Controls.Button; using TextBox = System.Windows.Controls.TextBox;