diff --git a/DICUI.Check/Program.cs b/DICUI.Check/Program.cs index 2e70912a..d87ff7ae 100644 --- a/DICUI.Check/Program.cs +++ b/DICUI.Check/Program.cs @@ -105,10 +105,9 @@ namespace DICUI.Check // If credentials are invalid, alert the user if (!string.IsNullOrWhiteSpace(username) && !string.IsNullOrWhiteSpace(password)) { - using (CookieAwareWebClient wc = new CookieAwareWebClient()) + using (RedumpWebClient wc = new RedumpWebClient()) { - RedumpAccess access = new RedumpAccess(); - if (access.RedumpLogin(wc, username, password)) + if (wc.Login(username, password)) Console.WriteLine("Redump username and password accepted!"); else Console.WriteLine("Redump username and password denied!"); diff --git a/DICUI.Library/Aaru/Parameters.cs b/DICUI.Library/Aaru/Parameters.cs index 83893ce1..9813fcd1 100644 --- a/DICUI.Library/Aaru/Parameters.cs +++ b/DICUI.Library/Aaru/Parameters.cs @@ -7,6 +7,7 @@ using System.Xml; using System.Xml.Schema; using DICUI.Data; using DICUI.Utilities; +using DICUI.Web; namespace DICUI.Aaru { diff --git a/DICUI.Library/CleanRIp/Parameters.cs b/DICUI.Library/CleanRIp/Parameters.cs index 2f119da5..89a1b6e6 100644 --- a/DICUI.Library/CleanRIp/Parameters.cs +++ b/DICUI.Library/CleanRIp/Parameters.cs @@ -1,6 +1,7 @@ using System.IO; using DICUI.Data; using DICUI.Utilities; +using DICUI.Web; namespace DICUI.CleanRip { diff --git a/DICUI.Library/DD/Parameters.cs b/DICUI.Library/DD/Parameters.cs index 3cce6726..6b28543d 100644 --- a/DICUI.Library/DD/Parameters.cs +++ b/DICUI.Library/DD/Parameters.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text.RegularExpressions; using DICUI.Data; using DICUI.Utilities; +using DICUI.Web; namespace DICUI.DD { diff --git a/DICUI.Library/Data/BaseParameters.cs b/DICUI.Library/Data/BaseParameters.cs index 2a6a8467..d3e11398 100644 --- a/DICUI.Library/Data/BaseParameters.cs +++ b/DICUI.Library/Data/BaseParameters.cs @@ -5,6 +5,7 @@ using System.IO; using System.Text.RegularExpressions; using System.Threading.Tasks; using DICUI.Utilities; +using DICUI.Web; namespace DICUI.Data { diff --git a/DICUI.Library/Data/Enumerations.cs b/DICUI.Library/Data/Enumerations.cs index c9c48d75..f715c2b0 100644 --- a/DICUI.Library/Data/Enumerations.cs +++ b/DICUI.Library/Data/Enumerations.cs @@ -2,35 +2,6 @@ namespace DICUI.Data { - /// - /// Category for Redump - /// - 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 for Redump - /// - public enum DumpStatus - { - BadDumpRed = 2, - PossibleBadDumpYellow = 3, - OriginalMediaBlue = 4, - TwoOrMoreDumpsGreen = 5, - } - /// /// Drive type for dumping /// @@ -280,59 +251,6 @@ namespace DICUI.Data Custom }; - /// - /// 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, - } - /// /// Known media types /// @@ -466,166 +384,6 @@ namespace DICUI.Data TapeDSTLarge = 66, } - /// - /// 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, - NamcoSegaNintendoTriforce, - NamcoSystem12, - NamcoSystem246, - NavisoftNaviken21, - NECPCEngineCDTurboGrafxCD, - NECPC88series, - NECPC98series, - NECPCFXPCFXGA, - NintendoGameCube, - NintendoWii, - NintendoWiiU, - PalmOS, - Panasonic3DOInteractiveMultiplayer, - PanasonicM2, - PhilipsCDi, - PhilipsCDiDigitalVideo, - PhotoCD, - PlayStationGameSharkUpdates, - SegaChihiro, - SegaDreamcast, - SegaLindbergh, - SegaMegaCDSegaCD, - SegaNaomi, - SegaNaomi2, - SegaPrologue21, - SegaRingEdge, - SegaRingEdge2, - SegaSaturn, - SegaTitanVideo, - SharpX68000, - SNKNeoGeoCD, - SonyPlayStation, - SonyPlayStation2, - SonyPlayStation3, - SonyPlayStation4, - SonyPlayStationPortable, - TABAustriaQuizard, - TaoiKTV, - TomyKissSite, - VideoCD, - VMLabsNUON, - VTechVFlashVSmilePro, - ZAPiTGamesGameWaveFamilyEntertainmentSystem, - } - - /// - /// List of all known Redump regions - /// - public enum Region - { - Argentina, - Asia, - AsiaEurope, - AsiaUSA, - Australia, - Austria, - AustriaSwitzerland, - Belgium, - BelgiumNetherlands, - Brazil, - Canada, - China, - Croatia, - Czech, - Denmark, - Europe, - EuropeAsia, - EuropeAustralia, - Finland, - France, - FranceSpain, - Germany, - GreaterChina, - Greece, - Hungary, - India, - Ireland, - Israel, - Italy, - Japan, - JapanAsia, - JapanEurope, - JapanKorea, - JapanUSA, - Korea, - LatinAmerica, - Netherlands, - Norway, - Poland, - Portugal, - Russia, - Scandinavia, - Singapore, - Slovakia, - SouthAfrica, - Spain, - SpainPortugal, - Sweden, - Switzerland, - Taiwan, - Thailand, - Turkey, - UnitedArabEmirates, - UK, - UKAustralia, - Ukraine, - USA, - USAAsia, - USABrazil, - USACanada, - USAEurope, - USAGermany, - USAJapan, - World, - } - /// /// Generic yes/no values for Redump /// diff --git a/DICUI.Library/Data/SubmissionInfo.cs b/DICUI.Library/Data/SubmissionInfo.cs index b6f78003..fe0f98ee 100644 --- a/DICUI.Library/Data/SubmissionInfo.cs +++ b/DICUI.Library/Data/SubmissionInfo.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text.RegularExpressions; using System.Net; using DICUI.Utilities; +using DICUI.Web; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Serialization; @@ -146,14 +147,14 @@ namespace DICUI.Data // Category match = categoryRegex.Match(discData); if (match.Success) - this.CommonDiscInfo.Category = Converters.ToCategory(match.Groups[1].Value); + this.CommonDiscInfo.Category = Web.Extensions.ToCategory(match.Groups[1].Value); else - this.CommonDiscInfo.Category = Data.DiscCategory.Games; + this.CommonDiscInfo.Category = DiscCategory.Games; // Region match = regionRegex.Match(discData); if (match.Success) - this.CommonDiscInfo.Region = Converters.ToRegion(match.Groups[1].Value); + this.CommonDiscInfo.Region = Web.Extensions.ToRegion(match.Groups[1].Value); // Languages var matches = languagesRegex.Matches(discData); @@ -161,7 +162,7 @@ namespace DICUI.Data { List tempLanguages = new List(); foreach (Match submatch in matches) - tempLanguages.Add(Converters.ToLanguage(submatch.Groups[1].Value)); + tempLanguages.Add(Web.Extensions.ToLanguage(submatch.Groups[1].Value)); this.CommonDiscInfo.Languages = tempLanguages.ToArray(); } diff --git a/DICUI.Library/DiscImageCreator/Parameters.cs b/DICUI.Library/DiscImageCreator/Parameters.cs index d992c804..eb53520e 100644 --- a/DICUI.Library/DiscImageCreator/Parameters.cs +++ b/DICUI.Library/DiscImageCreator/Parameters.cs @@ -6,6 +6,7 @@ using System.Text.RegularExpressions; using BurnOutSharp.External.psxt001z; using DICUI.Data; using DICUI.Utilities; +using DICUI.Web; namespace DICUI.DiscImageCreator { diff --git a/DICUI.Library/Utilities/Converters.cs b/DICUI.Library/Utilities/Converters.cs index 0ef7e23e..e6db681c 100644 --- a/DICUI.Library/Utilities/Converters.cs +++ b/DICUI.Library/Utilities/Converters.cs @@ -1,6 +1,7 @@ using System; using System.IO; using DICUI.Data; +using DICUI.Web; #if NET_FRAMEWORK using IMAPI2; #endif @@ -455,42 +456,6 @@ namespace DICUI.Utilities #region Convert to Long Name - /// - /// Get the string representation of the Category enum values - /// - /// Category value to convert - /// Short 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 /// @@ -817,112 +782,6 @@ namespace DICUI.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? lang) - { - switch (lang) - { - 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)"; - } - } - - /// - /// 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 /// @@ -1013,323 +872,6 @@ namespace DICUI.Utilities } } - /// - /// Get the Redump longnames for each known system - /// - /// - /// - public static string LongName(this RedumpSystem system) - { - switch (system) - { - // Special BIOS sets - case RedumpSystem.MicrosoftXboxBIOS: - return "Microsoft Xbox (BIOS)"; - case RedumpSystem.NintendoGameCubeBIOS: - return "Nintendo GameCube (BIOS)"; - case RedumpSystem.SonyPlayStationBIOS: - return "Sony PlayStation (BIOS)"; - case RedumpSystem.SonyPlayStation2BIOS: - return "Sony PlayStation 2 (BIOS)"; - - // Regular systems - case RedumpSystem.AcornArchimedes: - return "Acorn Archimedes"; - case RedumpSystem.AppleMacintosh: - return "Apple Macintosh"; - case RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem: - return "Atari Jaguar CD Interactive Multimedia System"; - case RedumpSystem.AudioCD: - return "Audio CD"; - case RedumpSystem.BandaiPippin: - return "Bandai Pippin"; - case RedumpSystem.BandaiPlaydiaQuickInteractiveSystem: - return "Bandai Playdia Quick Interactive System"; - case RedumpSystem.BDVideo: - return "BD-Video"; - case RedumpSystem.CommodoreAmigaCD: - return "Commodore Amiga CD"; - case RedumpSystem.CommodoreAmigaCD32: - return "Commodore Amiga CD32"; - case RedumpSystem.CommodoreAmigaCDTV: - return "Commodore Amiga CDTV"; - case RedumpSystem.DVDVideo: - return "DVD-Video"; - case RedumpSystem.EnhancedCD: - return "Enhanced CD"; - case RedumpSystem.FujitsuFMTownsseries: - return "Fujitsu FM Towns series"; - case RedumpSystem.funworldPhotoPlay: - return "funworld Photo Play"; - case RedumpSystem.HasbroVideoNow: - return "Hasbro VideoNow"; - case RedumpSystem.HasbroVideoNowColor: - return "Hasbro VideoNow Color"; - case RedumpSystem.HasbroVideoNowJr: - return "Hasbro VideoNow Jr."; - case RedumpSystem.HasbroVideoNowXP: - return "Hasbro VideoNow XP"; - case RedumpSystem.IBMPCcompatible: - return "IBM PC compatible"; - case RedumpSystem.IncredibleTechnologiesEagle: - return "Incredible Technologies Eagle"; - case RedumpSystem.KonamieAmusement: - return "Konami e-Amusement"; - case RedumpSystem.KonamiFireBeat: - return "Konami FireBeat"; - case RedumpSystem.KonamiM2: - return "Konami M2"; - case RedumpSystem.KonamiSystem573: - return "Konami System 573"; - case RedumpSystem.KonamiSystemGV: - return "Konami System GV"; - case RedumpSystem.KonamiTwinkle: - return "Konami Twinkle"; - case RedumpSystem.MattelFisherPriceiXL: - return "Mattel Fisher-Price iXL"; - case RedumpSystem.MattelHyperScan: - return "Mattel HyperScan"; - case RedumpSystem.MemorexVisualInformationSystem: - return "Memorex Visual Information System"; - case RedumpSystem.MicrosoftXbox: - return "Microsoft Xbox"; - case RedumpSystem.MicrosoftXbox360: - return "Microsoft Xbox 360"; - case RedumpSystem.MicrosoftXboxOne: - return "Microsoft Xbox One"; - case RedumpSystem.NamcoSegaNintendoTriforce: - return "Namco · Sega · Nintendo Triforce"; - case RedumpSystem.NamcoSystem12: - return "Namco System 12"; - case RedumpSystem.NamcoSystem246: - return "Namco System 246"; - case RedumpSystem.NavisoftNaviken21: - return "Navisoft Naviken 2.1"; - case RedumpSystem.NECPCEngineCDTurboGrafxCD: - return "NEC PC Engine CD & TurboGrafx CD"; - case RedumpSystem.NECPC88series: - return "NEC PC-88 series"; - case RedumpSystem.NECPC98series: - return "NEC PC-98 series"; - case RedumpSystem.NECPCFXPCFXGA: - return "NEC PC-FX & PC-FXGA"; - case RedumpSystem.NintendoGameCube: - return "Nintendo GameCube"; - case RedumpSystem.NintendoWii: - return "Nintendo Wii"; - case RedumpSystem.NintendoWiiU: - return "Nintendo Wii U"; - case RedumpSystem.PalmOS: - return "Palm OS"; - case RedumpSystem.Panasonic3DOInteractiveMultiplayer: - return "Panasonic 3DO Interactive Multiplayer"; - case RedumpSystem.PanasonicM2: - return "Panasonic M2"; - case RedumpSystem.PhilipsCDi: - return "Philips CD-i"; - case RedumpSystem.PhilipsCDiDigitalVideo: - return "Philips CD-i Digital Video"; - case RedumpSystem.PhotoCD: - return "Photo CD"; - case RedumpSystem.PlayStationGameSharkUpdates: - return "PlayStation GameShark Updates"; - case RedumpSystem.SegaChihiro: - return "Sega Chihiro"; - case RedumpSystem.SegaDreamcast: - return "Sega Dreamcast"; - case RedumpSystem.SegaLindbergh: - return "Sega Lindbergh"; - case RedumpSystem.SegaMegaCDSegaCD: - return "Sega Mega CD & Sega CD"; - case RedumpSystem.SegaNaomi: - return "Sega Naomi"; - case RedumpSystem.SegaNaomi2: - return "Sega Naomi 2"; - case RedumpSystem.SegaPrologue21: - return "Prologue 21"; - case RedumpSystem.SegaRingEdge: - return "Sega RingEdge"; - case RedumpSystem.SegaRingEdge2: - return "Sega RingEdge 2"; - case RedumpSystem.SegaSaturn: - return "Sega Saturn"; - case RedumpSystem.SegaTitanVideo: - return "Sega Titan Video"; - case RedumpSystem.SharpX68000: - return "Sharp X68000"; - case RedumpSystem.SNKNeoGeoCD: - return "Neo Geo CD"; - case RedumpSystem.SonyPlayStation: - return "Sony PlayStation"; - case RedumpSystem.SonyPlayStation2: - return "Sony PlayStation 2"; - case RedumpSystem.SonyPlayStation3: - return "Sony PlayStation 3"; - case RedumpSystem.SonyPlayStation4: - return "Sony PlayStation 4"; - case RedumpSystem.SonyPlayStationPortable: - return "Sony PlayStation Portable"; - case RedumpSystem.TABAustriaQuizard: - return "TAB-Austria Quizard"; - case RedumpSystem.TaoiKTV: - return "Tao iKTV"; - case RedumpSystem.TomyKissSite: - return "Tomy Kiss-Site"; - case RedumpSystem.VideoCD: - return "Video CD"; - case RedumpSystem.VMLabsNUON: - return "VM Labs NUON"; - case RedumpSystem.VTechVFlashVSmilePro: - return "VTech V.Flash & V.Smile Pro"; - case RedumpSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem: - return "ZAPiT Games Game Wave Family Entertainment System"; - default: - return null; - } - } - - /// - /// 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.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.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.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.World: - return "World"; - default: - return "World (CHANGE THIS)"; - } - } - /// /// Get the string representation of the YesNo enum values /// @@ -1620,92 +1162,6 @@ namespace DICUI.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? lang) - { - switch (lang) - { - 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 "unk"; - } - } - /// /// Get the short string representation of the MediaType enum values /// @@ -1796,365 +1252,10 @@ namespace DICUI.Utilities } } - /// - /// Get the Redump shortnames for each known system - /// - /// - /// - public static string ShortName(this RedumpSystem system) - { - switch (system) - { - // Special BIOS sets - case RedumpSystem.MicrosoftXboxBIOS: - return "xbox-bios"; - case RedumpSystem.NintendoGameCubeBIOS: - return "gc-bios"; - case RedumpSystem.SonyPlayStationBIOS: - return "psx-bios"; - case RedumpSystem.SonyPlayStation2BIOS: - return "ps2-bios"; - - // Regular systems - case RedumpSystem.AcornArchimedes: - return "archcd"; - case RedumpSystem.AppleMacintosh: - return "mac"; - case RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem: - return "ajcd"; - case RedumpSystem.AudioCD: - return "audio-cd"; - case RedumpSystem.BandaiPippin: - return "pippin"; - case RedumpSystem.BandaiPlaydiaQuickInteractiveSystem: - return "qis"; - case RedumpSystem.BDVideo: - return "bd-video"; - case RedumpSystem.CommodoreAmigaCD: - return "acd"; - case RedumpSystem.CommodoreAmigaCD32: - return "cd32"; - case RedumpSystem.CommodoreAmigaCDTV: - return "cdtv"; - case RedumpSystem.DVDVideo: - return "dvd-video"; - case RedumpSystem.EnhancedCD: - return "enhanced-cd"; - case RedumpSystem.FujitsuFMTownsseries: - return "fmt"; - case RedumpSystem.funworldPhotoPlay: - return "fpp"; - case RedumpSystem.HasbroVideoNow: - return "hvn"; - case RedumpSystem.HasbroVideoNowColor: - return "hvnc"; - case RedumpSystem.HasbroVideoNowJr: - return "hvnjr"; - case RedumpSystem.HasbroVideoNowXP: - return "hvnxp"; - case RedumpSystem.IBMPCcompatible: - return "pc"; - case RedumpSystem.IncredibleTechnologiesEagle: - return "ite"; - case RedumpSystem.KonamieAmusement: - return "kea"; - case RedumpSystem.KonamiFireBeat: - return "kfb"; - case RedumpSystem.KonamiM2: - return "km2"; - case RedumpSystem.KonamiSystem573: - return "ks573"; - case RedumpSystem.KonamiSystemGV: - return "ksgv"; - case RedumpSystem.KonamiTwinkle: - return "kt"; - case RedumpSystem.MattelFisherPriceiXL: - return "ixl"; - case RedumpSystem.MattelHyperScan: - return "hs"; - case RedumpSystem.MemorexVisualInformationSystem: - return "vis"; - case RedumpSystem.MicrosoftXbox: - return "xbox"; - case RedumpSystem.MicrosoftXbox360: - return "xbox360"; - case RedumpSystem.MicrosoftXboxOne: - return "xboxone"; - case RedumpSystem.NamcoSegaNintendoTriforce: - return "triforce"; - case RedumpSystem.NamcoSystem12: - return "ns12"; - case RedumpSystem.NamcoSystem246: - return "ns246"; - case RedumpSystem.NavisoftNaviken21: - return "navi21"; - case RedumpSystem.NECPCEngineCDTurboGrafxCD: - return "pce"; - case RedumpSystem.NECPC88series: - return "pc-88"; - case RedumpSystem.NECPC98series: - return "pc-98"; - case RedumpSystem.NECPCFXPCFXGA: - return "pc-fx"; - case RedumpSystem.NintendoGameCube: - return "gc"; - case RedumpSystem.NintendoWii: - return "wii"; - case RedumpSystem.NintendoWiiU: - return "wiiu"; - case RedumpSystem.PalmOS: - return "palm"; - case RedumpSystem.Panasonic3DOInteractiveMultiplayer: - return "3do"; - case RedumpSystem.PanasonicM2: - return "m2"; - case RedumpSystem.PhilipsCDi: - return "cdi"; - case RedumpSystem.PhilipsCDiDigitalVideo: - return "cdi-video"; - case RedumpSystem.PhotoCD: - return "photo-cd"; - case RedumpSystem.PlayStationGameSharkUpdates: - return "psxgs"; - case RedumpSystem.SegaChihiro: - return "chihiro"; - case RedumpSystem.SegaDreamcast: - return "dc"; - case RedumpSystem.SegaLindbergh: - return "lindbergh"; - case RedumpSystem.SegaMegaCDSegaCD: - return "mcd"; - case RedumpSystem.SegaNaomi: - return "naomi"; - case RedumpSystem.SegaNaomi2: - return "naomi2"; - case RedumpSystem.SegaPrologue21: - return "pl21"; - case RedumpSystem.SegaRingEdge: - return "sre"; - case RedumpSystem.SegaRingEdge2: - return "sre2"; - case RedumpSystem.SegaSaturn: - return "ss"; - case RedumpSystem.SegaTitanVideo: - return "stv"; - case RedumpSystem.SharpX68000: - return "x86kcd"; - case RedumpSystem.SNKNeoGeoCD: - return "ngcd"; - case RedumpSystem.SonyPlayStation: - return "psx"; - case RedumpSystem.SonyPlayStation2: - return "ps2"; - case RedumpSystem.SonyPlayStation3: - return "ps3"; - case RedumpSystem.SonyPlayStation4: - return "ps4"; - case RedumpSystem.SonyPlayStationPortable: - return "psp"; - case RedumpSystem.TABAustriaQuizard: - return "quizard"; - case RedumpSystem.TaoiKTV: - return "iktv"; - case RedumpSystem.TomyKissSite: - return "ksite"; - case RedumpSystem.VideoCD: - return "vcd"; - case RedumpSystem.VMLabsNUON: - return "nuon"; - case RedumpSystem.VTechVFlashVSmilePro: - return "vflash"; - case RedumpSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem: - return "gamewave"; - 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 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.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.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.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.World: - return "W"; - default: - return null; - } - } - #endregion #region Convert From String - /// - /// Get the Category enum value for a given string - /// - /// String value to convert - /// Category represented by the string, if possible - public static DiscCategory ToCategory(string category) - { - switch (category.ToLowerInvariant()) - { - case "games": - return DiscCategory.Games; - case "demos": - return DiscCategory.Demos; - case "video": - return DiscCategory.Video; - case "audio": - return DiscCategory.Audio; - case "multimedia": - return DiscCategory.Multimedia; - case "applications": - return DiscCategory.Applications; - case "coverdiscs": - return DiscCategory.Coverdiscs; - case "educational": - return DiscCategory.Educational; - case "bonusdiscs": - case "bonus discs": - return DiscCategory.BonusDiscs; - case "preproduction": - return DiscCategory.Preproduction; - case "addons": - case "add-ons": - return DiscCategory.AddOns; - default: - return DiscCategory.Games; - } - } - /// /// Get the InternalProgram enum value for a given string /// @@ -2930,92 +2031,6 @@ namespace DICUI.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 /// @@ -3189,685 +2204,6 @@ namespace DICUI.Utilities } } - /// - /// Get the RedumpSystem enum value for a given string - /// - /// String value to convert - /// RedumpSystem represented by the string, if possible - public static RedumpSystem? ToRedumpSystem(string sys) - { - switch (sys) - { - // Special BIOS Sets - case "xboxbios": - case "xbox bios": - case "microsoftxboxbios": - case "microsoftxbox bios": - case "microsoft xbox bios": - return RedumpSystem.MicrosoftXboxBIOS; - case "gcbios": - case "gc bios": - case "gamecubebios": - case "ngcbios": - case "ngc bios": - case "nintendogamecubebios": - case "nintendo gamecube bios": - return RedumpSystem.NintendoGameCubeBIOS; - case "ps1bios": - case "ps1 bios": - case "psxbios": - case "psx bios": - case "playstationbios": - case "playstation bios": - case "sonyps1bios": - case "sonyps1 bios": - case "sony ps1 bios": - case "sonypsxbios": - case "sonypsx bios": - case "sony psx bios": - case "sonyplaystationbios": - case "sonyplaystation bios": - case "sony playstation bios": - return RedumpSystem.SonyPlayStationBIOS; - case "ps2bios": - case "ps2 bios": - case "playstation2bios": - case "playstation2 bios": - case "playstation 2 bios": - case "sonyps2bios": - case "sonyps2 bios": - case "sony ps2 bios": - case "sonyplaystation2bios": - case "sonyplaystation2 bios": - case "sony playstation 2 bios": - return RedumpSystem.SonyPlayStation2BIOS; - - // Regular systems - case "acorn": - case "archimedes": - case "acornarchimedes": - case "acorn archimedes": - return RedumpSystem.AcornArchimedes; - case "apple": - case "mac": - case "applemac": - case "macintosh": - case "applemacintosh": - case "apple mac": - case "apple macintosh": - return RedumpSystem.AppleMacintosh; - case "jaguar": - case "jagcd": - case "jaguarcd": - case "jaguar cd": - case "atarijaguar": - case "atarijagcd": - case "atarijaguarcd": - case "atari jaguar cd": - return RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem; - case "audio": - case "audiocd": - case "audio cd": - return RedumpSystem.AudioCD; - case "playdia": - case "playdiaqis": - case "playdiaquickinteractivesystem": - case "bandaiplaydia": - case "bandaiplaydiaquickinteractivesystem": - case "bandai playdia quick interactive system": - return RedumpSystem.BandaiPlaydiaQuickInteractiveSystem; - case "pippin": - case "bandaipippin": - case "bandai pippin": - case "applepippin": - case "apple pippin": - case "bandaiapplepippin": - case "bandai apple pippin": - case "bandai / apple pippin": - return RedumpSystem.BandaiPippin; - case "bdvideo": - case "bd-video": - case "blurayvideo": - case "bluray video": - return RedumpSystem.BDVideo; - case "amiga": - case "amigacd": - case "amiga cd": - case "commodoreamiga": - case "commodoreamigacd": - case "commodoreamiga cd": - case "commodore amiga": - case "commodore amiga cd": - return RedumpSystem.CommodoreAmigaCD; - case "cd32": - case "amigacd32": - case "amiga cd32": - case "commodoreamigacd32": - case "commodore amiga cd32": - return RedumpSystem.CommodoreAmigaCD32; - case "cdtv": - case "amigacdtv": - case "amiga cdtv": - case "commodoreamigacdtv": - case "commodore amiga cdtv": - return RedumpSystem.CommodoreAmigaCDTV; - case "dvdvideo": - case "dvd-video": - return RedumpSystem.DVDVideo; - case "enhancedcd": - case "enhanced cd": - case "enhancedcdrom": - case "enhanced cdrom": - case "enhanced cd-rom": - return RedumpSystem.EnhancedCD; - case "fmtowns": - case "fmt": - case "fm towns": - case "fujitsufmtowns": - case "fujitsu fm towns": - case "fujitsu fm towns series": - return RedumpSystem.FujitsuFMTownsseries; - case "fpp": - case "funworldphotoplay": - case "funworld photoplay": - case "funworld photo play": - return RedumpSystem.funworldPhotoPlay; - case "videonow": - case "hasbrovideonow": - case "hasbro videonow": - return RedumpSystem.HasbroVideoNow; - case "videonowcolor": - case "videonow color": - case "hasbrovideonowcolor": - case "hasbro videonow color": - return RedumpSystem.HasbroVideoNowColor; - case "videonowjr": - case "videonow jr": - case "hasbrovideonowjr": - case "hasbro videonow jr": - return RedumpSystem.HasbroVideoNowColor; - case "videonowxp": - case "videonow xp": - case "hasbrovideonowxp": - case "hasbro videonow xp": - return RedumpSystem.HasbroVideoNowColor; - case "ibm": - case "ibmpc": - case "pc": - case "ibm pc": - case "ibm pc compatible": - return RedumpSystem.IBMPCcompatible; - case "iteagle": - case "eagle": - case "incredible technologies eagle": - return RedumpSystem.IncredibleTechnologiesEagle; - case "eamusement": - case "e-amusement": - case "konamieamusement": - case "konami eamusement": - case "konamie-amusement": - case "konami e-amusement": - return RedumpSystem.KonamieAmusement; - case "firebeat": - case "konamifirebeat": - case "konami firebeat": - return RedumpSystem.KonamiFireBeat; - case "konamim2": - case "konami m2": - return RedumpSystem.KonamiM2; - case "system573": - case "system 573": - case "konamisystem573": - case "konami system 573": - return RedumpSystem.KonamiSystem573; - case "gvsystem": - case "systemgv": - case "gv system": - case "system gv": - case "konamigvsystem": - case "konamisystemgv": - case "konami gv system": - case "konami system gv": - return RedumpSystem.KonamiSystemGV; - case "twinkle": - case "konamitwinkle": - case "konami twinkle": - return RedumpSystem.KonamiTwinkle; - case "ixl": - case "mattelixl": - case "mattel ixl": - case "fisherpriceixl": - case "fisher price ixl": - case "fisher-price ixl": - case "fisherprice ixl": - case "mattelfisherpriceixl": - case "mattel fisher price ixl": - case "mattelfisherprice ixl": - case "mattel fisherprice ixl": - case "mattel fisher-price ixl": - return RedumpSystem.MattelFisherPriceiXL; - case "hyperscan": - case "mattelhyperscan": - case "mattel hyperscan": - return RedumpSystem.MattelHyperScan; - case "vis": - case "tandyvis": - case "tandy vis": - case "tandyvisualinformationsystem": - case "tandy visual information system": - case "memorexvis": - case "memorex vis": - case "memorexvisualinformationsystem": - case "memorex visual information sytem": - case "tandy / memorex visual information system": - return RedumpSystem.MemorexVisualInformationSystem; - case "xbox": - case "microsoftxbox": - case "microsoft xbox": - return RedumpSystem.MicrosoftXbox; - case "x360": - case "xbox360": - case "microsoftx360": - case "microsoftxbox360": - case "microsoft x360": - case "microsoft xbox 360": - return RedumpSystem.MicrosoftXbox360; - case "xb1": - case "xbone": - case "xboxone": - case "microsoftxbone": - case "microsoftxboxone": - case "microsoft xbone": - case "microsoft xbox one": - return RedumpSystem.MicrosoftXboxOne; - case "triforce": - case "namcotriforce": - case "namco triforce": - case "segatriforce": - case "sega triforce": - case "nintendotriforce": - case "nintendo triforce": - case "namco / sega / nintendo triforce": - return RedumpSystem.NamcoSegaNintendoTriforce; - case "system12": - case "system 12": - case "namcosystem12": - case "namco system 12": - return RedumpSystem.NamcoSystem12; - case "system246": - case "system 246": - case "namcosystem246": - case "namco system 246": - case "capcomsystem246": - case "capcom system 246": - case "taitosystem246": - case "taito system 246": - case "namco / capcom / taito system 246": - return RedumpSystem.NamcoSystem246; - case "naviken": - case "naviken21": - case "naviken 2.1": - case "navisoftnaviken": - case "navisoft naviken": - case "navisoftnaviken21": - case "navisoft naviken 2.1": - return RedumpSystem.NavisoftNaviken21; - case "pcecd": - case "pce-cd": - case "tgcd": - case "tg-cd": - case "necpcecd": - case "nectgcd": - case "nec pc-engine cd": - case "nec turbografx cd": - case "nec pc-engine / turbografx cd": - return RedumpSystem.NECPCEngineCDTurboGrafxCD; - case "pc88": - case "pc-88": - case "necpc88": - case "nec pc88": - case "nec pc-88": - return RedumpSystem.NECPC88series; - case "pc98": - case "pc-98": - case "necpc98": - case "nec pc98": - case "nec pc-98": - return RedumpSystem.NECPC98series; - case "pcfx": - case "pc-fx": - case "pcfxga": - case "pc-fxga": - case "necpcfx": - case "necpcfxga": - case "nec pc-fx": - case "nec pc-fxga": - case "nec pc-fx / pc-fxga": - return RedumpSystem.NECPCFXPCFXGA; - case "gc": - case "gamecube": - case "ngc": - case "nintendogamecube": - case "nintendo gamecube": - return RedumpSystem.NintendoGameCube; - case "wii": - case "nintendowii": - case "nintendo wii": - return RedumpSystem.NintendoWii; - case "wiiu": - case "wii u": - case "nintendowiiu": - case "nintendo wii u": - return RedumpSystem.NintendoWiiU; - case "palm": - case "palmos": - return RedumpSystem.PalmOS; - case "3do": - case "3do interactive multiplayer": - case "panasonic3do": - case "panasonic 3do": - case "panasonic 3do interactive multiplayer": - return RedumpSystem.Panasonic3DOInteractiveMultiplayer; - case "panasonicm2": - case "panasonic m2": - return RedumpSystem.PanasonicM2; - case "cdi": - case "cd-i": - case "philipscdi": - case "philips cdi": - case "philips cd-i": - return RedumpSystem.PhilipsCDi; - case "cdidv": - case "cdidigitalvideo": - case "cdi digital video": - case "cd-i digital video": - case "philipscdidigitalvideo": - case "philips cdi digital video": - case "philips cd-i digital video": - return RedumpSystem.PhilipsCDiDigitalVideo; - case "photo": - case "photocd": - case "photo cd": - return RedumpSystem.PhotoCD; - case "gameshark": - case "psgameshark": - case "ps gameshark": - case "playstationgameshark": - case "playstation gameshark": - case "playstation gameshark updates": - return RedumpSystem.PlayStationGameSharkUpdates; - case "chihiro": - case "segachihiro": - case "sega chihiro": - return RedumpSystem.SegaChihiro; - case "dc": - case "sdc": - case "dreamcast": - case "segadreamcast": - case "sega dreamcast": - return RedumpSystem.SegaDreamcast; - case "lindbergh": - case "segalindbergh": - case "sega lindbergh": - return RedumpSystem.SegaLindbergh; - case "scd": - case "mcd": - case "smcd": - case "segacd": - case "megacd": - case "segamegacd": - case "sega cd": - case "mega cd": - case "sega cd / mega cd": - return RedumpSystem.SegaMegaCDSegaCD; - case "naomi": - case "seganaomi": - case "sega naomi": - return RedumpSystem.SegaNaomi; - case "naomi2": - case "naomi 2": - case "seganaomi2": - case "sega naomi 2": - return RedumpSystem.SegaNaomi2; - case "pl21": - case "prologue21": - case "prologue 21": - case "segaprologue21": - case "sega prologue21": - case "sega prologue 21": - return RedumpSystem.SegaPrologue21; - case "ringedge": - case "segaringedge": - case "sega ringedge": - return RedumpSystem.SegaRingEdge; - case "ringedge2": - case "ringedge 2": - case "segaringedge2": - case "sega ringedge 2": - return RedumpSystem.SegaRingEdge2; - case "saturn": - case "segasaturn": - case "sega saturn": - return RedumpSystem.SegaSaturn; - case "stv": - case "titanvideo": - case "titan video": - case "segatitanvideo": - case "sega titan video": - return RedumpSystem.SegaTitanVideo; - case "x68k": - case "x68000": - case "sharpx68k": - case "sharp x68k": - case "sharpx68000": - case "sharp x68000": - return RedumpSystem.SharpX68000; - case "ngcd": - case "neogeocd": - case "neogeo cd": - case "neo geo cd": - case "snk ngcd": - case "snk neogeo cd": - case "snk neo geo cd": - return RedumpSystem.SNKNeoGeoCD; - case "ps1": - case "psx": - case "playstation": - case "sonyps1": - case "sony ps1": - case "sonypsx": - case "sony psx": - case "sonyplaystation": - case "sony playstation": - return RedumpSystem.SonyPlayStation; - case "ps2": - case "playstation2": - case "playstation 2": - case "sonyps2": - case "sony ps2": - case "sonyplaystation2": - case "sony playstation 2": - return RedumpSystem.SonyPlayStation2; - case "ps3": - case "playstation3": - case "playstation 3": - case "sonyps3": - case "sony ps3": - case "sonyplaystation3": - case "sony playstation 3": - return RedumpSystem.SonyPlayStation3; - case "ps4": - case "playstation4": - case "playstation 4": - case "sonyps4": - case "sony ps4": - case "sonyplaystation4": - case "sony playstation 4": - return RedumpSystem.SonyPlayStation4; - case "psp": - case "playstationportable": - case "playstation portable": - case "sonypsp": - case "sony psp": - case "sonyplaystationportable": - case "sony playstation portable": - return RedumpSystem.SonyPlayStationPortable; - case "quizard": - case "tabaustriaquizard": - case "tab-austria quizard": - return RedumpSystem.TABAustriaQuizard; - case "iktv": - case "taoiktv": - case "tao iktv": - return RedumpSystem.TaoiKTV; - case "kisssite": - case "kiss-site": - case "tomykisssite": - case "tomy kisssite": - case "tomy kiss-site": - return RedumpSystem.TomyKissSite; - case "vcd": - case "videocd": - case "video cd": - return RedumpSystem.VideoCD; - case "nuon": - case "vmlabsnuon": - case "vm labs nuon": - return RedumpSystem.VMLabsNUON; - case "vflash": - case "vsmile": - case "vsmilepro": - case "vsmile pro": - case "v.flash": - case "v.smile": - case "v.smilepro": - case "v.smile pro": - case "vtechvflash": - case "vtech vflash": - case "vtech v.flash": - case "vtechvsmile": - case "vtech vsmile": - case "vtech v.smile": - case "vtechvsmilepro": - case "vtech vsmile pro": - case "vtech v.smile pro": - case "vtech v.flash - v.smile pro": - return RedumpSystem.VTechVFlashVSmilePro; - case "gamewave": - case "game wave": - case "zapit": - case "zapitgamewave": - case "zapit game wave": - case "zapit games game wave family entertainment system": - return RedumpSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem; - - 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 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 "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 "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 "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 "W": - return Region.World; - default: - return null; - } - } - #endregion } @@ -3885,7 +2221,7 @@ namespace DICUI.Utilities public override void WriteJson(JsonWriter writer, KnownSystem? value, JsonSerializer serializer) { - JToken t = JToken.FromObject(value.ToRedumpSystem()?.ShortName() ?? value.ShortName()); + JToken t = JToken.FromObject(value.ToRedumpSystem().ShortName() ?? value.ShortName()); t.WriteTo(writer); } } diff --git a/DICUI.Library/Utilities/DumpEnvironment.cs b/DICUI.Library/Utilities/DumpEnvironment.cs index 4ed4a803..401289f4 100644 --- a/DICUI.Library/Utilities/DumpEnvironment.cs +++ b/DICUI.Library/Utilities/DumpEnvironment.cs @@ -688,11 +688,10 @@ namespace DICUI.Utilities info.DumpersAndStatus.Dumpers = new string[] { this.Username }; info.MatchedIDs = new List(); - using (CookieAwareWebClient wc = new CookieAwareWebClient()) + using (RedumpWebClient wc = new RedumpWebClient()) { // Login to Redump - RedumpAccess access = new RedumpAccess(); - if (access.RedumpLogin(wc, this.Username, this.Password)) + if (wc.Login(this.Username, this.Password)) { // Loop through all of the hashdata to find matching IDs progress?.Report(Result.Success("Finding disc matches on Redump...")); @@ -701,7 +700,7 @@ namespace DICUI.Utilities { if (GetISOHashValues(hashData, out long size, out string crc32, out string md5, out string sha1)) { - List newIds = access.ProcessSearch(wc, sha1.ToLowerInvariant()); + List newIds = wc.ListSearchResults(sha1); if (info.MatchedIDs.Any()) info.MatchedIDs = info.MatchedIDs.Intersect(newIds).ToList(); else @@ -715,7 +714,7 @@ namespace DICUI.Utilities if (info.MatchedIDs.Count == 1) { progress?.Report(Result.Success($"Filling fields from existing ID {info.MatchedIDs[0]}...")); - string discData = access.DownloadSingleSiteID(wc, info.MatchedIDs[0]); + string discData = wc.DownloadSingleSiteID(info.MatchedIDs[0]); info.FillFromDiscPage(discData); progress?.Report(Result.Success("Information filling complete!")); } diff --git a/DICUI.Library/Utilities/Extensions.cs b/DICUI.Library/Utilities/Extensions.cs index 0a500365..266dc710 100644 --- a/DICUI.Library/Utilities/Extensions.cs +++ b/DICUI.Library/Utilities/Extensions.cs @@ -4,224 +4,6 @@ namespace DICUI.Utilities { public static class Extensions { - #region Redump Information Lists - - /// - /// List of systems that are not publically accessible - /// - public static readonly RedumpSystem[] BannedSystems = new RedumpSystem[] - { - RedumpSystem.AudioCD, - RedumpSystem.BDVideo, - RedumpSystem.DVDVideo, - RedumpSystem.HasbroVideoNow, - RedumpSystem.HasbroVideoNowColor, - RedumpSystem.HasbroVideoNowJr, - RedumpSystem.HasbroVideoNowXP, - RedumpSystem.KonamiM2, - RedumpSystem.MicrosoftXbox360, - RedumpSystem.MicrosoftXboxOne, - RedumpSystem.NavisoftNaviken21, - RedumpSystem.NintendoWii, - RedumpSystem.NintendoWiiU, - RedumpSystem.PanasonicM2, - RedumpSystem.PhilipsCDiDigitalVideo, - RedumpSystem.SegaPrologue21, - RedumpSystem.SegaRingEdge, - RedumpSystem.SegaRingEdge2, - RedumpSystem.SonyPlayStation3, - RedumpSystem.SonyPlayStation4, - RedumpSystem.VideoCD, - }; - - /// - /// List of systems that have a Cues pack - /// - public static readonly RedumpSystem[] HasCues = new RedumpSystem[] - { - RedumpSystem.AppleMacintosh, - RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem, - RedumpSystem.AudioCD, - RedumpSystem.BandaiPippin, - RedumpSystem.BandaiPlaydiaQuickInteractiveSystem, - RedumpSystem.CommodoreAmigaCD, - RedumpSystem.CommodoreAmigaCD32, - RedumpSystem.CommodoreAmigaCDTV, - RedumpSystem.FujitsuFMTownsseries, - RedumpSystem.funworldPhotoPlay, - RedumpSystem.HasbroVideoNow, - RedumpSystem.HasbroVideoNowColor, - RedumpSystem.HasbroVideoNowJr, - RedumpSystem.HasbroVideoNowXP, - RedumpSystem.IBMPCcompatible, - RedumpSystem.IncredibleTechnologiesEagle, - RedumpSystem.KonamieAmusement, - RedumpSystem.KonamiFireBeat, - RedumpSystem.KonamiM2, - RedumpSystem.KonamiSystemGV, - RedumpSystem.MattelFisherPriceiXL, - RedumpSystem.MattelHyperScan, - RedumpSystem.MemorexVisualInformationSystem, - RedumpSystem.MicrosoftXbox, - RedumpSystem.MicrosoftXbox360, - RedumpSystem.NamcoSegaNintendoTriforce, - RedumpSystem.NamcoSystem246, - RedumpSystem.NavisoftNaviken21, - RedumpSystem.NECPCEngineCDTurboGrafxCD, - RedumpSystem.NECPC88series, - RedumpSystem.NECPC98series, - RedumpSystem.NECPCFXPCFXGA, - RedumpSystem.PalmOS, - RedumpSystem.Panasonic3DOInteractiveMultiplayer, - RedumpSystem.PanasonicM2, - RedumpSystem.PhilipsCDi, - RedumpSystem.PhilipsCDiDigitalVideo, - RedumpSystem.PhotoCD, - RedumpSystem.PlayStationGameSharkUpdates, - RedumpSystem.SegaChihiro, - RedumpSystem.SegaDreamcast, - RedumpSystem.SegaMegaCDSegaCD, - RedumpSystem.SegaNaomi, - RedumpSystem.SegaNaomi2, - RedumpSystem.SegaPrologue21, - RedumpSystem.SegaSaturn, - RedumpSystem.SNKNeoGeoCD, - RedumpSystem.SonyPlayStation, - RedumpSystem.SonyPlayStation2, - RedumpSystem.SonyPlayStation3, - RedumpSystem.TABAustriaQuizard, - RedumpSystem.TomyKissSite, - RedumpSystem.VideoCD, - RedumpSystem.VTechVFlashVSmilePro, -}; - - /// - /// List of systems that has a Dat pack - /// - public static readonly RedumpSystem[] HasDat = new RedumpSystem[] - { - RedumpSystem.MicrosoftXboxBIOS, - RedumpSystem.NintendoGameCubeBIOS, - RedumpSystem.SonyPlayStationBIOS, - RedumpSystem.SonyPlayStation2BIOS, - - RedumpSystem.AppleMacintosh, - RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem, - RedumpSystem.AudioCD, - RedumpSystem.BandaiPippin, - RedumpSystem.BandaiPlaydiaQuickInteractiveSystem, - RedumpSystem.BDVideo, - RedumpSystem.CommodoreAmigaCD, - RedumpSystem.CommodoreAmigaCD32, - RedumpSystem.CommodoreAmigaCDTV, - RedumpSystem.DVDVideo, - RedumpSystem.FujitsuFMTownsseries, - RedumpSystem.funworldPhotoPlay, - RedumpSystem.HasbroVideoNow, - RedumpSystem.HasbroVideoNowColor, - RedumpSystem.HasbroVideoNowJr, - RedumpSystem.HasbroVideoNowXP, - RedumpSystem.IBMPCcompatible, - RedumpSystem.IncredibleTechnologiesEagle, - RedumpSystem.KonamieAmusement, - RedumpSystem.KonamiFireBeat, - RedumpSystem.KonamiM2, - RedumpSystem.KonamiSystemGV, - RedumpSystem.MattelFisherPriceiXL, - RedumpSystem.MattelHyperScan, - RedumpSystem.MemorexVisualInformationSystem, - RedumpSystem.MicrosoftXbox, - RedumpSystem.MicrosoftXbox360, - RedumpSystem.MicrosoftXboxOne, - RedumpSystem.NamcoSegaNintendoTriforce, - RedumpSystem.NamcoSystem246, - RedumpSystem.NavisoftNaviken21, - RedumpSystem.NECPCEngineCDTurboGrafxCD, - RedumpSystem.NECPC88series, - RedumpSystem.NECPC98series, - RedumpSystem.NECPCFXPCFXGA, - RedumpSystem.NintendoGameCube, - RedumpSystem.NintendoWii, - RedumpSystem.NintendoWiiU, - RedumpSystem.PalmOS, - RedumpSystem.Panasonic3DOInteractiveMultiplayer, - RedumpSystem.PanasonicM2, - RedumpSystem.PhilipsCDi, - RedumpSystem.PhilipsCDiDigitalVideo, - RedumpSystem.PhotoCD, - RedumpSystem.PlayStationGameSharkUpdates, - RedumpSystem.SegaChihiro, - RedumpSystem.SegaDreamcast, - RedumpSystem.SegaLindbergh, - RedumpSystem.SegaMegaCDSegaCD, - RedumpSystem.SegaNaomi, - RedumpSystem.SegaNaomi2, - RedumpSystem.SegaRingEdge, - RedumpSystem.SegaRingEdge2, - RedumpSystem.SegaSaturn, - RedumpSystem.SNKNeoGeoCD, - RedumpSystem.SonyPlayStation, - RedumpSystem.SonyPlayStation2, - RedumpSystem.SonyPlayStation3, - RedumpSystem.SonyPlayStation4, - RedumpSystem.SonyPlayStationPortable, - RedumpSystem.TABAustriaQuizard, - RedumpSystem.TomyKissSite, - RedumpSystem.VideoCD, - RedumpSystem.VMLabsNUON, - RedumpSystem.VTechVFlashVSmilePro, - RedumpSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem, - }; - - /// - /// List of systems that has a Decrypted Keys pack - /// - public static readonly RedumpSystem[] HasDkeys = new RedumpSystem[] - { - RedumpSystem.SonyPlayStation3, - }; - - /// - /// List of systems that has a GDI pack - /// - public static readonly RedumpSystem[] HasGdi = new RedumpSystem[] - { - RedumpSystem.NamcoSegaNintendoTriforce, - RedumpSystem.SegaChihiro, - RedumpSystem.SegaDreamcast, - RedumpSystem.SegaNaomi, - RedumpSystem.SegaNaomi2, - }; - - /// - /// List of systems that has a Keys pack - /// - public static readonly RedumpSystem[] HasKeys = new RedumpSystem[] - { - RedumpSystem.NintendoWiiU, - RedumpSystem.SonyPlayStation3, - }; - - /// - /// List of systems that has an LSD pack - /// - public static readonly RedumpSystem[] HasLsd = new RedumpSystem[] - { - RedumpSystem.IBMPCcompatible, - RedumpSystem.SonyPlayStation, - }; - - /// - /// List of systems that has an SBI pack - /// - public static readonly RedumpSystem[] HasSbi = new RedumpSystem[] - { - RedumpSystem.IBMPCcompatible, - RedumpSystem.SonyPlayStation, - }; - - #endregion - public static bool DoesSupportDriveSpeed(this MediaType? type) { switch (type) diff --git a/DICUI.Library/Web/CookieAwareWebClient.cs b/DICUI.Library/Web/CookieAwareWebClient.cs deleted file mode 100644 index d98848dd..00000000 --- a/DICUI.Library/Web/CookieAwareWebClient.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Net; - -namespace DICUI.Web -{ - // https://stackoverflow.com/questions/1777221/using-cookiecontainer-with-webclient-class - public class CookieAwareWebClient : WebClient - { - private readonly CookieContainer m_container = new CookieContainer(); - - protected override WebRequest GetWebRequest(Uri address) - { - WebRequest request = base.GetWebRequest(address); - HttpWebRequest webRequest = request as HttpWebRequest; - if (webRequest != null) - { - webRequest.CookieContainer = m_container; - } - - return request; - } - - /// - /// Get the last downloaded filename, if possible - /// - /// - public string GetLastFilename() - { - // Try to extract the filename from the Content-Disposition header - if (!string.IsNullOrEmpty(this.ResponseHeaders["Content-Disposition"])) - return this.ResponseHeaders["Content-Disposition"].Substring(this.ResponseHeaders["Content-Disposition"].IndexOf("filename=") + 9).Replace("\"", ""); - - return null; - } - } -} diff --git a/DICUI.Library/Web/Enumerations.cs b/DICUI.Library/Web/Enumerations.cs new file mode 100644 index 00000000..15aa0900 --- /dev/null +++ b/DICUI.Library/Web/Enumerations.cs @@ -0,0 +1,244 @@ +namespace DICUI.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, + NamcoSegaNintendoTriforce, + NamcoSystem12, + NamcoSystem246, + NavisoftNaviken21, + NECPCEngineCDTurboGrafxCD, + NECPC88series, + NECPC98series, + NECPCFXPCFXGA, + NintendoGameCube, + NintendoWii, + NintendoWiiU, + PalmOS, + Panasonic3DOInteractiveMultiplayer, + PanasonicM2, + PhilipsCDi, + PhilipsCDiDigitalVideo, + PhotoCD, + PlayStationGameSharkUpdates, + SegaChihiro, + SegaDreamcast, + SegaLindbergh, + SegaMegaCDSegaCD, + SegaNaomi, + SegaNaomi2, + SegaPrologue21, + SegaRingEdge, + SegaRingEdge2, + SegaSaturn, + SegaTitanVideo, + SharpX68000, + SNKNeoGeoCD, + SonyPlayStation, + SonyPlayStation2, + SonyPlayStation3, + SonyPlayStation4, + SonyPlayStationPortable, + TABAustriaQuizard, + TaoiKTV, + TomyKissSite, + VideoCD, + VMLabsNUON, + VTechVFlashVSmilePro, + ZAPiTGamesGameWaveFamilyEntertainmentSystem, + } + + /// + /// List of all known Redump regions + /// + public enum Region + { + Argentina, + Asia, + AsiaEurope, + AsiaUSA, + Australia, + Austria, + AustriaSwitzerland, + Belgium, + BelgiumNetherlands, + Brazil, + Canada, + China, + Croatia, + Czech, + Denmark, + Europe, + EuropeAsia, + EuropeAustralia, + Finland, + France, + FranceSpain, + Germany, + GreaterChina, + Greece, + Hungary, + India, + Ireland, + Israel, + Italy, + Japan, + JapanAsia, + JapanEurope, + JapanKorea, + JapanUSA, + Korea, + LatinAmerica, + Netherlands, + Norway, + Poland, + Portugal, + Russia, + Scandinavia, + Singapore, + Slovakia, + SouthAfrica, + Spain, + SpainPortugal, + Sweden, + Switzerland, + Taiwan, + Thailand, + Turkey, + UnitedArabEmirates, + UK, + UKAustralia, + Ukraine, + USA, + USAAsia, + USABrazil, + USACanada, + USAEurope, + USAGermany, + USAJapan, + World, + } +} diff --git a/DICUI.Library/Web/Extensions.cs b/DICUI.Library/Web/Extensions.cs new file mode 100644 index 00000000..9319f37d --- /dev/null +++ b/DICUI.Library/Web/Extensions.cs @@ -0,0 +1,1911 @@ +namespace DICUI.Web +{ + /// + /// Information pertaining to Redump systems + /// + public static class Extensions + { + #region Special lists + + /// + /// List of systems that are not publically accessible + /// + public static readonly RedumpSystem?[] BannedSystems = new RedumpSystem?[] + { + RedumpSystem.AudioCD, + RedumpSystem.BDVideo, + RedumpSystem.DVDVideo, + RedumpSystem.HasbroVideoNow, + RedumpSystem.HasbroVideoNowColor, + RedumpSystem.HasbroVideoNowJr, + RedumpSystem.HasbroVideoNowXP, + RedumpSystem.KonamiM2, + RedumpSystem.MicrosoftXbox360, + RedumpSystem.MicrosoftXboxOne, + RedumpSystem.NavisoftNaviken21, + RedumpSystem.NintendoWii, + RedumpSystem.NintendoWiiU, + RedumpSystem.PanasonicM2, + RedumpSystem.PhilipsCDiDigitalVideo, + RedumpSystem.SegaPrologue21, + RedumpSystem.SegaRingEdge, + RedumpSystem.SegaRingEdge2, + RedumpSystem.SonyPlayStation3, + RedumpSystem.SonyPlayStation4, + RedumpSystem.VideoCD, + }; + + /// + /// List of systems that have a Cues pack + /// + public static readonly RedumpSystem?[] HasCues = new RedumpSystem?[] + { + RedumpSystem.AppleMacintosh, + RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem, + RedumpSystem.AudioCD, + RedumpSystem.BandaiPippin, + RedumpSystem.BandaiPlaydiaQuickInteractiveSystem, + RedumpSystem.CommodoreAmigaCD, + RedumpSystem.CommodoreAmigaCD32, + RedumpSystem.CommodoreAmigaCDTV, + RedumpSystem.FujitsuFMTownsseries, + RedumpSystem.funworldPhotoPlay, + RedumpSystem.HasbroVideoNow, + RedumpSystem.HasbroVideoNowColor, + RedumpSystem.HasbroVideoNowJr, + RedumpSystem.HasbroVideoNowXP, + RedumpSystem.IBMPCcompatible, + RedumpSystem.IncredibleTechnologiesEagle, + RedumpSystem.KonamieAmusement, + RedumpSystem.KonamiFireBeat, + RedumpSystem.KonamiM2, + RedumpSystem.KonamiSystemGV, + RedumpSystem.MattelFisherPriceiXL, + RedumpSystem.MattelHyperScan, + RedumpSystem.MemorexVisualInformationSystem, + RedumpSystem.MicrosoftXbox, + RedumpSystem.MicrosoftXbox360, + RedumpSystem.NamcoSegaNintendoTriforce, + RedumpSystem.NamcoSystem246, + RedumpSystem.NavisoftNaviken21, + RedumpSystem.NECPCEngineCDTurboGrafxCD, + RedumpSystem.NECPC88series, + RedumpSystem.NECPC98series, + RedumpSystem.NECPCFXPCFXGA, + RedumpSystem.PalmOS, + RedumpSystem.Panasonic3DOInteractiveMultiplayer, + RedumpSystem.PanasonicM2, + RedumpSystem.PhilipsCDi, + RedumpSystem.PhilipsCDiDigitalVideo, + RedumpSystem.PhotoCD, + RedumpSystem.PlayStationGameSharkUpdates, + RedumpSystem.SegaChihiro, + RedumpSystem.SegaDreamcast, + RedumpSystem.SegaMegaCDSegaCD, + RedumpSystem.SegaNaomi, + RedumpSystem.SegaNaomi2, + RedumpSystem.SegaPrologue21, + RedumpSystem.SegaSaturn, + RedumpSystem.SNKNeoGeoCD, + RedumpSystem.SonyPlayStation, + RedumpSystem.SonyPlayStation2, + RedumpSystem.SonyPlayStation3, + RedumpSystem.TABAustriaQuizard, + RedumpSystem.TomyKissSite, + RedumpSystem.VideoCD, + RedumpSystem.VTechVFlashVSmilePro, +}; + + /// + /// List of systems that has a Dat pack + /// + public static readonly RedumpSystem?[] HasDat = new RedumpSystem?[] + { + RedumpSystem.MicrosoftXboxBIOS, + RedumpSystem.NintendoGameCubeBIOS, + RedumpSystem.SonyPlayStationBIOS, + RedumpSystem.SonyPlayStation2BIOS, + + RedumpSystem.AppleMacintosh, + RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem, + RedumpSystem.AudioCD, + RedumpSystem.BandaiPippin, + RedumpSystem.BandaiPlaydiaQuickInteractiveSystem, + RedumpSystem.BDVideo, + RedumpSystem.CommodoreAmigaCD, + RedumpSystem.CommodoreAmigaCD32, + RedumpSystem.CommodoreAmigaCDTV, + RedumpSystem.DVDVideo, + RedumpSystem.FujitsuFMTownsseries, + RedumpSystem.funworldPhotoPlay, + RedumpSystem.HasbroVideoNow, + RedumpSystem.HasbroVideoNowColor, + RedumpSystem.HasbroVideoNowJr, + RedumpSystem.HasbroVideoNowXP, + RedumpSystem.IBMPCcompatible, + RedumpSystem.IncredibleTechnologiesEagle, + RedumpSystem.KonamieAmusement, + RedumpSystem.KonamiFireBeat, + RedumpSystem.KonamiM2, + RedumpSystem.KonamiSystemGV, + RedumpSystem.MattelFisherPriceiXL, + RedumpSystem.MattelHyperScan, + RedumpSystem.MemorexVisualInformationSystem, + RedumpSystem.MicrosoftXbox, + RedumpSystem.MicrosoftXbox360, + RedumpSystem.MicrosoftXboxOne, + RedumpSystem.NamcoSegaNintendoTriforce, + RedumpSystem.NamcoSystem246, + RedumpSystem.NavisoftNaviken21, + RedumpSystem.NECPCEngineCDTurboGrafxCD, + RedumpSystem.NECPC88series, + RedumpSystem.NECPC98series, + RedumpSystem.NECPCFXPCFXGA, + RedumpSystem.NintendoGameCube, + RedumpSystem.NintendoWii, + RedumpSystem.NintendoWiiU, + RedumpSystem.PalmOS, + RedumpSystem.Panasonic3DOInteractiveMultiplayer, + RedumpSystem.PanasonicM2, + RedumpSystem.PhilipsCDi, + RedumpSystem.PhilipsCDiDigitalVideo, + RedumpSystem.PhotoCD, + RedumpSystem.PlayStationGameSharkUpdates, + RedumpSystem.SegaChihiro, + RedumpSystem.SegaDreamcast, + RedumpSystem.SegaLindbergh, + RedumpSystem.SegaMegaCDSegaCD, + RedumpSystem.SegaNaomi, + RedumpSystem.SegaNaomi2, + RedumpSystem.SegaRingEdge, + RedumpSystem.SegaRingEdge2, + RedumpSystem.SegaSaturn, + RedumpSystem.SNKNeoGeoCD, + RedumpSystem.SonyPlayStation, + RedumpSystem.SonyPlayStation2, + RedumpSystem.SonyPlayStation3, + RedumpSystem.SonyPlayStation4, + RedumpSystem.SonyPlayStationPortable, + RedumpSystem.TABAustriaQuizard, + RedumpSystem.TomyKissSite, + RedumpSystem.VideoCD, + RedumpSystem.VMLabsNUON, + RedumpSystem.VTechVFlashVSmilePro, + RedumpSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem, + }; + + /// + /// List of systems that has a Decrypted Keys pack + /// + public static readonly RedumpSystem?[] HasDkeys = new RedumpSystem?[] + { + RedumpSystem.SonyPlayStation3, + }; + + /// + /// List of systems that has a GDI pack + /// + public static readonly RedumpSystem?[] HasGdi = new RedumpSystem?[] + { + RedumpSystem.NamcoSegaNintendoTriforce, + RedumpSystem.SegaChihiro, + RedumpSystem.SegaDreamcast, + RedumpSystem.SegaNaomi, + RedumpSystem.SegaNaomi2, + }; + + /// + /// List of systems that has a Keys pack + /// + public static readonly RedumpSystem?[] HasKeys = new RedumpSystem?[] + { + RedumpSystem.NintendoWiiU, + RedumpSystem.SonyPlayStation3, + }; + + /// + /// List of systems that has an LSD pack + /// + public static readonly RedumpSystem?[] HasLsd = new RedumpSystem?[] + { + RedumpSystem.IBMPCcompatible, + RedumpSystem.SonyPlayStation, + }; + + /// + /// List of systems that has an SBI pack + /// + public static readonly RedumpSystem?[] HasSbi = new RedumpSystem?[] + { + RedumpSystem.IBMPCcompatible, + RedumpSystem.SonyPlayStation, + }; + + #endregion + + #region Redump Category + + /// + /// Get the Redump longnames for each known category + /// + /// + /// + 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 Category enum value for a given string + /// + /// String value to convert + /// Category represented by the string, if possible + public static DiscCategory? ToCategory(string category) + { + switch (category.ToLowerInvariant()) + { + case "games": + return DiscCategory.Games; + case "demos": + return DiscCategory.Demos; + case "video": + return DiscCategory.Video; + case "audio": + return DiscCategory.Audio; + case "multimedia": + return DiscCategory.Multimedia; + case "applications": + return DiscCategory.Applications; + case "coverdiscs": + return DiscCategory.Coverdiscs; + case "educational": + return DiscCategory.Educational; + case "bonusdiscs": + case "bonus discs": + return DiscCategory.BonusDiscs; + case "preproduction": + return DiscCategory.Preproduction; + case "addons": + case "add-ons": + return DiscCategory.AddOns; + default: + return DiscCategory.Games; + } + } + + #endregion + + #region Redump Language + + /// + /// Get the Redump longnames for each known language + /// + /// + /// + 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 null; + } + } + + /// + /// Get the Redump shortnames for each known language + /// + /// + /// + 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 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; + } + } + + #endregion + + #region Redump Language Selection + + /// + /// 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; + } + } + + #endregion + + #region Redump Region + + /// + /// Get the Redump longnames for each known region + /// + /// + /// + 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.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.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.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.World: + return "World"; + default: + return null; + } + } + + /// + /// Get the Redump shortnames for each known region + /// + /// + /// + 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.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.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.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.World: + return "W"; + 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 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 "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 "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 "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 "W": + return Region.World; + default: + return null; + } + } + + #endregion + + #region Redump System + + /// + /// Get the Redump longnames for each known system + /// + /// + /// + public static string LongName(this RedumpSystem? system) + { + switch (system) + { + // Special BIOS sets + case RedumpSystem.MicrosoftXboxBIOS: + return "Microsoft Xbox (BIOS)"; + case RedumpSystem.NintendoGameCubeBIOS: + return "Nintendo GameCube (BIOS)"; + case RedumpSystem.SonyPlayStationBIOS: + return "Sony PlayStation (BIOS)"; + case RedumpSystem.SonyPlayStation2BIOS: + return "Sony PlayStation 2 (BIOS)"; + + // Regular systems + case RedumpSystem.AcornArchimedes: + return "Acorn Archimedes"; + case RedumpSystem.AppleMacintosh: + return "Apple Macintosh"; + case RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem: + return "Atari Jaguar CD Interactive Multimedia System"; + case RedumpSystem.AudioCD: + return "Audio CD"; + case RedumpSystem.BandaiPippin: + return "Bandai Pippin"; + case RedumpSystem.BandaiPlaydiaQuickInteractiveSystem: + return "Bandai Playdia Quick Interactive System"; + case RedumpSystem.BDVideo: + return "BD-Video"; + case RedumpSystem.CommodoreAmigaCD: + return "Commodore Amiga CD"; + case RedumpSystem.CommodoreAmigaCD32: + return "Commodore Amiga CD32"; + case RedumpSystem.CommodoreAmigaCDTV: + return "Commodore Amiga CDTV"; + case RedumpSystem.DVDVideo: + return "DVD-Video"; + case RedumpSystem.EnhancedCD: + return "Enhanced CD"; + case RedumpSystem.FujitsuFMTownsseries: + return "Fujitsu FM Towns series"; + case RedumpSystem.funworldPhotoPlay: + return "funworld Photo Play"; + case RedumpSystem.HasbroVideoNow: + return "Hasbro VideoNow"; + case RedumpSystem.HasbroVideoNowColor: + return "Hasbro VideoNow Color"; + case RedumpSystem.HasbroVideoNowJr: + return "Hasbro VideoNow Jr."; + case RedumpSystem.HasbroVideoNowXP: + return "Hasbro VideoNow XP"; + case RedumpSystem.IBMPCcompatible: + return "IBM PC compatible"; + case RedumpSystem.IncredibleTechnologiesEagle: + return "Incredible Technologies Eagle"; + case RedumpSystem.KonamieAmusement: + return "Konami e-Amusement"; + case RedumpSystem.KonamiFireBeat: + return "Konami FireBeat"; + case RedumpSystem.KonamiM2: + return "Konami M2"; + case RedumpSystem.KonamiSystem573: + return "Konami System 573"; + case RedumpSystem.KonamiSystemGV: + return "Konami System GV"; + case RedumpSystem.KonamiTwinkle: + return "Konami Twinkle"; + case RedumpSystem.MattelFisherPriceiXL: + return "Mattel Fisher-Price iXL"; + case RedumpSystem.MattelHyperScan: + return "Mattel HyperScan"; + case RedumpSystem.MemorexVisualInformationSystem: + return "Memorex Visual Information System"; + case RedumpSystem.MicrosoftXbox: + return "Microsoft Xbox"; + case RedumpSystem.MicrosoftXbox360: + return "Microsoft Xbox 360"; + case RedumpSystem.MicrosoftXboxOne: + return "Microsoft Xbox One"; + case RedumpSystem.NamcoSegaNintendoTriforce: + return "Namco · Sega · Nintendo Triforce"; + case RedumpSystem.NamcoSystem12: + return "Namco System 12"; + case RedumpSystem.NamcoSystem246: + return "Namco System 246"; + case RedumpSystem.NavisoftNaviken21: + return "Navisoft Naviken 2.1"; + case RedumpSystem.NECPCEngineCDTurboGrafxCD: + return "NEC PC Engine CD & TurboGrafx CD"; + case RedumpSystem.NECPC88series: + return "NEC PC-88 series"; + case RedumpSystem.NECPC98series: + return "NEC PC-98 series"; + case RedumpSystem.NECPCFXPCFXGA: + return "NEC PC-FX & PC-FXGA"; + case RedumpSystem.NintendoGameCube: + return "Nintendo GameCube"; + case RedumpSystem.NintendoWii: + return "Nintendo Wii"; + case RedumpSystem.NintendoWiiU: + return "Nintendo Wii U"; + case RedumpSystem.PalmOS: + return "Palm OS"; + case RedumpSystem.Panasonic3DOInteractiveMultiplayer: + return "Panasonic 3DO Interactive Multiplayer"; + case RedumpSystem.PanasonicM2: + return "Panasonic M2"; + case RedumpSystem.PhilipsCDi: + return "Philips CD-i"; + case RedumpSystem.PhilipsCDiDigitalVideo: + return "Philips CD-i Digital Video"; + case RedumpSystem.PhotoCD: + return "Photo CD"; + case RedumpSystem.PlayStationGameSharkUpdates: + return "PlayStation GameShark Updates"; + case RedumpSystem.SegaChihiro: + return "Sega Chihiro"; + case RedumpSystem.SegaDreamcast: + return "Sega Dreamcast"; + case RedumpSystem.SegaLindbergh: + return "Sega Lindbergh"; + case RedumpSystem.SegaMegaCDSegaCD: + return "Sega Mega CD & Sega CD"; + case RedumpSystem.SegaNaomi: + return "Sega Naomi"; + case RedumpSystem.SegaNaomi2: + return "Sega Naomi 2"; + case RedumpSystem.SegaPrologue21: + return "Prologue 21"; + case RedumpSystem.SegaRingEdge: + return "Sega RingEdge"; + case RedumpSystem.SegaRingEdge2: + return "Sega RingEdge 2"; + case RedumpSystem.SegaSaturn: + return "Sega Saturn"; + case RedumpSystem.SegaTitanVideo: + return "Sega Titan Video"; + case RedumpSystem.SharpX68000: + return "Sharp X68000"; + case RedumpSystem.SNKNeoGeoCD: + return "Neo Geo CD"; + case RedumpSystem.SonyPlayStation: + return "Sony PlayStation"; + case RedumpSystem.SonyPlayStation2: + return "Sony PlayStation 2"; + case RedumpSystem.SonyPlayStation3: + return "Sony PlayStation 3"; + case RedumpSystem.SonyPlayStation4: + return "Sony PlayStation 4"; + case RedumpSystem.SonyPlayStationPortable: + return "Sony PlayStation Portable"; + case RedumpSystem.TABAustriaQuizard: + return "TAB-Austria Quizard"; + case RedumpSystem.TaoiKTV: + return "Tao iKTV"; + case RedumpSystem.TomyKissSite: + return "Tomy Kiss-Site"; + case RedumpSystem.VideoCD: + return "Video CD"; + case RedumpSystem.VMLabsNUON: + return "VM Labs NUON"; + case RedumpSystem.VTechVFlashVSmilePro: + return "VTech V.Flash & V.Smile Pro"; + case RedumpSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem: + return "ZAPiT Games Game Wave Family Entertainment System"; + default: + return null; + } + } + + /// + /// Get the Redump shortnames for each known system + /// + /// + /// + public static string ShortName(this RedumpSystem? system) + { + switch (system) + { + // Special BIOS sets + case RedumpSystem.MicrosoftXboxBIOS: + return "xbox-bios"; + case RedumpSystem.NintendoGameCubeBIOS: + return "gc-bios"; + case RedumpSystem.SonyPlayStationBIOS: + return "psx-bios"; + case RedumpSystem.SonyPlayStation2BIOS: + return "ps2-bios"; + + // Regular systems + case RedumpSystem.AcornArchimedes: + return "archcd"; + case RedumpSystem.AppleMacintosh: + return "mac"; + case RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem: + return "ajcd"; + case RedumpSystem.AudioCD: + return "audio-cd"; + case RedumpSystem.BandaiPippin: + return "pippin"; + case RedumpSystem.BandaiPlaydiaQuickInteractiveSystem: + return "qis"; + case RedumpSystem.BDVideo: + return "bd-video"; + case RedumpSystem.CommodoreAmigaCD: + return "acd"; + case RedumpSystem.CommodoreAmigaCD32: + return "cd32"; + case RedumpSystem.CommodoreAmigaCDTV: + return "cdtv"; + case RedumpSystem.DVDVideo: + return "dvd-video"; + case RedumpSystem.EnhancedCD: + return "enhanced-cd"; + case RedumpSystem.FujitsuFMTownsseries: + return "fmt"; + case RedumpSystem.funworldPhotoPlay: + return "fpp"; + case RedumpSystem.HasbroVideoNow: + return "hvn"; + case RedumpSystem.HasbroVideoNowColor: + return "hvnc"; + case RedumpSystem.HasbroVideoNowJr: + return "hvnjr"; + case RedumpSystem.HasbroVideoNowXP: + return "hvnxp"; + case RedumpSystem.IBMPCcompatible: + return "pc"; + case RedumpSystem.IncredibleTechnologiesEagle: + return "ite"; + case RedumpSystem.KonamieAmusement: + return "kea"; + case RedumpSystem.KonamiFireBeat: + return "kfb"; + case RedumpSystem.KonamiM2: + return "km2"; + case RedumpSystem.KonamiSystem573: + return "ks573"; + case RedumpSystem.KonamiSystemGV: + return "ksgv"; + case RedumpSystem.KonamiTwinkle: + return "kt"; + case RedumpSystem.MattelFisherPriceiXL: + return "ixl"; + case RedumpSystem.MattelHyperScan: + return "hs"; + case RedumpSystem.MemorexVisualInformationSystem: + return "vis"; + case RedumpSystem.MicrosoftXbox: + return "xbox"; + case RedumpSystem.MicrosoftXbox360: + return "xbox360"; + case RedumpSystem.MicrosoftXboxOne: + return "xboxone"; + case RedumpSystem.NamcoSegaNintendoTriforce: + return "triforce"; + case RedumpSystem.NamcoSystem12: + return "ns12"; + case RedumpSystem.NamcoSystem246: + return "ns246"; + case RedumpSystem.NavisoftNaviken21: + return "navi21"; + case RedumpSystem.NECPCEngineCDTurboGrafxCD: + return "pce"; + case RedumpSystem.NECPC88series: + return "pc-88"; + case RedumpSystem.NECPC98series: + return "pc-98"; + case RedumpSystem.NECPCFXPCFXGA: + return "pc-fx"; + case RedumpSystem.NintendoGameCube: + return "gc"; + case RedumpSystem.NintendoWii: + return "wii"; + case RedumpSystem.NintendoWiiU: + return "wiiu"; + case RedumpSystem.PalmOS: + return "palm"; + case RedumpSystem.Panasonic3DOInteractiveMultiplayer: + return "3do"; + case RedumpSystem.PanasonicM2: + return "m2"; + case RedumpSystem.PhilipsCDi: + return "cdi"; + case RedumpSystem.PhilipsCDiDigitalVideo: + return "cdi-video"; + case RedumpSystem.PhotoCD: + return "photo-cd"; + case RedumpSystem.PlayStationGameSharkUpdates: + return "psxgs"; + case RedumpSystem.SegaChihiro: + return "chihiro"; + case RedumpSystem.SegaDreamcast: + return "dc"; + case RedumpSystem.SegaLindbergh: + return "lindbergh"; + case RedumpSystem.SegaMegaCDSegaCD: + return "mcd"; + case RedumpSystem.SegaNaomi: + return "naomi"; + case RedumpSystem.SegaNaomi2: + return "naomi2"; + case RedumpSystem.SegaPrologue21: + return "pl21"; + case RedumpSystem.SegaRingEdge: + return "sre"; + case RedumpSystem.SegaRingEdge2: + return "sre2"; + case RedumpSystem.SegaSaturn: + return "ss"; + case RedumpSystem.SegaTitanVideo: + return "stv"; + case RedumpSystem.SharpX68000: + return "x86kcd"; + case RedumpSystem.SNKNeoGeoCD: + return "ngcd"; + case RedumpSystem.SonyPlayStation: + return "psx"; + case RedumpSystem.SonyPlayStation2: + return "ps2"; + case RedumpSystem.SonyPlayStation3: + return "ps3"; + case RedumpSystem.SonyPlayStation4: + return "ps4"; + case RedumpSystem.SonyPlayStationPortable: + return "psp"; + case RedumpSystem.TABAustriaQuizard: + return "quizard"; + case RedumpSystem.TaoiKTV: + return "iktv"; + case RedumpSystem.TomyKissSite: + return "ksite"; + case RedumpSystem.VideoCD: + return "vcd"; + case RedumpSystem.VMLabsNUON: + return "nuon"; + case RedumpSystem.VTechVFlashVSmilePro: + return "vflash"; + case RedumpSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem: + return "gamewave"; + default: + return null; + } + } + + /// + /// Get the RedumpSystem enum value for a given string + /// + /// String value to convert + /// RedumpSystem represented by the string, if possible + public static RedumpSystem? ToRedumpSystem(string sys) + { + switch (sys) + { + // Special BIOS Sets + case "xboxbios": + case "xbox bios": + case "microsoftxboxbios": + case "microsoftxbox bios": + case "microsoft xbox bios": + return RedumpSystem.MicrosoftXboxBIOS; + case "gcbios": + case "gc bios": + case "gamecubebios": + case "ngcbios": + case "ngc bios": + case "nintendogamecubebios": + case "nintendo gamecube bios": + return RedumpSystem.NintendoGameCubeBIOS; + case "ps1bios": + case "ps1 bios": + case "psxbios": + case "psx bios": + case "playstationbios": + case "playstation bios": + case "sonyps1bios": + case "sonyps1 bios": + case "sony ps1 bios": + case "sonypsxbios": + case "sonypsx bios": + case "sony psx bios": + case "sonyplaystationbios": + case "sonyplaystation bios": + case "sony playstation bios": + return RedumpSystem.SonyPlayStationBIOS; + case "ps2bios": + case "ps2 bios": + case "playstation2bios": + case "playstation2 bios": + case "playstation 2 bios": + case "sonyps2bios": + case "sonyps2 bios": + case "sony ps2 bios": + case "sonyplaystation2bios": + case "sonyplaystation2 bios": + case "sony playstation 2 bios": + return RedumpSystem.SonyPlayStation2BIOS; + + // Regular systems + case "acorn": + case "archimedes": + case "acornarchimedes": + case "acorn archimedes": + return RedumpSystem.AcornArchimedes; + case "apple": + case "mac": + case "applemac": + case "macintosh": + case "applemacintosh": + case "apple mac": + case "apple macintosh": + return RedumpSystem.AppleMacintosh; + case "jaguar": + case "jagcd": + case "jaguarcd": + case "jaguar cd": + case "atarijaguar": + case "atarijagcd": + case "atarijaguarcd": + case "atari jaguar cd": + return RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem; + case "audio": + case "audiocd": + case "audio cd": + return RedumpSystem.AudioCD; + case "playdia": + case "playdiaqis": + case "playdiaquickinteractivesystem": + case "bandaiplaydia": + case "bandaiplaydiaquickinteractivesystem": + case "bandai playdia quick interactive system": + return RedumpSystem.BandaiPlaydiaQuickInteractiveSystem; + case "pippin": + case "bandaipippin": + case "bandai pippin": + case "applepippin": + case "apple pippin": + case "bandaiapplepippin": + case "bandai apple pippin": + case "bandai / apple pippin": + return RedumpSystem.BandaiPippin; + case "bdvideo": + case "bd-video": + case "blurayvideo": + case "bluray video": + return RedumpSystem.BDVideo; + case "amiga": + case "amigacd": + case "amiga cd": + case "commodoreamiga": + case "commodoreamigacd": + case "commodoreamiga cd": + case "commodore amiga": + case "commodore amiga cd": + return RedumpSystem.CommodoreAmigaCD; + case "cd32": + case "amigacd32": + case "amiga cd32": + case "commodoreamigacd32": + case "commodore amiga cd32": + return RedumpSystem.CommodoreAmigaCD32; + case "cdtv": + case "amigacdtv": + case "amiga cdtv": + case "commodoreamigacdtv": + case "commodore amiga cdtv": + return RedumpSystem.CommodoreAmigaCDTV; + case "dvdvideo": + case "dvd-video": + return RedumpSystem.DVDVideo; + case "enhancedcd": + case "enhanced cd": + case "enhancedcdrom": + case "enhanced cdrom": + case "enhanced cd-rom": + return RedumpSystem.EnhancedCD; + case "fmtowns": + case "fmt": + case "fm towns": + case "fujitsufmtowns": + case "fujitsu fm towns": + case "fujitsu fm towns series": + return RedumpSystem.FujitsuFMTownsseries; + case "fpp": + case "funworldphotoplay": + case "funworld photoplay": + case "funworld photo play": + return RedumpSystem.funworldPhotoPlay; + case "videonow": + case "hasbrovideonow": + case "hasbro videonow": + return RedumpSystem.HasbroVideoNow; + case "videonowcolor": + case "videonow color": + case "hasbrovideonowcolor": + case "hasbro videonow color": + return RedumpSystem.HasbroVideoNowColor; + case "videonowjr": + case "videonow jr": + case "hasbrovideonowjr": + case "hasbro videonow jr": + return RedumpSystem.HasbroVideoNowColor; + case "videonowxp": + case "videonow xp": + case "hasbrovideonowxp": + case "hasbro videonow xp": + return RedumpSystem.HasbroVideoNowColor; + case "ibm": + case "ibmpc": + case "pc": + case "ibm pc": + case "ibm pc compatible": + return RedumpSystem.IBMPCcompatible; + case "iteagle": + case "eagle": + case "incredible technologies eagle": + return RedumpSystem.IncredibleTechnologiesEagle; + case "eamusement": + case "e-amusement": + case "konamieamusement": + case "konami eamusement": + case "konamie-amusement": + case "konami e-amusement": + return RedumpSystem.KonamieAmusement; + case "firebeat": + case "konamifirebeat": + case "konami firebeat": + return RedumpSystem.KonamiFireBeat; + case "konamim2": + case "konami m2": + return RedumpSystem.KonamiM2; + case "system573": + case "system 573": + case "konamisystem573": + case "konami system 573": + return RedumpSystem.KonamiSystem573; + case "gvsystem": + case "systemgv": + case "gv system": + case "system gv": + case "konamigvsystem": + case "konamisystemgv": + case "konami gv system": + case "konami system gv": + return RedumpSystem.KonamiSystemGV; + case "twinkle": + case "konamitwinkle": + case "konami twinkle": + return RedumpSystem.KonamiTwinkle; + case "ixl": + case "mattelixl": + case "mattel ixl": + case "fisherpriceixl": + case "fisher price ixl": + case "fisher-price ixl": + case "fisherprice ixl": + case "mattelfisherpriceixl": + case "mattel fisher price ixl": + case "mattelfisherprice ixl": + case "mattel fisherprice ixl": + case "mattel fisher-price ixl": + return RedumpSystem.MattelFisherPriceiXL; + case "hyperscan": + case "mattelhyperscan": + case "mattel hyperscan": + return RedumpSystem.MattelHyperScan; + case "vis": + case "tandyvis": + case "tandy vis": + case "tandyvisualinformationsystem": + case "tandy visual information system": + case "memorexvis": + case "memorex vis": + case "memorexvisualinformationsystem": + case "memorex visual information sytem": + case "tandy / memorex visual information system": + return RedumpSystem.MemorexVisualInformationSystem; + case "xbox": + case "microsoftxbox": + case "microsoft xbox": + return RedumpSystem.MicrosoftXbox; + case "x360": + case "xbox360": + case "microsoftx360": + case "microsoftxbox360": + case "microsoft x360": + case "microsoft xbox 360": + return RedumpSystem.MicrosoftXbox360; + case "xb1": + case "xbone": + case "xboxone": + case "microsoftxbone": + case "microsoftxboxone": + case "microsoft xbone": + case "microsoft xbox one": + return RedumpSystem.MicrosoftXboxOne; + case "triforce": + case "namcotriforce": + case "namco triforce": + case "segatriforce": + case "sega triforce": + case "nintendotriforce": + case "nintendo triforce": + case "namco / sega / nintendo triforce": + return RedumpSystem.NamcoSegaNintendoTriforce; + case "system12": + case "system 12": + case "namcosystem12": + case "namco system 12": + return RedumpSystem.NamcoSystem12; + case "system246": + case "system 246": + case "namcosystem246": + case "namco system 246": + case "capcomsystem246": + case "capcom system 246": + case "taitosystem246": + case "taito system 246": + case "namco / capcom / taito system 246": + return RedumpSystem.NamcoSystem246; + case "naviken": + case "naviken21": + case "naviken 2.1": + case "navisoftnaviken": + case "navisoft naviken": + case "navisoftnaviken21": + case "navisoft naviken 2.1": + return RedumpSystem.NavisoftNaviken21; + case "pcecd": + case "pce-cd": + case "tgcd": + case "tg-cd": + case "necpcecd": + case "nectgcd": + case "nec pc-engine cd": + case "nec turbografx cd": + case "nec pc-engine / turbografx cd": + return RedumpSystem.NECPCEngineCDTurboGrafxCD; + case "pc88": + case "pc-88": + case "necpc88": + case "nec pc88": + case "nec pc-88": + return RedumpSystem.NECPC88series; + case "pc98": + case "pc-98": + case "necpc98": + case "nec pc98": + case "nec pc-98": + return RedumpSystem.NECPC98series; + case "pcfx": + case "pc-fx": + case "pcfxga": + case "pc-fxga": + case "necpcfx": + case "necpcfxga": + case "nec pc-fx": + case "nec pc-fxga": + case "nec pc-fx / pc-fxga": + return RedumpSystem.NECPCFXPCFXGA; + case "gc": + case "gamecube": + case "ngc": + case "nintendogamecube": + case "nintendo gamecube": + return RedumpSystem.NintendoGameCube; + case "wii": + case "nintendowii": + case "nintendo wii": + return RedumpSystem.NintendoWii; + case "wiiu": + case "wii u": + case "nintendowiiu": + case "nintendo wii u": + return RedumpSystem.NintendoWiiU; + case "palm": + case "palmos": + return RedumpSystem.PalmOS; + case "3do": + case "3do interactive multiplayer": + case "panasonic3do": + case "panasonic 3do": + case "panasonic 3do interactive multiplayer": + return RedumpSystem.Panasonic3DOInteractiveMultiplayer; + case "panasonicm2": + case "panasonic m2": + return RedumpSystem.PanasonicM2; + case "cdi": + case "cd-i": + case "philipscdi": + case "philips cdi": + case "philips cd-i": + return RedumpSystem.PhilipsCDi; + case "cdidv": + case "cdidigitalvideo": + case "cdi digital video": + case "cd-i digital video": + case "philipscdidigitalvideo": + case "philips cdi digital video": + case "philips cd-i digital video": + return RedumpSystem.PhilipsCDiDigitalVideo; + case "photo": + case "photocd": + case "photo cd": + return RedumpSystem.PhotoCD; + case "gameshark": + case "psgameshark": + case "ps gameshark": + case "playstationgameshark": + case "playstation gameshark": + case "playstation gameshark updates": + return RedumpSystem.PlayStationGameSharkUpdates; + case "chihiro": + case "segachihiro": + case "sega chihiro": + return RedumpSystem.SegaChihiro; + case "dc": + case "sdc": + case "dreamcast": + case "segadreamcast": + case "sega dreamcast": + return RedumpSystem.SegaDreamcast; + case "lindbergh": + case "segalindbergh": + case "sega lindbergh": + return RedumpSystem.SegaLindbergh; + case "scd": + case "mcd": + case "smcd": + case "segacd": + case "megacd": + case "segamegacd": + case "sega cd": + case "mega cd": + case "sega cd / mega cd": + return RedumpSystem.SegaMegaCDSegaCD; + case "naomi": + case "seganaomi": + case "sega naomi": + return RedumpSystem.SegaNaomi; + case "naomi2": + case "naomi 2": + case "seganaomi2": + case "sega naomi 2": + return RedumpSystem.SegaNaomi2; + case "pl21": + case "prologue21": + case "prologue 21": + case "segaprologue21": + case "sega prologue21": + case "sega prologue 21": + return RedumpSystem.SegaPrologue21; + case "ringedge": + case "segaringedge": + case "sega ringedge": + return RedumpSystem.SegaRingEdge; + case "ringedge2": + case "ringedge 2": + case "segaringedge2": + case "sega ringedge 2": + return RedumpSystem.SegaRingEdge2; + case "saturn": + case "segasaturn": + case "sega saturn": + return RedumpSystem.SegaSaturn; + case "stv": + case "titanvideo": + case "titan video": + case "segatitanvideo": + case "sega titan video": + return RedumpSystem.SegaTitanVideo; + case "x68k": + case "x68000": + case "sharpx68k": + case "sharp x68k": + case "sharpx68000": + case "sharp x68000": + return RedumpSystem.SharpX68000; + case "ngcd": + case "neogeocd": + case "neogeo cd": + case "neo geo cd": + case "snk ngcd": + case "snk neogeo cd": + case "snk neo geo cd": + return RedumpSystem.SNKNeoGeoCD; + case "ps1": + case "psx": + case "playstation": + case "sonyps1": + case "sony ps1": + case "sonypsx": + case "sony psx": + case "sonyplaystation": + case "sony playstation": + return RedumpSystem.SonyPlayStation; + case "ps2": + case "playstation2": + case "playstation 2": + case "sonyps2": + case "sony ps2": + case "sonyplaystation2": + case "sony playstation 2": + return RedumpSystem.SonyPlayStation2; + case "ps3": + case "playstation3": + case "playstation 3": + case "sonyps3": + case "sony ps3": + case "sonyplaystation3": + case "sony playstation 3": + return RedumpSystem.SonyPlayStation3; + case "ps4": + case "playstation4": + case "playstation 4": + case "sonyps4": + case "sony ps4": + case "sonyplaystation4": + case "sony playstation 4": + return RedumpSystem.SonyPlayStation4; + case "psp": + case "playstationportable": + case "playstation portable": + case "sonypsp": + case "sony psp": + case "sonyplaystationportable": + case "sony playstation portable": + return RedumpSystem.SonyPlayStationPortable; + case "quizard": + case "tabaustriaquizard": + case "tab-austria quizard": + return RedumpSystem.TABAustriaQuizard; + case "iktv": + case "taoiktv": + case "tao iktv": + return RedumpSystem.TaoiKTV; + case "kisssite": + case "kiss-site": + case "tomykisssite": + case "tomy kisssite": + case "tomy kiss-site": + return RedumpSystem.TomyKissSite; + case "vcd": + case "videocd": + case "video cd": + return RedumpSystem.VideoCD; + case "nuon": + case "vmlabsnuon": + case "vm labs nuon": + return RedumpSystem.VMLabsNUON; + case "vflash": + case "vsmile": + case "vsmilepro": + case "vsmile pro": + case "v.flash": + case "v.smile": + case "v.smilepro": + case "v.smile pro": + case "vtechvflash": + case "vtech vflash": + case "vtech v.flash": + case "vtechvsmile": + case "vtech vsmile": + case "vtech v.smile": + case "vtechvsmilepro": + case "vtech vsmile pro": + case "vtech v.smile pro": + case "vtech v.flash - v.smile pro": + return RedumpSystem.VTechVFlashVSmilePro; + case "gamewave": + case "game wave": + case "zapit": + case "zapitgamewave": + case "zapit game wave": + case "zapit games game wave family entertainment system": + return RedumpSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem; + + default: + return null; + } + } + + #endregion + } +} diff --git a/DICUI.Library/Web/RedumpAccess.cs b/DICUI.Library/Web/RedumpAccess.cs deleted file mode 100644 index 1430ca32..00000000 --- a/DICUI.Library/Web/RedumpAccess.cs +++ /dev/null @@ -1,386 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Text; -using System.Text.RegularExpressions; -using DICUI.Data; -using DICUI.Utilities; - -namespace DICUI.Web -{ - public class RedumpAccess - { - #region Base URLs - - private const string loginUrl = "http://forum.redump.org/login/"; - - #endregion - - #region Disc URLs and Extensions - - private const string discPageUrl = @"http://redump.org/disc/{0}/"; - private const string wipDiscPageUrl = @"http://redump.org/newdisc/{0}/"; - - private const string changesExt = "/changes/"; - private const string cueExt = "cue/"; - private const string gdiExt = "gdi/"; - private const string keyExt = "key/"; - private const string md5Ext = "md5/"; - private const string sbiExt = "sbi/"; - private const string sfvExt = "sfv/"; - private const string sha1Ext = "sha1/"; - - #endregion - - #region List URLs - - private const string lastModifiedUrl = @"http://redump.org/discs/sort/modified/dir/desc?page={0}"; - private const string quickSearchUrl = @"http://redump.org/discs/quicksearch/{0}/?page={1}"; - private const string userDumpsUrl = @"http://redump.org/discs/dumper/{0}/?page={1}"; - private const string wipDumpsUrl = @"http://redump.org/discs-wip/"; - - #endregion - - #region Pack URLs - - private const string packCuesUrl = @"http://redump.org/cues/{0}/"; - private const string packDatfileUrl = @"http://redump.org/datfile/{0}/"; - private const string packDkeysUrl = @"http://redump.org/dkeys/{0}/"; - private const string packGdiUrl = @"http://redump.org/gdi/{0}/"; - private const string packKeysUrl = @"http://redump.org/keys/{0}/"; - private const string packSbiUrl = @"http://redump.org/sbi/{0}/"; - - #endregion - - #region Regexes - - private readonly Regex discRegex = new Regex(@""); - private readonly Regex newDiscRegex = new Regex(@""); - private readonly Regex tokenRegex = new Regex(@""); - - #endregion - - /// - /// Login to Redump, if possible - /// - /// CookieAwareWebClient to hold the login state - /// Redump username to log in for protected systems - /// Redump password to log in for protected systems - /// True login was successful, false otherwise - public bool RedumpLogin(CookieAwareWebClient wc, string username, string password) - { - if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password)) - return false; - - var loginPage = wc.DownloadString(loginUrl); - string token = this.tokenRegex.Match(loginPage).Groups[1].Value; - - wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; - wc.Encoding = Encoding.UTF8; - var response = wc.UploadString(loginUrl, $"form_sent=1&redirect_url=&csrf_token={token}&req_username={username}&req_password={password}&save_pass=0"); - - if (response.Contains("Incorrect username and/or password.")) - return false; - else - return true; - } - - #region Process IDs and Pages - - /// - /// Get the list of the last modified IDs, in order of appearance - /// - /// CookieAwareWebClient to hold the login state - /// Number of pages to grab until stopping; -1 means continue until end - /// A list of IDs in order of last modified - private List ProcessLastModified(CookieAwareWebClient wc, int pageCount = -1) - { - List ids = new List(); - - // If we have a -1 page count, set the maximum page limit - if (pageCount == -1) - pageCount = Int32.MaxValue; - - // Keep getting last modified pages until there are none left - int pageNumber = 1; - while (pageNumber < pageCount) - { - List pageIds = CheckSingleSitePage(wc, string.Format(lastModifiedUrl, pageNumber++)); - ids.AddRange(pageIds); - if (pageIds.Count < 2) - break; - } - - return ids; - } - - /// - /// Retrieve premade packs from Redump - /// - /// CookieAwareWebClient to hold the login state - private void ProcessAllPacks(CookieAwareWebClient wc) - { - var cuesPacks = this.DownloadPacks(wc, packCuesUrl, Extensions.HasCues, "CUEs"); - var datPacks = this.DownloadPacks(wc, packDatfileUrl, Extensions.HasDat, "DATs"); - var dkeyPacks = this.DownloadPacks(wc, packDkeysUrl, Extensions.HasDkeys, "Decrypted KEYS"); - var gdiPacks = this.DownloadPacks(wc, packGdiUrl, Extensions.HasGdi, "GDIs"); - var keysPacks = this.DownloadPacks(wc, packKeysUrl, Extensions.HasKeys, "KEYS"); - var sbiPacks = this.DownloadPacks(wc, packSbiUrl, Extensions.HasSbi, "SBIs"); - } - - /// - /// Retrieve premade packs from Redump - /// - /// CookieAwareWebClient to hold the login state - /// RedumpSystem to get all possible packs for - private void ProcessPacksForSystem(CookieAwareWebClient wc, RedumpSystem system) - { - var packs = new Dictionary(); - - if (Extensions.HasCues.Contains(system)) - packs.Add("cues", this.DownloadPack(wc, packCuesUrl, system, "CUEs")); - - if (Extensions.HasDat.Contains(system)) - packs.Add("dat", this.DownloadPack(wc, packDatfileUrl, system, "DATs")); - - if (Extensions.HasDkeys.Contains(system)) - packs.Add("dkeys", this.DownloadPack(wc, packDkeysUrl, system, "Decrypted KEYS")); - - if (Extensions.HasGdi.Contains(system)) - packs.Add("gdi", this.DownloadPack(wc, packGdiUrl, system, "GDIs")); - - if (Extensions.HasKeys.Contains(system)) - packs.Add("keys", this.DownloadPack(wc, packKeysUrl, system, "KEYS")); - - if (Extensions.HasSbi.Contains(system)) - packs.Add("sbi", this.DownloadPack(wc, packSbiUrl, system, "SBIs")); - } - - /// - /// Get the list of IDs that associate with a given string - /// - /// CookieAwareWebClient to hold the login state - /// Value to search for in Redump - /// A list of IDs associated with that value - public List ProcessSearch(CookieAwareWebClient wc, string query) - { - List ids = new List(); - query = query.ToLowerInvariant().Replace(' ', '-'); - - // Keep getting quicksearch pages until there are none left - int pageNumber = 1; - while (true) - { - List pageIds = CheckSingleSitePage(wc, string.Format(quickSearchUrl, query, pageNumber++)); - ids.AddRange(pageIds); - if (pageIds.Count < 2) - break; - } - - return ids; - } - - /// - /// Get the list of IDs associated with the given user - /// - /// CookieAwareWebClient to hold the login state - /// Redump username to get the list of IDs for - /// A list of IDs associated with that user - private List ProcessUser(CookieAwareWebClient wc, string username) - { - List ids = new List(); - - // Keep getting user pages until there are none left - int pageNumber = 1; - while (true) - { - List pageIds = CheckSingleSitePage(wc, string.Format(userDumpsUrl, username, pageNumber++)); - ids.AddRange(pageIds); - if (pageIds.Count < 2) - break; - } - - return ids; - } - - #endregion - - #region Single item processing - - /// - /// Process a Redump site page as a list of possible IDs or disc page - /// - /// CookieAwareWebClient to access the pages - /// Page URL to check and parse - /// List of matching IDs - private List CheckSingleSitePage(CookieAwareWebClient wc, string url) - { - List ids = new List(); - - var dumpsPage = wc.DownloadString(url); - - // If we have no dumps left - if (dumpsPage.Contains("No discs found.")) - return ids; - - // If we have a single disc page already - if (dumpsPage.Contains("Download:")) - { - var value = Regex.Match(dumpsPage, @"/disc/(\d+)/sfv/").Groups[1].Value; - if (Int32.TryParse(value, out int id)) - ids.Add(id); - - return ids; - } - - // Otherwise, traverse each dump on the page - var matches = discRegex.Matches(dumpsPage); - foreach (Match match in matches) - { - try - { - if (Int32.TryParse(match.Groups[1].Value, out int value)) - ids.Add(value); - } - catch (Exception ex) - { - Console.WriteLine($"An exception has occurred: {ex}"); - continue; - } - } - - return ids; - } - - /// - /// Process a Redump WIP page as a list of possible IDs or disc page - /// - /// CookieAwareWebClient to access the pages - /// Page URL to check and parse - /// List of matching IDs - private List CheckSingleWIPPage(CookieAwareWebClient wc, string url) - { - List ids = new List(); - - var wipDumpsPage = wc.DownloadString(url); - - // If we have no WIP dumps left - if (wipDumpsPage.Contains("No WIP discs found.")) - return ids; - - // Otherwise, traverse each dump on the page - var matches = newDiscRegex.Matches(wipDumpsPage); - foreach (Match match in matches) - { - try - { - if (Int32.TryParse(match.Groups[1].Value, out int value)) - ids.Add(value); - } - catch (Exception ex) - { - Console.WriteLine($"An exception has occurred: {ex}"); - continue; - } - } - - return ids; - } - - /// - /// Download an individual pack - /// - /// CookieAwareWebClient to access the packs - /// Base URL to download using - /// System to download packs for - /// Name of the pack that is downloading - private byte[] DownloadPack(CookieAwareWebClient wc, string url, RedumpSystem system, string title) - { - Console.WriteLine($"Downloading {title}"); - Console.Write($"\r{system.LongName()}{new string(' ', Console.BufferWidth - system.LongName().Length - 1)}"); - var pack = wc.DownloadData(string.Format(url, system.ShortName())); - - Console.Write($"\rComplete!{new string(' ', Console.BufferWidth - 10)}"); - Console.WriteLine(); - - return pack; - } - - /// - /// Download a set of packs - /// - /// CookieAwareWebClient to access the packs - /// Base URL to download using - /// List of systems to download packs for - /// Name of the pack that is downloading - private Dictionary DownloadPacks(CookieAwareWebClient wc, string url, RedumpSystem[] systems, string title) - { - var dict = new Dictionary(); - - Console.WriteLine($"Downloading {title}"); - foreach (var system in systems) - { - Console.Write($"\r{system.LongName()}{new string(' ', Console.BufferWidth - system.LongName().Length - 1)}"); - dict.Add(system, wc.DownloadData(string.Format(url, system.ShortName()))); - } - - Console.Write($"\rComplete!{new string(' ', Console.BufferWidth - 10)}"); - Console.WriteLine(); - - return dict; - } - - /// - /// Download an individual site ID page as a string, if possible - /// - /// CookieAwareWebClient to access the pages - /// Redump disc ID to retrieve - /// Disc page as a string, null on error - public string DownloadSingleSiteID(CookieAwareWebClient wc, int id) - { - string paddedId = id.ToString().PadLeft(5, '0'); - Console.WriteLine($"Processing ID: {paddedId}"); - try - { - string discPage = wc.DownloadString(string.Format(discPageUrl, +id)); - if (discPage.Contains($"Disc with ID \"{id}\" doesn't exist")) - return null; - else - return discPage; - } - catch (Exception ex) - { - Console.WriteLine($"An exception has occurred: {ex}"); - return null; - } - } - - /// - /// Download an individual WIP ID page as a string, if possible - /// - /// CookieAwareWebClient to access the pages - /// Redump disc ID to retrieve - /// WIP disc page as a string, null on error - private string DownloadSingleWIPID(CookieAwareWebClient wc, int id) - { - string paddedId = id.ToString().PadLeft(5, '0'); - Console.WriteLine($"Processing WIP ID: {paddedId}"); - try - { - string discPage = wc.DownloadString(string.Format(wipDiscPageUrl, +id)); - if (discPage.Contains($"WIP Disc with ID \"{id}\" doesn't exist")) - return null; - else - return discPage; - } - catch (Exception ex) - { - Console.WriteLine($"An exception has occurred: {ex}"); - return null; - } - } - - #endregion - } -} diff --git a/DICUI.Library/Web/RedumpWebClient.cs b/DICUI.Library/Web/RedumpWebClient.cs new file mode 100644 index 00000000..cc81c015 --- /dev/null +++ b/DICUI.Library/Web/RedumpWebClient.cs @@ -0,0 +1,1164 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; + +namespace DICUI.Web +{ + // https://stackoverflow.com/questions/1777221/using-cookiecontainer-with-webclient-class + public class RedumpWebClient : WebClient + { + #region Regular Expressions + + /// + /// Regex matching the added field on a disc page + /// + private Regex addedRegex = new Regex(@"Added(.*?)"); + + /// + /// Regex matching the barcode field on a disc page + /// + private Regex barcodeRegex = new Regex(@"Barcode(.*?)"); + + /// + /// Regex matching the BCA field on a disc page + /// + private Regex bcaRegex = new Regex(@"

BCA .*?/>

" + + "RowContentsASCII" + + "(?.*?)(?.*?)(?.*?)" + + "(?.*?)(?.*?)(?.*?)" + + "(?.*?)(?.*?)(?.*?)" + + "(?.*?)(?.*?)(?.*?)"); + + /// + /// Regex matching the category field on a disc page + /// + private Regex categoryRegex = new Regex(@"Category(.*?)"); + + /// + /// Regex matching the comments field on a disc page + /// + private Regex commentsRegex = new Regex(@"Comments(.*?)"); + + /// + /// Regex matching the contents field on a disc page + /// + private Regex contentsRegex = new Regex(@"Contents(.*?)"); + + /// + /// Regex matching individual disc links on a results page + /// + private Regex discRegex = new Regex(@"
"); + + /// + /// Regex matching the disc number or letter field on a disc page + /// + private Regex discNumberLetterRegex = new Regex(@"\((.*?)\)"); + + /// + /// Regex matching the dumpers on a disc page + /// + private Regex dumpersRegex = new Regex(@""); + + /// + /// Regex matching the edition field on a disc page + /// + private Regex editionRegex = new Regex(@"Edition(.*?)"); + + /// + /// Regex matching the error count field on a disc page + /// + private Regex errorCountRegex = new Regex(@"Errors count(.*?)"); + + /// + /// Regex matching the foreign title field on a disc page + /// + private Regex foreignTitleRegex = new Regex(@"

(.*?)

"); + + /// + /// Regex matching the "full match" ID list from a WIP disc page + /// + private Regex fullMatchRegex = new Regex(@"full match ids: (.*?)"); + + /// + /// Regex matching the languages field on a disc page + /// + private Regex languagesRegex = new Regex(@"\s*"); + + /// + /// Regex matching the last modified field on a disc page + /// + private Regex lastModifiedRegex = new Regex(@"Last modified(.*?)"); + + /// + /// Regex matching the media field on a disc page + /// + private Regex mediaRegex = new Regex(@"Media(.*?)"); + + /// + /// Regex matching individual WIP disc links on a results page + /// + private Regex newDiscRegex = new Regex(@"
"); + + /// + /// Regex matching the "partial match" ID list from a WIP disc page + /// + private Regex partialMatchRegex = new Regex(@"partial match ids: (.*?)"); + + /// + /// Regex matching the PVD field on a disc page + /// + private Regex pvdRegex = new Regex(@"

Primary Volume Descriptor (PVD)

" + + @"Record / EntryContentsDateTimeGMT" + + @"Creation(?.*?)(?.*?)(?.*?)(?.*?)" + + @"Modification(?.*?)(?.*?)(?.*?)(?.*?)" + + @"Expiration(?.*?)(?.*?)(?.*?)(?.*?)" + + @"Effective(?.*?)(?.*?)(?.*?)(?.*?)"); + + /// + /// Regex matching the region field on a disc page + /// + private Regex regionRegex = new Regex(@"Region
"); + + /// + /// Regex matching a double-layer disc ringcode information + /// + private Regex ringCodeDoubleRegex = new Regex(@""); // Varies based on available fields, like Addtional Mould + + /// + /// Regex matching a single-layer disc ringcode information + /// + private Regex ringCodeSingleRegex = new Regex(@""); // Varies based on available fields, like Addtional Mould + + /// + /// Regex matching the serial field on a disc page + /// + private Regex serialRegex = new Regex(@"Serial(.*?)"); + + /// + /// Regex matching the system field on a disc page + /// + private Regex systemRegex = new Regex(@"System"); + + /// + /// Regex matching the title field on a disc page + /// + private Regex titleRegex = new Regex(@"

(.*?)

"); + + /// + /// Regex matching the current nonce token for login + /// + private Regex tokenRegex = new Regex(@""); + + /// + /// Regex matching a single track on a disc page + /// + private Regex trackRegex = new Regex(@"(?.*?)(?.*?)(?.*?)(?.*?)(?.*?)(?.*?)(?.*?)(?.*?)(?.*?)"); + + /// + /// Regex matching the track count on a disc page + /// + private Regex trackCountRegex = new Regex(@"Number of tracks(.*?)"); + + /// + /// Regex matching the version field on a disc page + /// + private Regex versionRegex = new Regex(@"Version(.*?)"); + + /// + /// Regex matching the write offset field on a disc page + /// + private Regex writeOffsetRegex = new Regex(@"Write offset(.*?)"); + + #endregion + + #region URLs + + /// + /// Redump disc page URL template + /// + private const string discPageUrl = @"http://redump.org/disc/{0}/"; + + /// + /// Redump last modified search URL + /// + private const string lastModifiedUrl = @"http://redump.org/discs/sort/modified/dir/desc?page={0}"; + + /// + /// Redump login page URL + /// + private const string loginUrl = "http://forum.redump.org/login/"; + + /// + /// Redump CUE pack URL template + /// + private const string packCuesUrl = @"http://redump.org/cues/{0}/"; + + /// + /// Redump DAT pack URL template + /// + private const string packDatfileUrl = @"http://redump.org/datfile/{0}/"; + + /// + /// Redump DKEYS pack URL template + /// + private const string packDkeysUrl = @"http://redump.org/dkeys/{0}/"; + + /// + /// Redump GDI pack URL template + /// + private const string packGdiUrl = @"http://redump.org/gdi/{0}/"; + + /// + /// Redump KEYS pack URL template + /// + private const string packKeysUrl = @"http://redump.org/keys/{0}/"; + + /// + /// Redump LSD pack URL template + /// + private const string packLsdUrl = @"http://redump.org/lsd/{0}/"; + + /// + /// Redump SBI pack URL template + /// + private const string packSbiUrl = @"http://redump.org/sbi/{0}/"; + + /// + /// Redump quicksearch URL template + /// + private const string quickSearchUrl = @"http://redump.org/discs/quicksearch/{0}/?page={1}"; + + /// + /// Redump user dumps URL template + /// + private const string userDumpsUrl = @"http://redump.org/discs/dumper/{0}/?page={1}"; + + /// + /// Redump WIP disc page URL template + /// + private const string wipDiscPageUrl = @"http://redump.org/newdisc/{0}/"; + + /// + /// Redump WIP dumps queue URL + /// + private const string wipDumpsUrl = @"http://redump.org/discs-wip/"; + + #endregion + + #region URL Extensions + + private const string changesExt = "/changes/"; + private const string cueExt = "cue/"; + private const string gdiExt = "gdi/"; + private const string keyExt = "key/"; + private const string lsdExt = "lsd/"; + private const string md5Ext = "md5/"; + private const string sbiExt = "sbi/"; + private const string sfvExt = "sfv/"; + private const string sha1Ext = "sha1/"; + + #endregion + + private readonly CookieContainer m_container = new CookieContainer(); + + /// + /// Determines if user is logged into Redump + /// + public bool LoggedIn { get; set; } = false; + + /// + /// Determines if the user is a staff member + /// + public bool IsStaff { get; set; } = false; + + /// + /// Get the last downloaded filename, if possible + /// + /// + public string GetLastFilename() + { + // Try to extract the filename from the Content-Disposition header + if (!String.IsNullOrEmpty(this.ResponseHeaders["Content-Disposition"])) + return this.ResponseHeaders["Content-Disposition"].Substring(this.ResponseHeaders["Content-Disposition"].IndexOf("filename=") + 9).Replace("\"", ""); + + return null; + } + + protected override WebRequest GetWebRequest(Uri address) + { + WebRequest request = base.GetWebRequest(address); + HttpWebRequest webRequest = request as HttpWebRequest; + if (webRequest != null) + { + webRequest.CookieContainer = m_container; + } + + return request; + } + + #region Features + + /// + /// Login to Redump, if possible + /// + /// Redump username + /// Redump password + /// True if the user could be logged in, false otherwise, false otherwise + public bool Login(string username, string password) + { + // Credentials verification + if (!string.IsNullOrWhiteSpace(username) && !string.IsNullOrWhiteSpace(password)) + { + Console.WriteLine("Credentials entered, will attempt Redump login..."); + return false; + } + else if (!string.IsNullOrWhiteSpace(username) && string.IsNullOrWhiteSpace(password)) + { + Console.WriteLine("Only a username was specified, will not attempt Redump login..."); + return false; + } + else if (string.IsNullOrWhiteSpace(username)) + { + Console.WriteLine("No credentials entered, will not attempt Redump login..."); + return false; + } + + // Get the current token from the login page + var loginPage = DownloadString(loginUrl); + string token = this.tokenRegex.Match(loginPage).Groups[1].Value; + + // Construct the login request + Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; + Encoding = Encoding.UTF8; + var response = UploadString(loginUrl, $"form_sent=1&redirect_url=&csrf_token={token}&req_username={username}&req_password={password}&save_pass=0"); + + if (response.Contains("Incorrect username and/or password.")) + { + Console.WriteLine("Invalid credentials entered, continuing without logging in..."); + return false; + } + else + { + Console.WriteLine("Credentials accepted! Logged into Redump..."); + } + + // If the user is a moderator or staff, set accordingly + if (response.Contains("http://forum.redump.org/forum/9/staff/")) + IsStaff = true; + + return true; + } + + /// + /// Download the last modified disc pages, until first failure + /// + /// Output directory to save data to + public void DownloadLastModified(string outDir) + { + // Keep getting last modified pages until there are none left + int pageNumber = 1; + while (true) + { + if (!CheckSingleSitePage(string.Format(lastModifiedUrl, pageNumber++), outDir, true)) + break; + } + } + + /// + /// Download the last submitted WIP disc pages + /// + /// Output directory to save data to + public void DownloadLastSubmitted(string outDir) + { + CheckSingleWIPPage(wipDumpsUrl, outDir, false); + } + + /// + /// Download premade packs + /// + /// Output directory to save data to + /// 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); + } + + /// + /// Download premade packs for an individual system + /// + /// RedumpSystem to get all possible packs for + /// Output directory to save data to + /// True to use named subfolders to store downloads, false to store directly in the output directory + public void DownloadPacksForSystem(RedumpSystem system, string outDir, bool useSubfolders) + { + RedumpSystem?[] systemAsArray = new RedumpSystem?[] { system }; + + if (Extensions.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 (Extensions.HasDkeys.Contains(system)) + this.DownloadPacks(packCuesUrl, Extensions.HasDkeys, "Decrypted KEYS", outDir, useSubfolders ? "dkey" : null); + + if (Extensions.HasGdi.Contains(system)) + this.DownloadPacks(packCuesUrl, Extensions.HasGdi, "GDIs", outDir, useSubfolders ? "gdi" : null); + + if (Extensions.HasKeys.Contains(system)) + this.DownloadPacks(packCuesUrl, Extensions.HasKeys, "KEYS", outDir, useSubfolders ? "keys" : null); + + if (Extensions.HasLsd.Contains(system)) + this.DownloadPacks(packCuesUrl, Extensions.HasKeys, "LSD", outDir, useSubfolders ? "lsd" : null); + + if (Extensions.HasSbi.Contains(system)) + this.DownloadPacks(packCuesUrl, Extensions.HasSbi, "SBIs", outDir, useSubfolders ? "sbi" : null); + } + + /// + /// Download the disc pages associated with a given quicksearch query + /// + /// Query string to attempt to search for + public Dictionary DownloadSearchResults(string query) + { + Dictionary resultPages = new Dictionary(); + + // Strip quotes + query = query.Trim('"', '\''); + + // Special characters become dashes + query = query.Replace(' ', '-'); + query = query.Replace('/', '-'); + query = query.Replace('\\', '/'); + + // Lowercase is defined per language + query = query.ToLowerInvariant(); + + // Keep getting quicksearch pages until there are none left + int pageNumber = 1; + while (true) + { + List pageIds = CheckSingleSitePage(string.Format(quickSearchUrl, query, pageNumber++)); + foreach (int pageId in pageIds) + { + resultPages[pageId] = DownloadSingleSiteID(pageId); + } + + if (pageIds.Count <= 1) + break; + } + + return resultPages; + } + + /// + /// Download the disc pages associated with a given quicksearch query + /// + /// Query string to attempt to search for + /// Output directory to save data to + public void DownloadSearchResults(string query, string outDir) + { + // Strip quotes + query = query.Trim('"', '\''); + + // Special characters become dashes + query = query.Replace(' ', '-'); + query = query.Replace('/', '-'); + query = query.Replace('\\', '/'); + + // Lowercase is defined per language + query = query.ToLowerInvariant(); + + // Keep getting quicksearch pages until there are none left + int pageNumber = 1; + while (true) + { + if (!CheckSingleSitePage(string.Format(quickSearchUrl, query, pageNumber++), outDir, false)) + break; + } + } + + /// + /// Download the specified range of site disc pages + /// + /// Output directory to save data to + /// Starting ID for the range + /// Ending ID for the range (inclusive) + public void DownloadSiteRange(string outDir, int minId = 0, int maxId = 0) + { + if (!LoggedIn) + { + Console.WriteLine("Site download functionality is only available to Redump members"); + return; + } + + for (int id = minId; id <= maxId; id++) + { + if (DownloadSingleSiteID(id, outDir, true)) + Thread.Sleep(5 * 1000); // Intentional sleep here so we don't flood the server + } + } + + /// + /// Download the disc pages associated with the given user + /// + /// Username to check discs for + /// Output directory to save data to + public void DownloadUser(string username, string outDir) + { + if (!LoggedIn) + { + Console.WriteLine("User download functionality is only available to Redump members"); + return; + } + + // Keep getting user pages until there are none left + int pageNumber = 1; + while (true) + { + if (!CheckSingleSitePage(string.Format(userDumpsUrl, username, pageNumber++), outDir, false)) + break; + } + } + + /// + /// Download the specified range of WIP disc pages + /// + /// RedumpWebClient for all access + /// Output directory to save data to + /// Starting ID for the range + /// Ending ID for the range (inclusive) + public void DownloadWIPRange(string outDir, int minId = 0, int maxId = 0) + { + if (!LoggedIn || !IsStaff) + { + Console.WriteLine("WIP download functionality is only available to Redump moderators"); + return; + } + + for (int id = minId; id <= maxId; id++) + { + if (DownloadSingleWIPID(id, outDir, true)) + Thread.Sleep(5 * 1000); // Intentional sleep here so we don't flood the server + } + } + + /// + /// List the disc IDs associated with a given quicksearch query + /// + /// Query string to attempt to search for + /// All disc IDs for the given query, empty on error + public List ListSearchResults(string query) + { + List ids = new List(); + + // Strip quotes + query = query.Trim('"', '\''); + + // Special characters become dashes + query = query.Replace(' ', '-'); + query = query.Replace('/', '-'); + query = query.Replace('\\', '/'); + + // Lowercase is defined per language + query = query.ToLowerInvariant(); + + // Keep getting quicksearch pages until there are none left + int pageNumber = 1; + while (true) + { + List pageIds = CheckSingleSitePage(string.Format(quickSearchUrl, query, pageNumber++)); + ids.AddRange(pageIds); + if (pageIds.Count <= 1) + break; + } + + return ids; + } + + /// + /// List the disc IDs associated with the given user + /// + /// Username to check discs for + /// All disc IDs for the given user, empty on error + public List ListUser(RedumpWebClient wc, string username) + { + List ids = new List(); + + if (!wc.LoggedIn) + { + Console.WriteLine("User download functionality is only available to Redump members"); + return ids; + } + + // Keep getting user pages until there are none left + int pageNumber = 1; + while (true) + { + List pageIds = wc.CheckSingleSitePage(string.Format(userDumpsUrl, username, pageNumber++)); + ids.AddRange(pageIds); + if (pageIds.Count <= 1) + break; + } + + return ids; + } + + #endregion + + #region Single Page Helpers + + /// + /// Process a Redump site page as a list of possible IDs or disc page + /// + /// Base URL to download using + /// List of IDs from the page, empty on error + internal List CheckSingleSitePage(string url) + { + List ids = new List(); + var dumpsPage = DownloadString(url); + + // If we have no dumps left + if (dumpsPage.Contains("No discs found.")) + return ids; + + // If we have a single disc page already + if (dumpsPage.Contains("Download:")) + { + var value = Regex.Match(dumpsPage, @"/disc/(\d+)/sfv/").Groups[1].Value; + if (int.TryParse(value, out int id)) + ids.Add(id); + + return ids; + } + + // Otherwise, traverse each dump on the page + var matches = discRegex.Matches(dumpsPage); + foreach (Match match in matches) + { + try + { + if (int.TryParse(match.Groups[1].Value, out int value)) + ids.Add(value); + } + catch (Exception ex) + { + Console.WriteLine($"An exception has occurred: {ex}"); + continue; + } + } + + return ids; + } + + /// + /// Process a Redump site page as a list of possible IDs or disc page + /// + /// Base URL to download using + /// Output directory to save data to + /// True to return on first error, false otherwise + /// True if the page could be downloaded, false otherwise + internal bool CheckSingleSitePage(string url, string outDir, bool failOnSingle) + { + var dumpsPage = DownloadString(url); + + // If we have no dumps left + if (dumpsPage.Contains("No discs found.")) + return false; + + // If we have a single disc page already + if (dumpsPage.Contains("Download:")) + { + var value = Regex.Match(dumpsPage, @"/disc/(\d+)/sfv/").Groups[1].Value; + if (int.TryParse(value, out int id)) + { + bool downloaded = DownloadSingleSiteID(id, outDir, false); + if (!downloaded && failOnSingle) + return false; + } + + return false; + } + + // Otherwise, traverse each dump on the page + var matches = discRegex.Matches(dumpsPage); + foreach (Match match in matches) + { + try + { + if (int.TryParse(match.Groups[1].Value, out int value)) + { + bool downloaded = DownloadSingleSiteID(value, outDir, false); + if (!downloaded && failOnSingle) + return false; + } + } + catch (Exception ex) + { + Console.WriteLine($"An exception has occurred: {ex}"); + continue; + } + } + + return true; + } + + /// + /// Process a Redump WIP page as a list of possible IDs or disc page + /// + /// RedumpWebClient to access the packs + /// List of IDs from the page, empty on error + internal List CheckSingleWIPPage(string url) + { + List ids = new List(); + var dumpsPage = DownloadString(url); + + // If we have no dumps left + if (dumpsPage.Contains("No discs found.")) + return ids; + + // Otherwise, traverse each dump on the page + var matches = newDiscRegex.Matches(dumpsPage); + foreach (Match match in matches) + { + try + { + if (int.TryParse(match.Groups[1].Value, out int value)) + ids.Add(value); + } + catch (Exception ex) + { + Console.WriteLine($"An exception has occurred: {ex}"); + continue; + } + } + + return ids; + } + + /// + /// Process a Redump WIP page as a list of possible IDs or disc page + /// + /// RedumpWebClient to access the packs + /// Output directory to save data to + /// True to return on first error, false otherwise + /// True if the page could be downloaded, false otherwise + internal bool CheckSingleWIPPage(string url, string outDir, bool failOnSingle) + { + var dumpsPage = DownloadString(url); + + // If we have no dumps left + if (dumpsPage.Contains("No discs found.")) + return false; + + // Otherwise, traverse each dump on the page + var matches = newDiscRegex.Matches(dumpsPage); + foreach (Match match in matches) + { + try + { + if (int.TryParse(match.Groups[1].Value, out int value)) + { + bool downloaded = DownloadSingleWIPID(value, outDir, false); + if (!downloaded && failOnSingle) + return false; + } + } + catch (Exception ex) + { + Console.WriteLine($"An exception has occurred: {ex}"); + continue; + } + } + + return true; + } + + #endregion + + #region Download Helpers + + /// + /// Download a single pack + /// + /// Base URL to download using + /// System to download packs for + /// Byte array containing the downloaded pack, null on error + internal byte[] DownloadSinglePack(string url, RedumpSystem? system) + { + try + { + return DownloadData(string.Format(url, system.ShortName())); + } + catch (Exception ex) + { + Console.WriteLine($"An exception has occurred: {ex}"); + return null; + } + } + + /// + /// Download a single pack + /// + /// Base URL to download using + /// System to download packs for + /// Output directory to save data to + /// Named subfolder for the pack, used optionally + internal void DownloadSinglePack(string url, RedumpSystem? system, string outDir, string subfolder) + { + try + { + string tempfile = Path.Combine(outDir, "tmp" + Guid.NewGuid().ToString()); + DownloadFile(string.Format(url, system.ShortName()), tempfile); + MoveOrDelete(tempfile, GetLastFilename(), outDir, subfolder); + } + catch (Exception ex) + { + Console.WriteLine($"An exception has occurred: {ex}"); + } + } + + /// + /// Download an individual site ID data, if possible + /// + /// Redump disc ID to retrieve + /// String containing the page contents if successful, null on error + internal string DownloadSingleSiteID(int id) + { + string paddedId = id.ToString().PadLeft(5, '0'); + Console.WriteLine($"Processing ID: {paddedId}"); + try + { + string discPage = DownloadString(string.Format(discPageUrl, +id)); + if (discPage.Contains($"Disc with ID \"{id}\" doesn't exist")) + { + Console.WriteLine($"ID {paddedId} could not be found!"); + return null; + } + + Console.WriteLine($"ID {paddedId} has been successfully downloaded"); + return discPage; + } + catch (Exception ex) + { + Console.WriteLine($"An exception has occurred: {ex}"); + return null; + } + } + + /// + /// Download an individual site ID data, if possible + /// + /// Redump disc ID to retrieve + /// Output directory to save data to + /// True to rename deleted entries, false otherwise + /// True if all data was downloaded, false otherwise + internal bool DownloadSingleSiteID(int id, string outDir, bool rename) + { + string paddedId = id.ToString().PadLeft(5, '0'); + string paddedIdDir = Path.Combine(outDir, paddedId); + Console.WriteLine($"Processing ID: {paddedId}"); + try + { + string discPage = DownloadString(string.Format(discPageUrl, +id)); + if (discPage.Contains($"Disc with ID \"{id}\" doesn't exist")) + { + try + { + if (rename) + { + if (Directory.Exists(paddedIdDir) && rename) + Directory.Move(paddedIdDir, paddedIdDir + "-deleted"); + else + Directory.CreateDirectory(paddedIdDir + "-deleted"); + } + } + catch { } + + Console.WriteLine($"ID {paddedId} could not be found!"); + return false; + } + + // Check if the page has been updated since the last time it was downloaded, if possible + if (File.Exists(Path.Combine(paddedIdDir, "disc.html"))) + { + // Read in the cached file + var oldDiscPage = File.ReadAllText(Path.Combine(paddedIdDir, "disc.html")); + + // Check for the last modified date in both pages + var oldResult = lastModifiedRegex.Match(oldDiscPage); + var newResult = lastModifiedRegex.Match(discPage); + + // If both pages contain the same modified date, skip it + if (oldResult.Success && newResult.Success && oldResult.Groups[1].Value == newResult.Groups[1].Value) + { + Console.WriteLine($"ID {paddedId} has not been changed since last download"); + return false; + } + + // If neither page contains a modified date, skip it + else if (!oldResult.Success && !newResult.Success) + { + Console.WriteLine($"ID {paddedId} has not been changed since last download"); + return false; + } + } + + // Create ID subdirectory + Directory.CreateDirectory(paddedIdDir); + + // HTML + using (var discStreamWriter = File.CreateText(Path.Combine(paddedIdDir, "disc.html"))) + { + discStreamWriter.Write(discPage); + } + + DownloadFile(string.Format(discPageUrl, +id) + changesExt, Path.Combine(paddedIdDir, "changes.html")); + + // CUE + if (discPage.Contains($"
+ /// Download an individual WIP ID data, if possible + /// + /// Redump WIP disc ID to retrieve + /// String containing the page contents if successful, null on error + internal string DownloadSingleWIPID(int id) + { + string paddedId = id.ToString().PadLeft(5, '0'); + Console.WriteLine($"Processing ID: {paddedId}"); + try + { + string discPage = DownloadString(string.Format(wipDiscPageUrl, +id)); + if (discPage.Contains($"System \"{id}\" doesn't exist")) + { + Console.WriteLine($"ID {paddedId} could not be found!"); + return null; + } + + Console.WriteLine($"ID {paddedId} has been successfully downloaded"); + return discPage; + } + catch (Exception ex) + { + Console.WriteLine($"An exception has occurred: {ex}"); + return null; + } + } + + /// + /// Download an individual WIP ID data, if possible + /// + /// Redump WIP disc ID to retrieve + /// Output directory to save data to + /// True to rename deleted entries, false otherwise + /// True if all data was downloaded, false otherwise + internal bool DownloadSingleWIPID(int id, string outDir, bool rename) + { + string paddedId = id.ToString().PadLeft(5, '0'); + string paddedIdDir = Path.Combine(outDir, paddedId); + Console.WriteLine($"Processing ID: {paddedId}"); + try + { + string discPage = DownloadString(string.Format(wipDiscPageUrl, +id)); + if (discPage.Contains($"System \"{id}\" doesn't exist")) + { + try + { + if (rename) + { + if (Directory.Exists(paddedIdDir) && rename) + Directory.Move(paddedIdDir, paddedIdDir + "-deleted"); + else + Directory.CreateDirectory(paddedIdDir + "-deleted"); + } + } + catch { } + + Console.WriteLine($"ID {paddedId} could not be found!"); + return false; + } + + // Check if the page has been updated since the last time it was downloaded, if possible + if (File.Exists(Path.Combine(paddedIdDir, "disc.html"))) + { + // Read in the cached file + var oldDiscPage = File.ReadAllText(Path.Combine(paddedIdDir, "disc.html")); + + // Check for the full match ID in both pages + var oldResult = fullMatchRegex.Match(oldDiscPage); + var newResult = fullMatchRegex.Match(discPage); + + // If both pages contain the same ID, skip it + if (oldResult.Success && newResult.Success && oldResult.Groups[1].Value == newResult.Groups[1].Value) + { + Console.WriteLine($"ID {paddedId} has not been changed since last download"); + return false; + } + + // If neither page contains an ID, skip it + else if (!oldResult.Success && !newResult.Success) + { + Console.WriteLine($"ID {paddedId} has not been changed since last download"); + return false; + } + } + + // Create ID subdirectory + Directory.CreateDirectory(paddedIdDir); + + // HTML + using (var discStreamWriter = File.CreateText(Path.Combine(paddedIdDir, "disc.html"))) + { + discStreamWriter.Write(discPage); + } + + Console.WriteLine($"ID {paddedId} has been successfully downloaded"); + return true; + } + catch (Exception ex) + { + Console.WriteLine($"An exception has occurred: {ex}"); + return false; + } + } + + #endregion + + #region Internal Helpers + + /// + /// Download a set of packs + /// + /// Base URL to download using + /// Systems to download packs for + /// Name of the pack that is downloading + internal Dictionary DownloadPacks(string url, RedumpSystem?[] systems, string title) + { + var packsDictionary = new Dictionary(); + + // If we didn't have credentials + if (!LoggedIn) + systems = systems.Where(s => !Extensions.BannedSystems.Contains(s)).ToArray(); + + Console.WriteLine($"Downloading {title}"); + foreach (var system in systems) + { + Console.Write($"\r{system.LongName()}{new string(' ', Console.BufferWidth - system.LongName().Length - 1)}"); + byte[] pack = DownloadSinglePack(url, system); + if (pack != null) + packsDictionary.Add(system, pack); + } + + Console.Write($"\rComplete!{new string(' ', Console.BufferWidth - 10)}"); + Console.WriteLine(); + + return packsDictionary; + } + + /// + /// Download a set of packs + /// + /// Base URL to download using + /// Systems to download packs for + /// Name of the pack that is downloading + /// Output directory to save data to + /// Named subfolder for the pack, used optionally + internal void DownloadPacks(string url, RedumpSystem?[] systems, string title, string outDir, string subfolder) + { + // If we didn't have credentials + if (!LoggedIn) + systems = systems.Where(s => !Extensions.BannedSystems.Contains(s)).ToArray(); + + Console.WriteLine($"Downloading {title}"); + foreach (var system in systems) + { + Console.Write($"\r{system.LongName()}{new string(' ', Console.BufferWidth - system.LongName().Length - 1)}"); + DownloadSinglePack(url, system, outDir, subfolder); + } + + Console.Write($"\rComplete!{new string(' ', Console.BufferWidth - 10)}"); + Console.WriteLine(); + } + + /// + /// Move a tempfile to a new name unless it aleady exists, in which case, delete the tempfile + /// + /// Path to existing temporary file + /// Path to new output file + /// Output directory to save data to + /// Optional subfolder to append to the path + private void MoveOrDelete(string tempfile, string newfile, string outDir, string subfolder) + { + if (!string.IsNullOrWhiteSpace(newfile)) + { + if (!string.IsNullOrWhiteSpace(subfolder)) + { + if (!Directory.Exists(Path.Combine(outDir, subfolder))) + Directory.CreateDirectory(Path.Combine(outDir, subfolder)); + + newfile = Path.Combine(subfolder, newfile); + } + + if (File.Exists(Path.Combine(outDir, newfile))) + File.Delete(tempfile); + else + File.Move(tempfile, Path.Combine(outDir, newfile)); + } + else + File.Delete(tempfile); + } + + #endregion + } +} diff --git a/DICUI/ComboBoxItems/CategoryComboBoxItem.cs b/DICUI/ComboBoxItems/CategoryComboBoxItem.cs index 0f207ab6..582f2bc3 100644 --- a/DICUI/ComboBoxItems/CategoryComboBoxItem.cs +++ b/DICUI/ComboBoxItems/CategoryComboBoxItem.cs @@ -1,5 +1,5 @@ -using DICUI.Data; -using DICUI.Utilities; +using DICUI.Utilities; +using DICUI.Web; namespace DICUI { diff --git a/DICUI/ComboBoxItems/LanguageComboBoxItem.cs b/DICUI/ComboBoxItems/LanguageComboBoxItem.cs index c91f767b..4f84012e 100644 --- a/DICUI/ComboBoxItems/LanguageComboBoxItem.cs +++ b/DICUI/ComboBoxItems/LanguageComboBoxItem.cs @@ -1,5 +1,5 @@ -using DICUI.Data; -using DICUI.Utilities; +using DICUI.Utilities; +using DICUI.Web; namespace DICUI { diff --git a/DICUI/ComboBoxItems/RegionComboBoxItem.cs b/DICUI/ComboBoxItems/RegionComboBoxItem.cs index 5450b62e..76e3c380 100644 --- a/DICUI/ComboBoxItems/RegionComboBoxItem.cs +++ b/DICUI/ComboBoxItems/RegionComboBoxItem.cs @@ -1,5 +1,5 @@ -using DICUI.Data; -using DICUI.Utilities; +using DICUI.Utilities; +using DICUI.Web; namespace DICUI { diff --git a/DICUI/Windows/DiscInformationWindow.xaml.cs b/DICUI/Windows/DiscInformationWindow.xaml.cs index 66f9df20..0f8481cb 100644 --- a/DICUI/Windows/DiscInformationWindow.xaml.cs +++ b/DICUI/Windows/DiscInformationWindow.xaml.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Windows; using System.Windows.Media; using DICUI.Data; +using DICUI.Web; namespace DICUI.Windows { diff --git a/DICUI/Windows/MainWindow.xaml.cs b/DICUI/Windows/MainWindow.xaml.cs index 8671b20b..6df41151 100644 --- a/DICUI/Windows/MainWindow.xaml.cs +++ b/DICUI/Windows/MainWindow.xaml.cs @@ -261,7 +261,7 @@ namespace DICUI.Windows string version = $"{assemblyVersion.Major}.{assemblyVersion.Minor}" + (assemblyVersion.MajorRevision != 0 ? $".{assemblyVersion.MajorRevision}" : string.Empty); // Get the latest tag from GitHub - using (var client = new CookieAwareWebClient()) + using (var client = new RedumpWebClient()) { client.Headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0"; diff --git a/DICUI/Windows/OptionsWindow.xaml.cs b/DICUI/Windows/OptionsWindow.xaml.cs index 8e7cad7b..3fe63ff6 100644 --- a/DICUI/Windows/OptionsWindow.xaml.cs +++ b/DICUI/Windows/OptionsWindow.xaml.cs @@ -123,10 +123,9 @@ namespace DICUI.Windows /// private void OnRedumpTestClick(object sender, EventArgs e) { - using (CookieAwareWebClient wc = new CookieAwareWebClient()) + using (RedumpWebClient wc = new RedumpWebClient()) { - RedumpAccess access = new RedumpAccess(); - if (access.RedumpLogin(wc, RedumpUsernameTextBox.Text, RedumpPasswordBox.Password)) + if (wc.Login(RedumpUsernameTextBox.Text, RedumpPasswordBox.Password)) System.Windows.MessageBox.Show("Redump login credentials accepted!", "Success", MessageBoxButton.OK, MessageBoxImage.Information); else System.Windows.MessageBox.Show("Redump login credentials denied!", "Failure", MessageBoxButton.OK, MessageBoxImage.Error);