diff --git a/SabreTools.RedumpLib.Legacy/Attributes/AttributeHelper.cs b/SabreTools.RedumpLib.Legacy/Attributes/AttributeHelper.cs new file mode 100644 index 0000000..8517eef --- /dev/null +++ b/SabreTools.RedumpLib.Legacy/Attributes/AttributeHelper.cs @@ -0,0 +1,47 @@ +using System; + +namespace SabreTools.RedumpLib.Legacy.Attributes +{ + public static class AttributeHelper + { + /// + /// Get the HumanReadableAttribute from a supported value + /// + /// Value to use + /// HumanReadableAttribute attached to the value + public static HumanReadableAttribute? GetHumanReadableAttribute(T value) + { + // Null value in, null value out + if (value is null) + return null; + + // Current enumeration type + var enumType = typeof(T); + if (Nullable.GetUnderlyingType(enumType) is not null) + enumType = Nullable.GetUnderlyingType(enumType); + + // If the value returns a null on ToString, just return null + string? valueStr = value?.ToString(); + if (string.IsNullOrEmpty(valueStr)) + return null; + + // Get the member info array + var memberInfos = enumType?.GetMember(valueStr); + if (memberInfos is null) + return null; + + // Get the enum value info from the array, if possible + var enumValueMemberInfo = Array.Find(memberInfos, m => m.DeclaringType == enumType); + if (enumValueMemberInfo is null) + return null; + + // Try to get the relevant attribute + var attributes = enumValueMemberInfo.GetCustomAttributes(typeof(HumanReadableAttribute), true); + if (attributes is null || attributes.Length == 0) + return null; + + // Return the first attribute, if possible + return attributes[0] as HumanReadableAttribute; + } + } +} diff --git a/SabreTools.RedumpLib.Legacy/Attributes/HumanReadableAttribute.cs b/SabreTools.RedumpLib.Legacy/Attributes/HumanReadableAttribute.cs new file mode 100644 index 0000000..1f9999b --- /dev/null +++ b/SabreTools.RedumpLib.Legacy/Attributes/HumanReadableAttribute.cs @@ -0,0 +1,25 @@ +using System; + +namespace SabreTools.RedumpLib.Legacy.Attributes +{ + /// + /// Generic attribute for human readable values + /// + public class HumanReadableAttribute : Attribute + { + /// + /// Item is marked as obsolete or unusable + /// + public bool Available { get; set; } = true; + + /// + /// Human-readable name of the item + /// + public string? LongName { get; set; } + + /// + /// Internally used name of the item + /// + public string? ShortName { get; set; } + } +} diff --git a/SabreTools.RedumpLib.Legacy/Attributes/LanguageCodeAttribute.cs b/SabreTools.RedumpLib.Legacy/Attributes/LanguageCodeAttribute.cs new file mode 100644 index 0000000..225284c --- /dev/null +++ b/SabreTools.RedumpLib.Legacy/Attributes/LanguageCodeAttribute.cs @@ -0,0 +1,26 @@ +namespace SabreTools.RedumpLib.Legacy.Attributes +{ + /// + /// Attribute specifc to Language values + /// + /// + /// Some languages have multiple proper names. Should all be supported? + /// + public class LanguageCodeAttribute : HumanReadableAttribute + { + /// + /// ISO 639-1 Code + /// + public string? TwoLetterCode { get; set; } + + /// + /// ISO 639-2 Code (Standard or Bibliographic) + /// + public string? ThreeLetterCode { get; set; } + + /// + /// ISO 639-2 Code (Terminology) + /// + public string? ThreeLetterCodeAlt { get; set; } + } +} diff --git a/SabreTools.RedumpLib.Legacy/Attributes/SystemAttribute.cs b/SabreTools.RedumpLib.Legacy/Attributes/SystemAttribute.cs index 06f5b35..3fdcb8b 100644 --- a/SabreTools.RedumpLib.Legacy/Attributes/SystemAttribute.cs +++ b/SabreTools.RedumpLib.Legacy/Attributes/SystemAttribute.cs @@ -1,5 +1,4 @@ -using SabreTools.RedumpLib.Attributes; -using SabreTools.RedumpLib.Data; +using SabreTools.RedumpLib.Legacy.Data; namespace SabreTools.RedumpLib.Legacy.Attributes { diff --git a/SabreTools.RedumpLib.Legacy/Converters/DiscCategoryConverter.cs b/SabreTools.RedumpLib.Legacy/Converters/DiscCategoryConverter.cs new file mode 100644 index 0000000..5bc6cc3 --- /dev/null +++ b/SabreTools.RedumpLib.Legacy/Converters/DiscCategoryConverter.cs @@ -0,0 +1,35 @@ +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using SabreTools.RedumpLib.Legacy.Data; + +namespace SabreTools.RedumpLib.Legacy.Converters +{ + /// + /// Serialize DiscCategory enum values + /// + public class DiscCategoryConverter : JsonConverter + { + public override bool CanRead { get { return true; } } + + public override DiscCategory? ReadJson(JsonReader reader, Type objectType, DiscCategory? existingValue, bool hasExistingValue, JsonSerializer serializer) + { + // If we have a value already, don't overwrite it + if (hasExistingValue) + return existingValue; + + // Read the value + if (reader.Value is not string value) + return null; + + // Try to parse the value + return value.ToDiscCategory(); + } + + public override void WriteJson(JsonWriter writer, DiscCategory? value, JsonSerializer serializer) + { + JToken t = JToken.FromObject(value.LongName() ?? string.Empty); + t.WriteTo(writer); + } + } +} diff --git a/SabreTools.RedumpLib.Legacy/Converters/DiscTypeConverter.cs b/SabreTools.RedumpLib.Legacy/Converters/DiscTypeConverter.cs new file mode 100644 index 0000000..e3ff985 --- /dev/null +++ b/SabreTools.RedumpLib.Legacy/Converters/DiscTypeConverter.cs @@ -0,0 +1,35 @@ +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using SabreTools.RedumpLib.Legacy.Data; + +namespace SabreTools.RedumpLib.Legacy.Converters +{ + /// + /// Serialize DiscType enum values + /// + public class DiscTypeConverter : JsonConverter + { + public override bool CanRead { get { return true; } } + + public override DiscType? ReadJson(JsonReader reader, Type objectType, DiscType? existingValue, bool hasExistingValue, JsonSerializer serializer) + { + // If we have a value already, don't overwrite it + if (hasExistingValue) + return existingValue; + + // Read the value + if (reader.Value is not string value) + return null; + + // Try to parse the value + return value.ToDiscType(); + } + + public override void WriteJson(JsonWriter writer, DiscType? value, JsonSerializer serializer) + { + JToken t = JToken.FromObject(value.ShortName() ?? value.LongName() ?? string.Empty); + t.WriteTo(writer); + } + } +} diff --git a/SabreTools.RedumpLib.Legacy/Converters/LanguageConverter.cs b/SabreTools.RedumpLib.Legacy/Converters/LanguageConverter.cs new file mode 100644 index 0000000..9e58df8 --- /dev/null +++ b/SabreTools.RedumpLib.Legacy/Converters/LanguageConverter.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using SabreTools.RedumpLib.Legacy.Data; + +namespace SabreTools.RedumpLib.Legacy.Converters +{ + /// + /// Serialize Language enum values + /// + public class LanguageConverter : JsonConverter + { + public override bool CanRead { get { return true; } } + + public override Language?[] ReadJson(JsonReader reader, Type objectType, Language?[]? existingValue, bool hasExistingValue, JsonSerializer serializer) + { + // If we have a value already, don't overwrite it + if (hasExistingValue) + return existingValue ?? []; + + // Get the current depth for checking + int currentDepth = reader.Depth; + + // Read the array while it exists + List languages = []; + while (reader.Read() && reader.Depth > currentDepth) + { + if (reader.Value is not string value) + continue; + + Language? lang = value.ToLanguage(); + if (lang is not null) + languages.Add(lang.Value); + } + + return [.. languages]; + } + + public override void WriteJson(JsonWriter writer, Language?[]? value, JsonSerializer serializer) + { + if (value is null) + return; + + JArray array = []; + foreach (var val in value) + { + JToken t = JToken.FromObject(val.ShortName() ?? string.Empty); + array.Add(t); + } + + array.WriteTo(writer); + } + } +} diff --git a/SabreTools.RedumpLib.Legacy/Converters/YesNoConverter.cs b/SabreTools.RedumpLib.Legacy/Converters/YesNoConverter.cs new file mode 100644 index 0000000..0909b0d --- /dev/null +++ b/SabreTools.RedumpLib.Legacy/Converters/YesNoConverter.cs @@ -0,0 +1,36 @@ +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using SabreTools.RedumpLib.Legacy.Data; + +namespace SabreTools.RedumpLib.Legacy.Converters +{ + /// + /// Serialize YesNo enum values + /// + public class YesNoConverter : JsonConverter + { + public override bool CanRead { get { return true; } } + + public override YesNo? ReadJson(JsonReader reader, Type objectType, YesNo? existingValue, bool hasExistingValue, JsonSerializer serializer) + { + // If we have a value already, don't overwrite it + if (hasExistingValue) + return existingValue; + + // Read the value + if (reader.Value is bool bVal) + return bVal.ToYesNo(); + else if (reader.Value is string sVal) + return sVal.ToYesNo(); + + return null; + } + + public override void WriteJson(JsonWriter writer, YesNo? value, JsonSerializer serializer) + { + JToken t = JToken.FromObject(value.LongName() ?? string.Empty); + t.WriteTo(writer); + } + } +} diff --git a/SabreTools.RedumpLib.Legacy/Data/Enumerations.cs b/SabreTools.RedumpLib.Legacy/Data/Enumerations.cs index 1b17e61..8e53925 100644 --- a/SabreTools.RedumpLib.Legacy/Data/Enumerations.cs +++ b/SabreTools.RedumpLib.Legacy/Data/Enumerations.cs @@ -1,10 +1,46 @@ -using SabreTools.RedumpLib.Data; using SabreTools.RedumpLib.Legacy.Attributes; -using HumanReadableAttribute = SabreTools.RedumpLib.Attributes.HumanReadableAttribute; -using LanguageCodeAttribute = SabreTools.RedumpLib.Attributes.LanguageCodeAttribute; namespace SabreTools.RedumpLib.Legacy.Data { + /// + /// List of all disc categories + /// + public enum DiscCategory + { + [HumanReadable(LongName = "Games")] + Games = 1, + + [HumanReadable(LongName = "Demos")] + Demos = 2, + + [HumanReadable(LongName = "Video")] + Video = 3, + + [HumanReadable(LongName = "Audio")] + Audio = 4, + + [HumanReadable(LongName = "Multimedia")] + Multimedia = 5, + + [HumanReadable(LongName = "Applications")] + Applications = 6, + + [HumanReadable(LongName = "Coverdiscs")] + Coverdiscs = 7, + + [HumanReadable(LongName = "Educational")] + Educational = 8, + + [HumanReadable(LongName = "Bonus Discs")] + BonusDiscs = 9, + + [HumanReadable(LongName = "Preproduction")] + Preproduction = 10, + + [HumanReadable(LongName = "Add-Ons")] + AddOns = 11, + } + /// /// List of all disc subpaths /// @@ -45,6 +81,95 @@ namespace SabreTools.RedumpLib.Legacy.Data WIP, } + /// + /// List of all site-supported disc types + /// + public enum DiscType + { + NONE = 0, + + [HumanReadable(LongName = "BD-25", ShortName = "bd25")] + BD25, + + /// Not official + [HumanReadable(LongName = "BD-33", ShortName = "bd33")] + BD33, + + [HumanReadable(LongName = "BD-50", ShortName = "bd50")] + BD50, + + [HumanReadable(LongName = "BD-66", ShortName = "bd66")] + BD66, + + [HumanReadable(LongName = "BD-100", ShortName = "bd100")] + BD100, + + /// Not official + [HumanReadable(LongName = "BD-128", ShortName = "bd128")] + BD128, + + [HumanReadable(LongName = "CD", ShortName = "cd")] + CD, + + [HumanReadable(LongName = "DVD-5", ShortName = "dvd5")] + DVD5, + + [HumanReadable(LongName = "DVD-9", ShortName = "dvd9")] + DVD9, + + [HumanReadable(LongName = "GD-ROM", ShortName = "gdrom")] + GDROM, + + [HumanReadable(LongName = "HD-DVD (SL)", ShortName = "hdvd15")] + HDDVDSL, + + [HumanReadable(LongName = "HD-DVD (DL)", ShortName = "hdvd30")] + HDDVDDL, + + /// Not official + [HumanReadable(LongName = "MIL-CD", ShortName = "milcd")] + MILCD, + + [HumanReadable(LongName = "Nintendo GameCube Game Disc", ShortName = "dvd5gc")] + NintendoGameCubeGameDisc, + + [HumanReadable(LongName = "Nintendo Wii Optical Disc (SL)", ShortName = "dvd5wii")] + NintendoWiiOpticalDiscSL, + + [HumanReadable(LongName = "Nintendo Wii Optical Disc (DL)", ShortName = "dvd9wii")] + NintendoWiiOpticalDiscDL, + + [HumanReadable(LongName = "Nintendo Wii U Optical Disc (SL)", ShortName = "bd25wiiu")] + NintendoWiiUOpticalDiscSL, + + [HumanReadable(LongName = "UMD (SL)", ShortName = "umd1")] + UMDSL, + + [HumanReadable(LongName = "UMD (DL)", ShortName = "umd2")] + UMDDL, + } + + /// + /// Dump status + /// + public enum DumpStatus + { + [HumanReadable(LongName = "Unknown", ShortName = "grey")] + UnknownGrey = 1, + + [HumanReadable(LongName = "Disabled", ShortName = "red")] + DisabledRed = 2, + + [HumanReadable(LongName = "Possible Bad Dump", ShortName = "yellow")] + PossibleBadDumpYellow = 3, + + [HumanReadable(LongName = "Original Media", ShortName = "blue")] + OriginalMediaBlue = 4, + + [HumanReadable(LongName = "Two or More", ShortName = "green")] + TwoOrMoreGreen = 5, + } + /// /// List of all disc langauges /// @@ -238,6 +363,46 @@ namespace SabreTools.RedumpLib.Legacy.Data Sbis, } + /// + /// List of all media types defined in Redump.org + /// + /// + /// This represents media type categories which are then further refined + /// into specific disc types. e.g. DVD instead of DVD-5 and DVD-9 + /// + public enum PhysicalMediaType + { + [HumanReadable(Available = false, LongName = "Unknown", ShortName = "unknown")] + NONE = 0, + + [HumanReadable(LongName = "BD-ROM", ShortName = "bdrom")] + BluRay, + + [HumanReadable(LongName = "CD-ROM", ShortName = "cdrom")] + CDROM, + + [HumanReadable(LongName = "DVD-ROM", ShortName = "dvd")] + DVD, + + [HumanReadable(LongName = "GD-ROM", ShortName = "gdrom")] + GDROM, + + [HumanReadable(LongName = "HD-DVD-ROM", ShortName = "hddvd")] + HDDVD, + + [HumanReadable(LongName = "GameCube Game Disc", ShortName = "gc")] + NintendoGameCubeGameDisc, + + [HumanReadable(LongName = "Wii Optical Disc", ShortName = "wii")] + NintendoWiiOpticalDisc, + + [HumanReadable(LongName = "Wii U Optical Disc", ShortName = "wiiu")] + NintendoWiiUOpticalDisc, + + [HumanReadable(LongName = "UMD", ShortName = "umd")] + UMD, + } + /// /// List of all systems defined in Redump.org /// @@ -438,7 +603,7 @@ namespace SabreTools.RedumpLib.Legacy.Data NamcoSystem12, [System(Category = SystemCategory.Arcade, LongName = "Namco System 246 / System 256", ShortName = "ns246", HasCues = true, HasDat = true)] - NamcoSystem246, + NamcoSystem246256, [System(Category = SystemCategory.Arcade, LongName = "Panasonic M2", ShortName = "m2", IsBanned = true, HasCues = true, HasDat = true)] PanasonicM2, @@ -767,4 +932,383 @@ namespace SabreTools.RedumpLib.Legacy.Data [HumanReadable(LongName = "World", ShortName = "W")] World, } + + /// + /// List of all Redump site codes + /// + public enum SiteCode + { + [HumanReadable(ShortName = "[T:ACC]", LongName = "Acclaim ID:")] + AcclaimID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Accolade ID:", LongName = "Accolade ID:")] + AccoladeID, + + [HumanReadable(ShortName = "[T:ACT]", LongName = "Activision ID:")] + ActivisionID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Additional BCA Data:", LongName = "Additional BCA Data:")] + AdditionalBCAData, + + [HumanReadable(ShortName = "[T:ALT]", LongName = "Alternative Title:")] + AlternativeTitle, + + [HumanReadable(ShortName = "[T:ALTF]", LongName = "Alternative Foreign Title:")] + AlternativeForeignTitle, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Applications:", LongName = "Applications:")] + Applications, + + [HumanReadable(ShortName = "[T:BID]", LongName = "Bandai ID:")] + BandaiID, + + [HumanReadable(ShortName = "[T:BBFC]", LongName = "BBFC Reg. No.:")] + BBFCRegistrationNumber, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Bethesda ID:", LongName = "Bethesda ID:")] + BethesdaID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "CD Projekt ID:", LongName = "CD Projekt ID:")] + CDProjektID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Compatible OS:", LongName = "Compatible OS:")] + CompatibleOS, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Cover ID:", LongName = "Cover ID:")] + CoverID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Disc Hologram ID:", LongName = "Disc Hologram ID:")] + DiscHologramID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Disc ID:", LongName = "Disc ID:")] + DiscID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Disc Title (non-Latin):", LongName = "Disc Title (non-Latin):")] + DiscTitleNonLatin, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Disney Interactive ID", LongName = "Disney Interactive ID:")] + DisneyInteractiveID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "DMI:", LongName = "DMI:")] + DMIHash, + + [HumanReadable(ShortName = "[T:DNAS]", LongName = "DNAS Disc ID:")] + DNASDiscID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Edition (non-Latin):", LongName = "Edition (non-Latin):")] + EditionNonLatin, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Eidos ID:", LongName = "Eidos ID:")] + EidosID, + + [HumanReadable(ShortName = "[T:EAID]", LongName = "Electronic Arts ID:")] + ElectronicArtsID, + + [HumanReadable(ShortName = "[T:X]", LongName = "Extras:")] + Extras, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Filename:", LongName = "Filename:")] + Filename, + + [HumanReadable(ShortName = "[T:FIID]", LongName = "Fox Interactive ID:")] + FoxInteractiveID, + + [HumanReadable(ShortName = "[T:GF]", LongName = "Game Footage:")] + GameFootage, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Games:", LongName = "Games:")] + Games, + + [HumanReadable(ShortName = "[T:G]", LongName = "Genre:")] + Genre, + + [HumanReadable(ShortName = "[T:GTID]", LongName = "GT Interactive ID:")] + GTInteractiveID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "High Sierra Volume Descriptor:", LongName = "High Sierra Volume Descriptor:")] + HighSierraVolumeDescriptor, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Internal Name:", LongName = "Internal Name:")] + InternalName, + + [HumanReadable(ShortName = "[T:ISN]", LongName = "Internal Serial:")] + InternalSerialName, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Interplay ID:", LongName = "Interplay ID:")] + InterplayID, + + [HumanReadable(ShortName = "[T:ISBN]", LongName = "ISBN:")] + ISBN, + + [HumanReadable(ShortName = "[T:ISSN]", LongName = "ISSN:")] + ISSN, + + [HumanReadable(ShortName = "[T:JID]", LongName = "JASRAC ID:")] + JASRACID, + + [HumanReadable(ShortName = "[T:KIRZ]", LongName = "King Records ID:")] + KingRecordsID, + + [HumanReadable(ShortName = "[T:KOEI]", LongName = "Koei ID:")] + KoeiID, + + [HumanReadable(ShortName = "[T:KID]", LongName = "Konami ID:")] + KonamiID, + + // This doesn't have a site tag yet, promoted to field in redump.info + [HumanReadable(ShortName = "Logs Link:", LongName = "Logs Link:")] + LogsLink, + + [HumanReadable(ShortName = "[T:LAID]", LongName = "Lucas Arts ID:")] + LucasArtsID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Microsoft ID:", LongName = "Microsoft ID:")] + MicrosoftID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Multisession:", LongName = "Multisession:")] + Multisession, + + [HumanReadable(ShortName = "[T:NGID]", LongName = "Nagano ID:")] + NaganoID, + + [HumanReadable(ShortName = "[T:NID]", LongName = "Namco ID:")] + NamcoID, + + [HumanReadable(ShortName = "[T:NYG]", LongName = "Net Yaroze Games:")] + NetYarozeGames, + + [HumanReadable(ShortName = "[T:NPS]", LongName = "Nippon Ichi Software ID:")] + NipponIchiSoftwareID, + + [HumanReadable(ShortName = "[T:OID]", LongName = "Origin ID:")] + OriginID, + + [HumanReadable(ShortName = "[T:P]", LongName = "Patches:")] + Patches, + + // This doesn't have a site tag yet + /// No text value after + [HumanReadable(ShortName = "PC/Mac Hybrid", LongName = "PC/Mac Hybrid")] + PCMacHybrid, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "PFI:", LongName = "PFI:")] + PFIHash, + + [HumanReadable(ShortName = "[T:PD]", LongName = "Playable Demos:")] + PlayableDemos, + + [HumanReadable(ShortName = "[T:PCID]", LongName = "Pony Canyon ID:")] + PonyCanyonID, + + /// No text value after + [HumanReadable(ShortName = "[T:PT2]", LongName = "Postgap type: Form 2")] + PostgapType, + + [HumanReadable(ShortName = "[T:PPN]", LongName = "PPN:")] + PPN, + + // This doesn't have a site tag for some systems yet + [HumanReadable(ShortName = "Protection:", LongName = "Protection:")] + Protection, + + // This doesn't have a site tag yet, promoted to field in redump.info + [HumanReadable(ShortName = "Ring non-zero data start:", LongName = "Ring non-zero data start:")] + RingNonZeroDataStart, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Ring Perfect Audio Offset:", LongName = "Ring Perfect Audio Offset:")] + RingPerfectAudioOffset, + + [HumanReadable(ShortName = "[T:RD]", LongName = "Rolling Demos:")] + RollingDemos, + + [HumanReadable(ShortName = "[T:SG]", LongName = "Savegames:")] + Savegames, + + [HumanReadable(ShortName = "[T:SID]", LongName = "Sega ID:")] + SegaID, + + [HumanReadable(ShortName = "[T:SNID]", LongName = "Selen ID:")] + SelenID, + + [HumanReadable(ShortName = "[T:S]", LongName = "Series:")] + Series, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Sierra ID:", LongName = "Sierra ID:")] + SierraID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "SS:", LongName = "SS:")] + SSHash, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "SS version:", LongName = "SS version:")] + SSVersion, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Steam App ID:", LongName = "Steam AppID:")] + SteamAppID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Steam Depot ID (.sis/.csm/.csd):", LongName = "Steam Depot ID (.sis/.csm/.csd):")] + SteamCsmCsdDepotID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Steam Depot ID (.sis/.sim/.sid):", LongName = "Steam Depot ID (.sis/.sim/.sid):")] + SteamSimSidDepotID, + + [HumanReadable(ShortName = "[T:TID]", LongName = "Taito ID:")] + TaitoID, + + [HumanReadable(ShortName = "[T:TD]", LongName = "Tech Demos:")] + TechDemos, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Title ID:", LongName = "Title ID:")] + TitleID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "2K Games ID:", LongName = "2K Games ID:")] + TwoKGamesID, + + [HumanReadable(ShortName = "[T:UID]", LongName = "Ubisoft ID:")] + UbisoftID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "Universal Hash (SHA-1):", LongName = "Universal Hash (SHA-1):")] + UniversalHash, + + [HumanReadable(ShortName = "[T:VID]", LongName = "Valve ID:")] + ValveID, + + [HumanReadable(ShortName = "[T:VFC]", LongName = "VFC code:")] + VFCCode, + + [HumanReadable(ShortName = "[T:V]", LongName = "Videos:")] + Videos, + + [HumanReadable(ShortName = "[T:VOL]", LongName = "Volume Label:")] + VolumeLabel, + + /// No text value after + [HumanReadable(ShortName = "[T:VCD]", LongName = "V-CD")] + VCD, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "XeMID:", LongName = "XeMID:")] + XeMID, + + // This doesn't have a site tag yet + [HumanReadable(ShortName = "XMID:", LongName = "XMID:")] + XMID, + } + + /// + /// List of all recognized sort parameters + /// + public enum SortCategory + { + [HumanReadable(LongName = "Title", ShortName = "title")] + Title, + + [HumanReadable(LongName = "Added", ShortName = "added")] + Added, + + [HumanReadable(LongName = "Region", ShortName = "region")] + Region, + + [HumanReadable(LongName = "System", ShortName = "system")] + System, + + [HumanReadable(LongName = "Version", ShortName = "version")] + Version, + + [HumanReadable(LongName = "Edition", ShortName = "edition")] + Edition, + + [HumanReadable(LongName = "Languages", ShortName = "languages")] + Languages, + + [HumanReadable(LongName = "Serial", ShortName = "serial")] + Serial, + + [HumanReadable(LongName = "Status", ShortName = "status")] + Status, + + [HumanReadable(LongName = "Modified", ShortName = "modified")] + Modified, + } + + /// + /// List of all recognized sort directions + /// + public enum SortDirection + { + [HumanReadable(LongName = "Ascending", ShortName = "asc")] + Ascending, + + [HumanReadable(LongName = "Descending", ShortName = "desc")] + Descending, + } + + /// + /// List of system categories + /// + public enum SystemCategory + { + NONE = 0, + + [HumanReadable(LongName = "Disc-Based Consoles")] + DiscBasedConsole, + + [HumanReadable(LongName = "Other Consoles")] + OtherConsole, + + [HumanReadable(LongName = "Computers")] + Computer, + + [HumanReadable(LongName = "Arcade")] + Arcade, + + [HumanReadable(LongName = "Other")] + Other, + }; + + /// + /// Generic yes/no values + /// + public enum YesNo + { + [HumanReadable(LongName = "Yes/No")] + NULL = 0, + + [HumanReadable(LongName = "No")] + No = 1, + + [HumanReadable(LongName = "Yes")] + Yes = 2, + } } diff --git a/SabreTools.RedumpLib.Legacy/Data/Extensions.cs b/SabreTools.RedumpLib.Legacy/Data/Extensions.cs index beb406e..41a6182 100644 --- a/SabreTools.RedumpLib.Legacy/Data/Extensions.cs +++ b/SabreTools.RedumpLib.Legacy/Data/Extensions.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; -using SabreTools.RedumpLib.Attributes; -using MediaType = SabreTools.RedumpLib.Data.MediaType; -using SystemAttribute = SabreTools.RedumpLib.Legacy.Attributes.SystemAttribute; -using SystemCategory = SabreTools.RedumpLib.Data.SystemCategory; +using System.Text.RegularExpressions; +using SabreTools.RedumpLib.Legacy.Attributes; namespace SabreTools.RedumpLib.Legacy.Data { @@ -14,6 +12,28 @@ namespace SabreTools.RedumpLib.Legacy.Data { #region Non-Enumerable + /// + /// Extract the size from XML hash data + /// + /// String representing the combined hash data + /// Extracted size on success, -1 on error + public static long ExtractSizeFromHashData(string? hashData) + { + if (string.IsNullOrEmpty(hashData)) + return -1; + + var hashreg = new Regex(@" /// Adjust the disc type based on size and layerbreak information /// @@ -28,55 +48,55 @@ namespace SabreTools.RedumpLib.Legacy.Data #pragma warning disable IDE0010 switch (info.CommonDiscInfo.Media) { - case MediaType.DVD5: - case MediaType.DVD9: + case DiscType.DVD5: + case DiscType.DVD9: if (info.SizeAndChecksums.Layerbreak != default) - info.CommonDiscInfo.Media = MediaType.DVD9; + info.CommonDiscInfo.Media = DiscType.DVD9; else - info.CommonDiscInfo.Media = MediaType.DVD5; + info.CommonDiscInfo.Media = DiscType.DVD5; break; - case MediaType.BD25: - case MediaType.BD33: - case MediaType.BD50: - case MediaType.BD66: - case MediaType.BD100: - case MediaType.BD128: + case DiscType.BD25: + case DiscType.BD33: + case DiscType.BD50: + case DiscType.BD66: + case DiscType.BD100: + case DiscType.BD128: // Extract the size from the hashes - long size = RedumpLib.Data.Extensions.ExtractSizeFromHashData(info.TracksAndWriteOffsets.ClrMameProData); + long size = ExtractSizeFromHashData(info.TracksAndWriteOffsets.ClrMameProData); if (info.SizeAndChecksums.Layerbreak3 != default) - info.CommonDiscInfo.Media = MediaType.BD128; + info.CommonDiscInfo.Media = DiscType.BD128; else if (info.SizeAndChecksums.Layerbreak2 != default) - info.CommonDiscInfo.Media = MediaType.BD100; + info.CommonDiscInfo.Media = DiscType.BD100; else if (info.SizeAndChecksums.Layerbreak != default && info.SizeAndChecksums.PICIdentifier == "BDU") - info.CommonDiscInfo.Media = MediaType.BD66; + info.CommonDiscInfo.Media = DiscType.BD66; else if (info.SizeAndChecksums.Layerbreak != default && size > 50_050_629_632) - info.CommonDiscInfo.Media = MediaType.BD66; + info.CommonDiscInfo.Media = DiscType.BD66; else if (info.SizeAndChecksums.Layerbreak != default) - info.CommonDiscInfo.Media = MediaType.BD50; + info.CommonDiscInfo.Media = DiscType.BD50; else if (info.SizeAndChecksums.PICIdentifier == "BDU") - info.CommonDiscInfo.Media = MediaType.BD33; + info.CommonDiscInfo.Media = DiscType.BD33; else if (size > 25_025_314_816) - info.CommonDiscInfo.Media = MediaType.BD33; + info.CommonDiscInfo.Media = DiscType.BD33; else - info.CommonDiscInfo.Media = MediaType.BD25; + info.CommonDiscInfo.Media = DiscType.BD25; break; - case MediaType.HDDVDSL: - case MediaType.HDDVDDL: + case DiscType.HDDVDSL: + case DiscType.HDDVDDL: if (info.SizeAndChecksums.Layerbreak != default) - info.CommonDiscInfo.Media = MediaType.HDDVDDL; + info.CommonDiscInfo.Media = DiscType.HDDVDDL; else - info.CommonDiscInfo.Media = MediaType.HDDVDSL; + info.CommonDiscInfo.Media = DiscType.HDDVDSL; break; - case MediaType.UMDSL: - case MediaType.UMDDL: + case DiscType.UMDSL: + case DiscType.UMDDL: if (info.SizeAndChecksums.Layerbreak != default) - info.CommonDiscInfo.Media = MediaType.UMDDL; + info.CommonDiscInfo.Media = DiscType.UMDDL; else - info.CommonDiscInfo.Media = MediaType.UMDSL; + info.CommonDiscInfo.Media = DiscType.UMDSL; break; // All other disc types are not processed @@ -88,6 +108,594 @@ namespace SabreTools.RedumpLib.Legacy.Data #endregion + #region Cross-Enumeration + + /// + /// Get a list of valid MediaTypes for a given PhysicalSystem + /// + /// PhysicalSystem value to check + /// MediaTypes, if possible + public static List MediaTypes(this PhysicalSystem? system) + { + var types = new List(); + + switch (system) + { + #region Consoles + + // https://en.wikipedia.org/wiki/Apple_Bandai_Pippin + case PhysicalSystem.AppleBandaiPippin: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Atari_Jaguar_CD + case PhysicalSystem.AtariJaguarCDInteractiveMultimediaSystem: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Playdia + case PhysicalSystem.BandaiPlaydiaQuickInteractiveSystem: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Amiga_CD32 + case PhysicalSystem.CommodoreAmigaCD32: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Commodore_CDTV + case PhysicalSystem.CommodoreAmigaCDTV: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/VideoNow + case PhysicalSystem.HasbroVideoNow: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/VideoNow + case PhysicalSystem.HasbroVideoNowColor: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/VideoNow + case PhysicalSystem.HasbroVideoNowJr: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/VideoNow + case PhysicalSystem.HasbroVideoNowXP: + types.Add(PhysicalMediaType.CDROM); + break; + + case PhysicalSystem.MattelFisherPriceiXL: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/HyperScan + case PhysicalSystem.MattelHyperScan: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Xbox_(console) + case PhysicalSystem.MicrosoftXbox: + types.Add(PhysicalMediaType.DVD); + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Xbox_360 + case PhysicalSystem.MicrosoftXbox360: + types.Add(PhysicalMediaType.DVD); + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Xbox_One + case PhysicalSystem.MicrosoftXboxOne: + types.Add(PhysicalMediaType.BluRay); + break; + + // https://en.wikipedia.org/wiki/Xbox_Series_X_and_Series_S + case PhysicalSystem.MicrosoftXboxSeriesXS: + types.Add(PhysicalMediaType.BluRay); + break; + + // https://en.wikipedia.org/wiki/TurboGrafx-16 + case PhysicalSystem.NECPCEngineCDTurboGrafxCD: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/PC-FX + case PhysicalSystem.NECPCFXPCFXGA: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/GameCube + case PhysicalSystem.NintendoGameCube: + types.Add(PhysicalMediaType.DVD); // Only added here to help users; not strictly correct + types.Add(PhysicalMediaType.NintendoGameCubeGameDisc); + break; + + // https://en.wikipedia.org/wiki/Wii + case PhysicalSystem.NintendoWii: + types.Add(PhysicalMediaType.DVD); // Only added here to help users; not strictly correct + types.Add(PhysicalMediaType.NintendoWiiOpticalDisc); + break; + + // https://en.wikipedia.org/wiki/Wii_U + case PhysicalSystem.NintendoWiiU: + types.Add(PhysicalMediaType.NintendoWiiUOpticalDisc); + break; + + // https://en.wikipedia.org/wiki/3DO_Interactive_Multiplayer + case PhysicalSystem.Panasonic3DOInteractiveMultiplayer: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Philips_CD-i + case PhysicalSystem.PhilipsCDi: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Sega_CD + case PhysicalSystem.SegaMegaCDSegaCD: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Dreamcast + case PhysicalSystem.SegaDreamcast: + types.Add(PhysicalMediaType.CDROM); // Low density partition, MIL-CD + types.Add(PhysicalMediaType.GDROM); // High density partition + break; + + // https://en.wikipedia.org/wiki/Sega_Saturn + case PhysicalSystem.SegaSaturn: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Neo_Geo_CD + case PhysicalSystem.SNKNeoGeoCD: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/PlayStation_(console) + case PhysicalSystem.SonyPlayStation: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/PlayStation_2 + case PhysicalSystem.SonyPlayStation2: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + // https://en.wikipedia.org/wiki/PlayStation_3 + case PhysicalSystem.SonyPlayStation3: + types.Add(PhysicalMediaType.BluRay); + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + // https://en.wikipedia.org/wiki/PlayStation_4 + case PhysicalSystem.SonyPlayStation4: + types.Add(PhysicalMediaType.BluRay); + break; + + // https://en.wikipedia.org/wiki/PlayStation_5 + case PhysicalSystem.SonyPlayStation5: + types.Add(PhysicalMediaType.BluRay); + break; + + // https://en.wikipedia.org/wiki/PlayStation_Portable + case PhysicalSystem.SonyPlayStationPortable: + types.Add(PhysicalMediaType.UMD); + types.Add(PhysicalMediaType.CDROM); // Development discs only + types.Add(PhysicalMediaType.DVD); // Development discs only + break; + + // https://en.wikipedia.org/wiki/Tandy_Video_Information_System + case PhysicalSystem.MemorexVisualInformationSystem: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Nuon_(DVD_technology) + case PhysicalSystem.VMLabsNUON: + types.Add(PhysicalMediaType.DVD); + break; + + // https://en.wikipedia.org/wiki/V.Flash + case PhysicalSystem.VTechVFlashVSmilePro: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Game_Wave_Family_Entertainment_System + case PhysicalSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem: + types.Add(PhysicalMediaType.CDROM); // Firmware discs only(?) + types.Add(PhysicalMediaType.DVD); + break; + + #endregion + + #region Computers + + // https://en.wikipedia.org/wiki/Acorn_Archimedes + case PhysicalSystem.AcornArchimedesAndRiscPC: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Macintosh + case PhysicalSystem.AppleMacintosh: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + // https://en.wikipedia.org/wiki/Amiga + case PhysicalSystem.CommodoreAmigaCD: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + // https://en.wikipedia.org/wiki/FM_Towns + case PhysicalSystem.FujitsuFMTownsSeries: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/IBM_PC_compatible + case PhysicalSystem.IBMPCcompatible: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + types.Add(PhysicalMediaType.BluRay); + break; + + // https://en.wikipedia.org/wiki/PC-8800_series + case PhysicalSystem.NECPC88Series: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/PC-9800_series + case PhysicalSystem.NECPC98Series: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + // https://en.wikipedia.org/wiki/X68000 + case PhysicalSystem.SharpX68000: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + #endregion + + #region Arcade + + // UNKNOWN + case PhysicalSystem.FunworldPhotoPlay: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + // https://github.com/mamedev/mame/blob/master/src/mame/drivers/iteagle.cpp + case PhysicalSystem.IncredibleTechnologiesEagle: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/E-Amusement + case PhysicalSystem.KonamieAmusement: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + // http://system16.com/hardware.php?id=828 + case PhysicalSystem.KonamiFireBeat: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + // http://system16.com/hardware.php?id=577 + case PhysicalSystem.KonamiSystemGV: + types.Add(PhysicalMediaType.CDROM); + break; + + // http://system16.com/hardware.php?id=575 + case PhysicalSystem.KonamiM2: + types.Add(PhysicalMediaType.CDROM); + break; + + // http://system16.com/hardware.php?id=582 + // http://system16.com/hardware.php?id=822 + // http://system16.com/hardware.php?id=823 + case PhysicalSystem.KonamiSystem573: + types.Add(PhysicalMediaType.CDROM); + break; + + // http://system16.com/hardware.php?id=827 + case PhysicalSystem.KonamiTwinkle: + types.Add(PhysicalMediaType.CDROM); + break; + + // http://system16.com/hardware.php?id=543 + case PhysicalSystem.NamcoSystem246256: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + // http://system16.com/hardware.php?id=545 + case PhysicalSystem.NamcoSegaNintendoTriforce: + types.Add(PhysicalMediaType.CDROM); // Low density partition + types.Add(PhysicalMediaType.GDROM); // High density partition + break; + + // http://system16.com/hardware.php?id=535 + case PhysicalSystem.NamcoSystem12: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Panasonic_M2 + case PhysicalSystem.PanasonicM2: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + // http://system16.com/hardware.php?id=729 + case PhysicalSystem.SegaChihiro: + types.Add(PhysicalMediaType.CDROM); // Low density partition + types.Add(PhysicalMediaType.GDROM); // High density partition + break; + + // http://system16.com/hardware.php?id=985 + // http://system16.com/hardware.php?id=731 + // http://system16.com/hardware.php?id=984 + // http://system16.com/hardware.php?id=986 + case PhysicalSystem.SegaLindbergh: + types.Add(PhysicalMediaType.DVD); + break; + + // http://system16.com/hardware.php?id=721 + // http://system16.com/hardware.php?id=723 + // http://system16.com/hardware.php?id=906 + // http://system16.com/hardware.php?id=722 + case PhysicalSystem.SegaNaomi: + types.Add(PhysicalMediaType.CDROM); // Low density partition + types.Add(PhysicalMediaType.GDROM); // High density partition + break; + + // http://system16.com/hardware.php?id=725 + // http://system16.com/hardware.php?id=726 + // http://system16.com/hardware.php?id=727 + case PhysicalSystem.SegaNaomi2: + types.Add(PhysicalMediaType.CDROM); // Low density partition + types.Add(PhysicalMediaType.GDROM); // High density partition + break; + + // http://system16.com/hardware.php?id=910 + // https://en.wikipedia.org/wiki/List_of_Sega_arcade_system_boards#Sega_Ring_series + case PhysicalSystem.SegaRingEdge: + types.Add(PhysicalMediaType.DVD); + break; + + // http://system16.com/hardware.php?id=982 + // https://en.wikipedia.org/wiki/List_of_Sega_arcade_system_boards#Sega_Ring_series + case PhysicalSystem.SegaRingEdge2: + types.Add(PhysicalMediaType.DVD); + break; + + // http://system16.com/hardware.php?id=711 + case PhysicalSystem.SegaTitanVideo: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://www.tab.at/en/support/support/downloads + case PhysicalSystem.TABAustriaQuizard: + types.Add(PhysicalMediaType.CDROM); + break; + + #endregion + + #region Others + + // https://en.wikipedia.org/wiki/Audio_CD + case PhysicalSystem.AudioCD: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Blu-ray#Player_profiles + case PhysicalSystem.BDVideo: + types.Add(PhysicalMediaType.BluRay); + break; + + // https://en.wikipedia.org/wiki/DVD-Video + case PhysicalSystem.DVDVideo: + types.Add(PhysicalMediaType.DVD); + break; + + // https://en.wikipedia.org/wiki/Blue_Book_(CD_standard) + case PhysicalSystem.EnhancedCD: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/HD_DVD + case PhysicalSystem.HDDVDVideo: + types.Add(PhysicalMediaType.HDDVD); + break; + + // UNKNOWN + case PhysicalSystem.NavisoftNaviken: + types.Add(PhysicalMediaType.CDROM); + break; + + // UNKNOWN + case PhysicalSystem.PalmOS: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + // https://en.wikipedia.org/wiki/Photo_CD + case PhysicalSystem.PhotoCD: + types.Add(PhysicalMediaType.CDROM); + break; + + // UNKNOWN + case PhysicalSystem.PlayStationGameSharkUpdates: + types.Add(PhysicalMediaType.CDROM); + break; + + // UNKNOWN + case PhysicalSystem.PocketPC: + types.Add(PhysicalMediaType.CDROM); + types.Add(PhysicalMediaType.DVD); + break; + + // https://segaretro.org/Prologue_21 + case PhysicalSystem.SegaPrologue21MultimediaKaraokeSystem: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://www.cnet.com/products/tao-music-iktv-karaoke-station-karaoke-system-series/ + case PhysicalSystem.TaoiKTV: + types.Add(PhysicalMediaType.CDROM); + break; + + // http://ultimateconsoledatabase.com/golden/kiss_site.htm + case PhysicalSystem.TomyKissSite: + types.Add(PhysicalMediaType.CDROM); + break; + + // https://en.wikipedia.org/wiki/Video_CD + case PhysicalSystem.VideoCD: + types.Add(PhysicalMediaType.CDROM); + break; + + #endregion + + // BIOS systems can't have a media type + case PhysicalSystem.MicrosoftXboxBIOS: + case PhysicalSystem.NintendoGameCubeBIOS: + case PhysicalSystem.SonyPlayStationBIOS: + case PhysicalSystem.SonyPlayStation2BIOS: + types.Add(PhysicalMediaType.NONE); + break; + + // Marker systems can't have a media type + case PhysicalSystem.MarkerDiscBasedConsoleEnd: + case PhysicalSystem.MarkerComputerEnd: + case PhysicalSystem.MarkerArcadeEnd: + case PhysicalSystem.MarkerOtherEnd: + types.Add(PhysicalMediaType.NONE); + break; + + case null: + default: + types.Add(PhysicalMediaType.NONE); + break; + } + + return types; + } + + /// + /// Convert master list of all media types to currently known Redump disc types + /// + /// MediaType value to check + /// DiscType if possible, null on error + public static DiscType? ToMediaType(this PhysicalMediaType? discType) + { + return discType switch + { + PhysicalMediaType.BluRay => DiscType.BD50, + PhysicalMediaType.CDROM => DiscType.CD, + PhysicalMediaType.DVD => DiscType.DVD9, + PhysicalMediaType.GDROM => DiscType.GDROM, + PhysicalMediaType.HDDVD => DiscType.HDDVDSL, + // PhysicalMediaType.MILCD => MediaType.MILCD, // TODO: Support this? + PhysicalMediaType.NintendoGameCubeGameDisc => DiscType.NintendoGameCubeGameDisc, + PhysicalMediaType.NintendoWiiOpticalDisc => DiscType.NintendoWiiOpticalDiscDL, + PhysicalMediaType.NintendoWiiUOpticalDisc => DiscType.NintendoWiiUOpticalDiscSL, + PhysicalMediaType.UMD => DiscType.UMDDL, + + // Invalid cases for conversion + PhysicalMediaType.NONE => null, + null => null, + _ => null, + }; + } + + /// + /// Convert currently known Redump disc types to master list of all media types + /// + /// DiscType value to check + /// MediaType if possible, null on error + public static PhysicalMediaType? ToPhysicalMediaType(this DiscType? discType) + { + return discType switch + { + DiscType.BD25 + or DiscType.BD33 + or DiscType.BD50 + or DiscType.BD66 + or DiscType.BD100 + or DiscType.BD128 => PhysicalMediaType.BluRay, + DiscType.CD => PhysicalMediaType.CDROM, + DiscType.DVD5 + or DiscType.DVD9 => PhysicalMediaType.DVD, + DiscType.GDROM => PhysicalMediaType.GDROM, + DiscType.HDDVDSL + or DiscType.HDDVDDL => PhysicalMediaType.HDDVD, + // MediaType.MILCD => PhysicalMediaType.MILCD, // TODO: Support this? + DiscType.NintendoGameCubeGameDisc => PhysicalMediaType.NintendoGameCubeGameDisc, + DiscType.NintendoWiiOpticalDiscSL + or DiscType.NintendoWiiOpticalDiscDL => PhysicalMediaType.NintendoWiiOpticalDisc, + DiscType.NintendoWiiUOpticalDiscSL => PhysicalMediaType.NintendoWiiUOpticalDisc, + DiscType.UMDSL + or DiscType.UMDDL => PhysicalMediaType.UMD, + + // Invalid cases for conversion + DiscType.NONE => null, + DiscType.MILCD => null, + null => null, + _ => null, + }; + } + + #endregion + + #region Disc Category + + /// + /// Get the Redump longnames for each known category + /// + public static string? LongName(this DiscCategory category) + => ((DiscCategory?)category).LongName(); + + /// + /// Get the Redump longnames for each known category + /// + public static string? LongName(this DiscCategory? category) + => AttributeHelper.GetHumanReadableAttribute(category)?.LongName; + + /// + /// Get the Category enum value for a given string + /// + /// String value to convert + /// Category represented by the string, if possible + public static DiscCategory? ToDiscCategory(this string? category) + { + // No value means no match + if (category is null || category.Length == 0) + return null; + + category = category?.ToLowerInvariant(); + var categories = (DiscCategory[])Enum.GetValues(typeof(DiscCategory)); + + // Check long names + int index = Array.FindIndex(categories, c => category == c.LongName()?.ToLowerInvariant() + || category == c.LongName()?.Replace(" ", string.Empty)?.ToLowerInvariant()); + if (index > -1) + return categories[index]; + + return null; + } + + #endregion + #region Disc Subpath /// @@ -152,6 +760,167 @@ namespace SabreTools.RedumpLib.Legacy.Data #endregion + #region Disc Type + + /// + /// Get the Redump longnames for each known disc type + /// + /// + /// + public static string? LongName(this DiscType discType) + => ((DiscType?)discType).LongName(); + + /// + /// Get the Redump longnames for each known disc type + /// + /// + /// + public static string? LongName(this DiscType? discType) + => AttributeHelper.GetHumanReadableAttribute(discType)?.LongName; + + /// + /// Get the Redump shortnames for each known disc type + /// + /// + /// + public static string? ShortName(this DiscType discType) + => AttributeHelper.GetHumanReadableAttribute(discType)?.ShortName; + + /// + /// Get the Redump shortnames for each known disc type + /// + /// + /// + public static string? ShortName(this DiscType? discType) + => AttributeHelper.GetHumanReadableAttribute(discType)?.ShortName; + + /// + /// Get the DiscType enum value for a given string + /// + /// String value to convert + /// DiscType represented by the string, if possible + public static DiscType? ToDiscType(this string? discType) + { + // No value means no match + if (discType is null || discType.Length == 0) + return null; + + discType = discType.ToLowerInvariant(); + var discTypes = (DiscType[])Enum.GetValues(typeof(DiscType)); + + // Check short names + int index = Array.FindIndex(discTypes, s => discType == s.ShortName()?.ToLowerInvariant()); + if (index > -1) + return discTypes[index]; + + // Check long names + index = Array.FindIndex(discTypes, s => discType == s.LongName()?.ToLowerInvariant() + || discType == s.LongName()?.Replace(" ", string.Empty)?.ToLowerInvariant() + || discType == s.LongName()?.Replace("-", string.Empty)?.ToLowerInvariant() + || discType == s.LongName()? + .Replace(" ", string.Empty)? + .Replace("-", string.Empty)? + .ToLowerInvariant()); + if (index > -1) + return discTypes[index]; + + // Check numeric values + if (int.TryParse(discType, out int discTypeInt) && Enum.IsDefined(typeof(DiscType), discTypeInt)) + return (DiscType)discTypeInt; + + // Special cases + return (discType?.ToLowerInvariant()) switch + { + "bd" + or "bdrom" + or "bd-rom" + or "bluray" + or "blu-ray" => DiscType.BD25, + "cdrom" + or "cd-rom" => DiscType.CD, + "dvd" + or "dvd-rom" => DiscType.DVD5, + "gc" => DiscType.NintendoGameCubeGameDisc, + "gd" => DiscType.GDROM, + "hddvd" + or "hd-dvd" => DiscType.HDDVDSL, + "umd" => DiscType.UMDSL, + "wii" => DiscType.NintendoWiiOpticalDiscSL, + + _ => null, + }; + } + + #endregion + + #region Dump Status + + /// + /// Get the human readable name for a DumpStatus + /// + /// + /// + public static string? LongName(this DumpStatus dumpStatus) + => AttributeHelper.GetHumanReadableAttribute(dumpStatus)?.LongName; + + /// + /// Get the human readable name for a DumpStatus + /// + /// + /// + public static string? LongName(this DumpStatus? dumpStatus) + => AttributeHelper.GetHumanReadableAttribute(dumpStatus)?.LongName; + + /// + /// Get the URL path part for a DumpStatus + /// + /// + /// + public static string? ShortName(this DumpStatus dumpStatus) + => AttributeHelper.GetHumanReadableAttribute(dumpStatus)?.ShortName; + + /// + /// Get the URL path part for a DumpStatus + /// + /// + /// + public static string? ShortName(this DumpStatus? dumpStatus) + => AttributeHelper.GetHumanReadableAttribute(dumpStatus)?.ShortName; + + /// + /// Get the Region enum value for a given string + /// + /// String value to convert + /// Region represented by the string, if possible + public static DumpStatus? ToDumpStatus(this string? dumpStatus) + { + // No value means no match + if (dumpStatus is null || dumpStatus.Length == 0) + return null; + + dumpStatus = dumpStatus.ToLowerInvariant(); + var dumpStatuses = (DumpStatus[])Enum.GetValues(typeof(DumpStatus)); + + // Check short names + int index = Array.FindIndex(dumpStatuses, s => dumpStatus == s.ShortName()?.ToLowerInvariant()); + if (index > -1) + return dumpStatuses[index]; + + // Check long names + index = Array.FindIndex(dumpStatuses, s => dumpStatus == s.LongName()?.ToLowerInvariant() + || dumpStatus == s.LongName()?.Replace(" ", string.Empty)?.ToLowerInvariant()); + if (index > -1) + return dumpStatuses[index]; + + // Check numeric values + if (int.TryParse(dumpStatus, out int dumpStatusInt) && Enum.IsDefined(typeof(DumpStatus), dumpStatusInt)) + return (DumpStatus)dumpStatusInt; + + return null; + } + + #endregion + #region Language /// @@ -317,6 +1086,44 @@ namespace SabreTools.RedumpLib.Legacy.Data #endregion + #region Physical Media Type + + /// + /// List all media types with their short usable names + /// + public static List ListMediaTypes() + { + var discTypes = new List(); + + foreach (var val in Enum.GetValues(typeof(PhysicalMediaType))) + { + if (val is null || ((PhysicalMediaType)val) == PhysicalMediaType.NONE) + continue; + + discTypes.Add($"{((PhysicalMediaType?)val).ShortName()} - {((PhysicalMediaType?)val).LongName()}"); + } + + return discTypes; + } + + /// + /// Get the longnames for each known media type + /// + /// + /// + public static string? LongName(this PhysicalMediaType? discType) + => AttributeHelper.GetHumanReadableAttribute(discType)?.LongName; + + /// + /// Get the shortnames for each known media type + /// + /// + /// + public static string? ShortName(this PhysicalMediaType? discType) + => AttributeHelper.GetHumanReadableAttribute(discType)?.ShortName; + + #endregion + #region Physical System /// @@ -717,5 +1524,467 @@ namespace SabreTools.RedumpLib.Legacy.Data } #endregion + + #region Site Code + + /// + /// List all site codes with their short usable names + /// + public static List ListSiteCodes() + { + var siteCodes = new List(); + + foreach (var val in Enum.GetValues(typeof(SiteCode))) + { + string? shortName = ((SiteCode?)val).ShortName()?.TrimEnd(':'); + string? longName = ((SiteCode?)val).LongName()?.TrimEnd(':'); + + bool isCommentCode = ((SiteCode?)val).IsCommentCode(); + bool isContentCode = ((SiteCode?)val).IsContentCode(); + bool isMultiline = ((SiteCode?)val).IsMultiLine(); + + // Invalid codes should be skipped + if (shortName is null || longName is null) + continue; + + // Handle site tags + string siteCode; + if (shortName == longName) + siteCode = "***".PadRight(16, ' '); + else + siteCode = shortName.PadRight(16, ' '); + + // Handle expanded tags + siteCode += longName.PadRight(32, ' '); + + // Include special indicators, if necessary + var additionalInfo = new List(); + if (isCommentCode) + additionalInfo.Add("Comment Field"); + if (isContentCode) + additionalInfo.Add("Content Field"); + if (isMultiline) + additionalInfo.Add("Multiline"); + if (additionalInfo.Count > 0) + siteCode += $"[{string.Join(", ", [.. additionalInfo])}]"; + + // Add the formatted site code + siteCodes.Add(siteCode); + } + + return siteCodes; + } + + /// + /// Check if a site code is boolean or not + /// + /// SiteCode to check + /// True if the code field is a flag with no value, false otherwise + public static bool IsBoolean(this SiteCode siteCode) + => ((SiteCode?)siteCode).IsBoolean(); + + /// + /// Check if a site code is boolean or not + /// + /// SiteCode to check + /// True if the code field is a flag with no value, false otherwise + public static bool IsBoolean(this SiteCode? siteCode) + { +#pragma warning disable IDE0072 // Add missing cases + return siteCode switch + { + SiteCode.PCMacHybrid => true, + SiteCode.PostgapType => true, + SiteCode.VCD => true, + _ => false, + }; +#pragma warning restore IDE0072 // Add missing cases + } + + /// + /// Check if a site code should live in the comments section + /// + /// True if the code field is in comments by default, false otherwise + public static bool IsCommentCode(this SiteCode siteCode) + => ((SiteCode?)siteCode).IsCommentCode(); + + /// + /// Check if a site code should live in the comments section + /// + /// True if the code field is in comments by default, false otherwise + public static bool IsCommentCode(this SiteCode? siteCode) + { +#pragma warning disable IDE0072 // Add missing cases + return siteCode switch + { + // Identifying Info + SiteCode.AdditionalBCAData => true, + SiteCode.AlternativeTitle => true, + SiteCode.AlternativeForeignTitle => true, + SiteCode.BBFCRegistrationNumber => true, + SiteCode.CompatibleOS => true, + SiteCode.CoverID => true, + SiteCode.DiscHologramID => true, + SiteCode.DiscID => true, + SiteCode.DiscTitleNonLatin => true, + SiteCode.DMIHash => true, + SiteCode.DNASDiscID => true, + SiteCode.EditionNonLatin => true, + SiteCode.Filename => true, + SiteCode.Genre => true, + SiteCode.HighSierraVolumeDescriptor => true, + SiteCode.InternalName => true, + SiteCode.InternalSerialName => true, + SiteCode.ISBN => true, + SiteCode.ISSN => true, + SiteCode.LogsLink => true, + SiteCode.Multisession => true, + SiteCode.PCMacHybrid => true, + SiteCode.PFIHash => true, + SiteCode.PostgapType => true, + SiteCode.PPN => true, + SiteCode.Protection => true, + SiteCode.RingNonZeroDataStart => true, + SiteCode.RingPerfectAudioOffset => true, + SiteCode.Series => true, + SiteCode.SSHash => true, + SiteCode.SSVersion => true, + SiteCode.SteamAppID => true, + SiteCode.TitleID => true, + SiteCode.UniversalHash => true, + SiteCode.VCD => true, + SiteCode.VFCCode => true, + SiteCode.VolumeLabel => true, + SiteCode.XeMID => true, + SiteCode.XMID => true, + + // Publisher / Company IDs + SiteCode.TwoKGamesID => true, + SiteCode.AcclaimID => true, + SiteCode.AccoladeID => true, + SiteCode.ActivisionID => true, + SiteCode.BandaiID => true, + SiteCode.BethesdaID => true, + SiteCode.CDProjektID => true, + SiteCode.DisneyInteractiveID => true, + SiteCode.EidosID => true, + SiteCode.ElectronicArtsID => true, + SiteCode.FoxInteractiveID => true, + SiteCode.GTInteractiveID => true, + SiteCode.InterplayID => true, + SiteCode.JASRACID => true, + SiteCode.KingRecordsID => true, + SiteCode.KoeiID => true, + SiteCode.KonamiID => true, + SiteCode.LucasArtsID => true, + SiteCode.MicrosoftID => true, + SiteCode.NaganoID => true, + SiteCode.NamcoID => true, + SiteCode.NipponIchiSoftwareID => true, + SiteCode.OriginID => true, + SiteCode.PonyCanyonID => true, + SiteCode.SegaID => true, + SiteCode.SelenID => true, + SiteCode.SierraID => true, + SiteCode.TaitoID => true, + SiteCode.UbisoftID => true, + SiteCode.ValveID => true, + + _ => false, + }; +#pragma warning restore IDE0072 // Add missing cases + } + + /// + /// Check if a site code should live in the contents section + /// + /// True if the code field is in contents by default, false otherwise + public static bool IsContentCode(this SiteCode siteCode) + => ((SiteCode?)siteCode).IsContentCode(); + + /// + /// Check if a site code should live in the contents section + /// + /// True if the code field is in contents by default, false otherwise + public static bool IsContentCode(this SiteCode? siteCode) + { +#pragma warning disable IDE0072 // Add missing cases + return siteCode switch + { + SiteCode.Applications => true, + SiteCode.Extras => true, + SiteCode.GameFootage => true, + SiteCode.Games => true, + SiteCode.NetYarozeGames => true, + SiteCode.Patches => true, + SiteCode.PlayableDemos => true, + SiteCode.RollingDemos => true, + SiteCode.Savegames => true, + SiteCode.SteamSimSidDepotID => true, + SiteCode.SteamCsmCsdDepotID => true, + SiteCode.TechDemos => true, + SiteCode.Videos => true, + _ => false, + }; +#pragma warning restore IDE0072 // Add missing cases + } + + /// + /// Check if a site code is multi-line or not + /// + /// True if the code field is multiline by default, false otherwise + public static bool IsMultiLine(this SiteCode siteCode) + => ((SiteCode?)siteCode).IsMultiLine(); + + /// + /// Check if a site code is multi-line or not + /// + /// True if the code field is multiline by default, false otherwise + public static bool IsMultiLine(this SiteCode? siteCode) + { +#pragma warning disable IDE0072 // Add missing cases + return siteCode switch + { + SiteCode.Extras => true, + SiteCode.Filename => true, + SiteCode.Games => true, + SiteCode.GameFootage => true, + SiteCode.HighSierraVolumeDescriptor => true, + SiteCode.Multisession => true, + SiteCode.NetYarozeGames => true, + SiteCode.Patches => true, + SiteCode.PlayableDemos => true, + SiteCode.RollingDemos => true, + SiteCode.Savegames => true, + SiteCode.SteamSimSidDepotID => true, + SiteCode.SteamCsmCsdDepotID => true, + SiteCode.TechDemos => true, + SiteCode.Videos => true, + _ => false, + }; +#pragma warning restore IDE0072 // Add missing cases + } + + /// + /// Get the HTML version for each known site code + /// + public static string? LongName(this SiteCode siteCode) + => AttributeHelper.GetHumanReadableAttribute(siteCode)?.LongName; + + /// + /// Get the HTML version for each known site code + /// + public static string? LongName(this SiteCode? siteCode) + => AttributeHelper.GetHumanReadableAttribute(siteCode)?.LongName; + + /// + /// Get the short tag for each known site code + /// + public static string? ShortName(this SiteCode siteCode) + => AttributeHelper.GetHumanReadableAttribute(siteCode)?.ShortName; + + /// + /// Get the short tag for each known site code + /// + public static string? ShortName(this SiteCode? siteCode) + => AttributeHelper.GetHumanReadableAttribute(siteCode)?.ShortName; + + #endregion + + #region Sort Category + + /// + /// Get the human readable name for a SortCategory + /// + /// + /// + public static string? LongName(this SortCategory sortCategory) + => AttributeHelper.GetHumanReadableAttribute(sortCategory)?.LongName; + + /// + /// Get the human readable name for a SortCategory + /// + /// + /// + public static string? LongName(this SortCategory? sortCategory) + => AttributeHelper.GetHumanReadableAttribute(sortCategory)?.LongName; + + /// + /// Get the URL path part for a SortCategory + /// + /// + /// + public static string? ShortName(this SortCategory sortCategory) + => AttributeHelper.GetHumanReadableAttribute(sortCategory)?.ShortName; + + /// + /// Get the URL path part for a SortCategory + /// + /// + /// + public static string? ShortName(this SortCategory? sortCategory) + => AttributeHelper.GetHumanReadableAttribute(sortCategory)?.ShortName; + + /// + /// Get the Region enum value for a given string + /// + /// String value to convert + /// Region represented by the string, if possible + public static SortCategory? ToSortCategory(this string? sortCategory) + { + // No value means no match + if (sortCategory is null || sortCategory.Length == 0) + return null; + + sortCategory = sortCategory.ToLowerInvariant(); + var sortCategories = (SortCategory[])Enum.GetValues(typeof(SortCategory)); + + // Check short names + int index = Array.FindIndex(sortCategories, s => sortCategory == s.ShortName()?.ToLowerInvariant()); + if (index > -1) + return sortCategories[index]; + + // Check long names + index = Array.FindIndex(sortCategories, s => sortCategory == s.LongName()?.ToLowerInvariant() + || sortCategory == s.LongName()?.Replace(" ", string.Empty)?.ToLowerInvariant()); + if (index > -1) + return sortCategories[index]; + + return null; + } + + #endregion + + #region Sort Direction + + /// + /// Get the human readable name for a SortDirection + /// + /// + /// + public static string? LongName(this SortDirection sortDirection) + => AttributeHelper.GetHumanReadableAttribute(sortDirection)?.LongName; + + /// + /// Get the human readable name for a SortDirection + /// + /// + /// + public static string? LongName(this SortDirection? sortDirection) + => AttributeHelper.GetHumanReadableAttribute(sortDirection)?.LongName; + + /// + /// Get the URL path part for a SortDirection + /// + /// + /// + public static string? ShortName(this SortDirection sortDirection) + => AttributeHelper.GetHumanReadableAttribute(sortDirection)?.ShortName; + + /// + /// Get the URL path part for a SortDirection + /// + /// + /// + public static string? ShortName(this SortDirection? sortDirection) + => AttributeHelper.GetHumanReadableAttribute(sortDirection)?.ShortName; + + /// + /// Get the Region enum value for a given string + /// + /// String value to convert + /// Region represented by the string, if possible + public static SortDirection? ToSortDirection(this string? sortDirection) + { + // No value means no match + if (sortDirection is null || sortDirection.Length == 0) + return null; + + sortDirection = sortDirection.ToLowerInvariant(); + var sortCategories = (SortDirection[])Enum.GetValues(typeof(SortDirection)); + + // Check short names + int index = Array.FindIndex(sortCategories, s => sortDirection == s.ShortName()?.ToLowerInvariant()); + if (index > -1) + return sortCategories[index]; + + // Check long names + index = Array.FindIndex(sortCategories, s => sortDirection == s.LongName()?.ToLowerInvariant() + || sortDirection == s.LongName()?.Replace(" ", string.Empty)?.ToLowerInvariant()); + if (index > -1) + return sortCategories[index]; + + return null; + } + + #endregion + + #region System Category + + /// + /// Get the string representation of the system category + /// + /// + /// + public static string? LongName(this SystemCategory? category) + => AttributeHelper.GetHumanReadableAttribute(category)?.LongName; + + #endregion + + #region Yes/No + + /// + /// Get the string representation of the YesNo value + /// + /// + /// + public static string LongName(this YesNo? yesno) + => AttributeHelper.GetHumanReadableAttribute(yesno)?.LongName ?? "Yes/No"; + + /// + /// Get the YesNo enum value for a given nullable boolean + /// + /// Nullable boolean value to convert + /// YesNo represented by the nullable boolean, if possible + public static YesNo ToYesNo(this bool yesno) + { + return yesno switch + { + false => YesNo.No, + true => YesNo.Yes, + }; + } + + /// + /// Get the YesNo enum value for a given nullable boolean + /// + /// Nullable boolean value to convert + /// YesNo represented by the nullable boolean, if possible + public static YesNo? ToYesNo(this bool? yesno) + { + return yesno switch + { + false => YesNo.No, + true => YesNo.Yes, + _ => YesNo.NULL, + }; + } + + /// + /// Get the YesNo enum value for a given string + /// + /// String value to convert + /// YesNo represented by the string, if possible + public static YesNo? ToYesNo(this string? yesno) + { + return (yesno?.ToLowerInvariant()) switch + { + "no" or "false" => YesNo.No, + "yes" or "true" => YesNo.Yes, + _ => YesNo.NULL, + }; + } + + #endregion } } diff --git a/SabreTools.RedumpLib.Legacy/Data/Sections/CommonDiscInfoSection.cs b/SabreTools.RedumpLib.Legacy/Data/Sections/CommonDiscInfoSection.cs index 90ccf40..b0c2908 100644 --- a/SabreTools.RedumpLib.Legacy/Data/Sections/CommonDiscInfoSection.cs +++ b/SabreTools.RedumpLib.Legacy/Data/Sections/CommonDiscInfoSection.cs @@ -1,10 +1,7 @@ using System; using System.Collections.Generic; using Newtonsoft.Json; -using SabreTools.RedumpLib.Converters; -using DiscCategory = SabreTools.RedumpLib.Data.DiscCategory; -using MediaType = SabreTools.RedumpLib.Data.MediaType; -using SiteCode = SabreTools.RedumpLib.Data.SiteCode; +using SabreTools.RedumpLib.Legacy.Converters; namespace SabreTools.RedumpLib.Legacy.Data.Sections { @@ -15,13 +12,13 @@ namespace SabreTools.RedumpLib.Legacy.Data.Sections { // Name not defined by Redump [JsonProperty(PropertyName = "d_system", DefaultValueHandling = DefaultValueHandling.Include)] - [JsonConverter(typeof(Converters.PhysicalSystemConverter))] + [JsonConverter(typeof(PhysicalSystemConverter))] public PhysicalSystem? System { get; set; } // Name not defined by Redump [JsonProperty(PropertyName = "d_media", DefaultValueHandling = DefaultValueHandling.Include)] - [JsonConverter(typeof(MediaTypeConverter))] - public MediaType? Media { get; set; } + [JsonConverter(typeof(DiscTypeConverter))] + public DiscType? Media { get; set; } [JsonProperty(PropertyName = "d_title", DefaultValueHandling = DefaultValueHandling.Include)] public string? Title { get; set; } @@ -40,7 +37,7 @@ namespace SabreTools.RedumpLib.Legacy.Data.Sections public DiscCategory? Category { get; set; } [JsonProperty(PropertyName = "d_region", DefaultValueHandling = DefaultValueHandling.Include)] - [JsonConverter(typeof(Converters.RegionConverter))] + [JsonConverter(typeof(RegionConverter))] public Region? Region { get; set; } [JsonProperty(PropertyName = "d_languages", DefaultValueHandling = DefaultValueHandling.Include)] @@ -48,7 +45,7 @@ namespace SabreTools.RedumpLib.Legacy.Data.Sections public Language?[]? Languages { get; set; } [JsonProperty(PropertyName = "d_languages_selection", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)] - [JsonConverter(typeof(Converters.LanguageSelectionConverter))] + [JsonConverter(typeof(LanguageSelectionConverter))] public LanguageSelection?[]? LanguageSelection { get; set; } [JsonProperty(PropertyName = "d_serial", NullValueHandling = NullValueHandling.Ignore)] diff --git a/SabreTools.RedumpLib.Legacy/Data/Sections/CopyProtectionSection.cs b/SabreTools.RedumpLib.Legacy/Data/Sections/CopyProtectionSection.cs index 18583d3..e8fd37e 100644 --- a/SabreTools.RedumpLib.Legacy/Data/Sections/CopyProtectionSection.cs +++ b/SabreTools.RedumpLib.Legacy/Data/Sections/CopyProtectionSection.cs @@ -1,8 +1,7 @@ using System; using System.Collections.Generic; using Newtonsoft.Json; -using SabreTools.RedumpLib.Converters; -using SabreTools.RedumpLib.Data; +using SabreTools.RedumpLib.Legacy.Converters; namespace SabreTools.RedumpLib.Legacy.Data.Sections { diff --git a/SabreTools.RedumpLib.Legacy/Data/Sections/DumpersAndStatusSection.cs b/SabreTools.RedumpLib.Legacy/Data/Sections/DumpersAndStatusSection.cs index 4982668..612c5c1 100644 --- a/SabreTools.RedumpLib.Legacy/Data/Sections/DumpersAndStatusSection.cs +++ b/SabreTools.RedumpLib.Legacy/Data/Sections/DumpersAndStatusSection.cs @@ -1,6 +1,5 @@ using System; using Newtonsoft.Json; -using SabreTools.RedumpLib.Data; namespace SabreTools.RedumpLib.Legacy.Data.Sections { diff --git a/SabreTools.RedumpLib.Legacy/Data/Sections/EDCSection.cs b/SabreTools.RedumpLib.Legacy/Data/Sections/EDCSection.cs index bcef1f3..6fd4ae7 100644 --- a/SabreTools.RedumpLib.Legacy/Data/Sections/EDCSection.cs +++ b/SabreTools.RedumpLib.Legacy/Data/Sections/EDCSection.cs @@ -1,7 +1,6 @@ using System; using Newtonsoft.Json; -using SabreTools.RedumpLib.Converters; -using SabreTools.RedumpLib.Data; +using SabreTools.RedumpLib.Legacy.Converters; namespace SabreTools.RedumpLib.Legacy.Data.Sections { diff --git a/SabreTools.RedumpLib.Legacy/Data/Template.cs b/SabreTools.RedumpLib.Legacy/Data/Template.cs new file mode 100644 index 0000000..22d83ab --- /dev/null +++ b/SabreTools.RedumpLib.Legacy/Data/Template.cs @@ -0,0 +1,114 @@ +namespace SabreTools.RedumpLib.Legacy.Data +{ + /// + /// Template field values for submission info + /// + internal static class Template + { + #region Common Disc Info + + public const string TitleField = "Title"; + public const string ForeignTitleNonLatinField = "Foreign Title (Non-Latin)"; + public const string DiscNumberLetterField = "Disc Number/Letter"; + public const string DiscTitleField = "Disc Title"; + public const string SystemField = "System"; + public const string MediaTypeField = "Media Type"; + public const string CategoryField = "Category"; + public const string FullyMatchingIDField = "Fully Matching ID"; + public const string PartiallyMatchingIDsField = "Partially Matching IDs"; + public const string RegionField = "Region"; + public const string LanguagesField = "Languages"; + public const string PlaystationLanguageSelectionViaField = "Language Selection Via"; + public const string SerialField = "Serial"; + + #region Ringcode Information + + public const string MasteringRingField = "Mastering Ring"; + public const string MasteringSIDField = "Mastering SID"; + public const string ToolstampMasteringCodeField = "Toolstamp/Mastering Code"; + public const string MouldSIDField = "Mould SID"; + public const string AdditionalMouldField = "Additional Mould"; + public const string WriteOffsetField = "Write Offset"; + + #endregion + + public const string BarcodeField = "Barcode"; + public const string EXEDateBuildDate = "EXE/Build Date"; + public const string ErrorsCountField = "Errors Count"; + public const string CommentsField = "Comments"; + public const string ContentsField = "Contents"; + + #endregion + + #region Version and Editions + + public const string VersionField = "Version"; + public const string EditionsField = "Editions"; + + #endregion + + #region EDC + + public const string EDCField = "EDC"; + + #endregion + + #region Extras + + public const string PVDField = "Primary Volume Descriptor (PVD)"; + public const string DiscKeyField = "Disc Key"; + public const string DiscIDField = "Disc ID"; + public const string PICField = "Permanent Information & Control (PIC)"; + public const string HeaderField = "Header"; + public const string BCAField = "Burst Cutting Area (BCA)"; + public const string SecuritySectorRangesField = "Security Sector Ranges"; + + #endregion + + #region Copy Protection + + public const string PlayStationAntiModchipField = "Anti-modchip"; + public const string PlayStationLibCryptField = "LibCrypt"; + public const string LibCryptDataField = "LibCrypt Data"; + public const string ProtectionField = "Protection"; + public const string SecuROMDataField = "SecuROM Data"; + + #endregion + + #region Tracks and Write Offsets + + public const string ClrMameProDataField = "ClrMamePro Data (DAT)"; + public const string CuesheetField = "Cuesheet"; + + #endregion + + #region Size and Checksums + + public const string LayerbreakField = "Layerbreak"; + + #endregion + + #region Dumping Info + + public const string FrontendVersionField = "Frontend Version"; + public const string DumpingProgramField = "Dumping Program"; + public const string DumpingDateField = "Date"; + public const string DumpingParametersField = "Parameters"; + public const string DumpingDriveManufacturer = "Manufacturer"; + public const string DumpingDriveModel = "Model"; + public const string DumpingDriveFirmware = "Firmware"; + public const string ReportedDiscType = "Reported Disc Type"; + public const string C2ErrorCount = "C2 Error Count"; + + #endregion + + #region Default values + + public const string RequiredValue = "(REQUIRED)"; + public const string RequiredIfExistsValue = "(REQUIRED, IF EXISTS)"; + public const string OptionalValue = "(OPTIONAL)"; + public const string DiscNotDetected = "Disc Not Detected"; + + #endregion + } +} diff --git a/SabreTools.RedumpLib.Legacy/ExtensionAttribute.cs b/SabreTools.RedumpLib.Legacy/ExtensionAttribute.cs new file mode 100644 index 0000000..b40aaca --- /dev/null +++ b/SabreTools.RedumpLib.Legacy/ExtensionAttribute.cs @@ -0,0 +1,9 @@ +#if NET20 + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)] + internal sealed class ExtensionAttribute : Attribute {} +} + +#endif diff --git a/SabreTools.RedumpLib.Legacy/OldDotNet.cs b/SabreTools.RedumpLib.Legacy/OldDotNet.cs new file mode 100644 index 0000000..55c49da --- /dev/null +++ b/SabreTools.RedumpLib.Legacy/OldDotNet.cs @@ -0,0 +1,474 @@ +#if NET20 || NET35 + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text; + +namespace SabreTools.RedumpLib.Legacy +{ + /// + internal static class WebUtility + { + // some consts copied from Char / CharUnicodeInfo since we don't have friend access to those types + private const char HIGH_SURROGATE_START = '\uD800'; + private const char LOW_SURROGATE_START = '\uDC00'; + private const char LOW_SURROGATE_END = '\uDFFF'; + private const int UNICODE_PLANE00_END = 0x00FFFF; + private const int UNICODE_PLANE01_START = 0x10000; + private const int UNICODE_PLANE16_END = 0x10FFFF; + + public static string? HtmlDecode(string? value) + { + if (string.IsNullOrEmpty(value)) + { + return value; + } + + char[] valueSpan = value!.ToCharArray(); + + int index = Array.IndexOf(valueSpan, '&'); + if (index < 0) + { + return value; + } + + // In the worst case the decoded string has the same length. + // For small inputs we use stack allocation. + StringBuilder sb = value.Length <= 256 ? + new StringBuilder(256) : + new StringBuilder(value.Length); + + char[] take = new char[index]; + Array.Copy(valueSpan, take, index); + sb.Append(take); + + char[] skip = new char[valueSpan.Length - index]; + Array.Copy(valueSpan, index, skip, 0, skip.Length); + HtmlDecode(skip, ref sb); + + return sb.ToString(); + } + + private static void HtmlDecode(char[] input, ref StringBuilder output) + { + for (int i = 0; i < input.Length; i++) + { + char ch = input[i]; + + if (ch == '&') + { + // We found a '&'. Now look for the next ';' or '&'. The idea is that + // if we find another '&' before finding a ';', then this is not an entity, + // and the next '&' might start a real entity (VSWhidbey 275184) + char[] inputSlice = new char[input.Length - (i + 1)]; + Array.Copy(input, i + 1, inputSlice, 0, inputSlice.Length); + + int semicolonPos = Array.IndexOf(inputSlice, ';'); + int ampersandPos = Array.IndexOf(inputSlice, '&'); + int entityLength; + if (semicolonPos > -1 && ampersandPos > -1) + entityLength = Math.Min(semicolonPos, ampersandPos); + else if (semicolonPos <= -1 && ampersandPos > -1) + entityLength = ampersandPos; + else if (semicolonPos > -1 && ampersandPos <= -1) + entityLength = semicolonPos; + else + entityLength = -1; + + if (entityLength >= 0 && inputSlice[entityLength] == ';') + { + int entityEndPosition = (i + 1) + entityLength; + if (entityLength > 1 && inputSlice[0] == '#') + { + // The # syntax can be in decimal or hex, e.g. + // å --> decimal + // å --> same char in hex + // See http://www.w3.org/TR/REC-html40/charset.html#entities + + int offset = inputSlice[1] == 'x' || inputSlice[1] == 'X' ? 2 : 1; + char[] inputSliceNoPrefix = new char[entityLength - offset]; + Array.Copy(inputSlice, offset, inputSliceNoPrefix, 0, inputSliceNoPrefix.Length); + + bool parsedSuccessfully = inputSlice[1] == 'x' || inputSlice[1] == 'X' + ? uint.TryParse(new string(inputSliceNoPrefix), NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out uint parsedValue) + : uint.TryParse(new string(inputSliceNoPrefix), NumberStyles.Integer, CultureInfo.InvariantCulture, out parsedValue); + + if (parsedSuccessfully) + { + // decoded character must be U+0000 .. U+10FFFF, excluding surrogates + parsedSuccessfully = ((parsedValue < HIGH_SURROGATE_START) || (LOW_SURROGATE_END < parsedValue && parsedValue <= UNICODE_PLANE16_END)); + } + + if (parsedSuccessfully) + { + if (parsedValue <= UNICODE_PLANE00_END) + { + // single character + output.Append((char)parsedValue); + } + else + { + // multi-character + ConvertSmpToUtf16(parsedValue, out char leadingSurrogate, out char trailingSurrogate); + output.Append(leadingSurrogate); + output.Append(trailingSurrogate); + } + + i = entityEndPosition; // already looked at everything until semicolon + continue; + } + } + else + { + char[] entity = new char[entityLength]; + Array.Copy(inputSlice, entity, entityLength); + i = entityEndPosition; // already looked at everything until semicolon + char entityChar = HtmlEntities.Lookup(entity); + + if (entityChar != (char)0) + { + ch = entityChar; + } + else + { + output.Append('&'); + output.Append(entity); + output.Append(';'); + continue; + } + } + } + } + + output.Append(ch); + } + } + + // similar to Char.ConvertFromUtf32, but doesn't check arguments or generate strings + // input is assumed to be an SMP character + private static void ConvertSmpToUtf16(uint smpChar, out char leadingSurrogate, out char trailingSurrogate) + { + int utf32 = (int)(smpChar - UNICODE_PLANE01_START); + leadingSurrogate = (char)((utf32 / 0x400) + HIGH_SURROGATE_START); + trailingSurrogate = (char)((utf32 % 0x400) + LOW_SURROGATE_START); + } + + // helper class for lookup of HTML encoding entities + private static class HtmlEntities + { + // The list is from http://www.w3.org/TR/REC-html40/sgml/entities.html, except for ', which + // is defined in http://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent. + private static Dictionary InitializeLookupTable() + { + byte[] tableData = + [ + 0x74, 0x6F, 0x75, 0x71, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("quot")*/ 0x22, 0x00, /*'\x0022'*/ + 0x70, 0x6D, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("amp")*/ 0x26, 0x00, /*'\x0026'*/ + 0x73, 0x6F, 0x70, 0x61, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("apos")*/ 0x27, 0x00, /*'\x0027'*/ + 0x74, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("lt")*/ 0x3C, 0x00, /*'\x003c'*/ + 0x74, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("gt")*/ 0x3E, 0x00, /*'\x003e'*/ + 0x70, 0x73, 0x62, 0x6E, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("nbsp")*/ 0xA0, 0x00, /*'\x00a0'*/ + 0x6C, 0x63, 0x78, 0x65, 0x69, 0x00, 0x00, 0x00, /*ToUInt64Key("iexcl")*/ 0xA1, 0x00, /*'\x00a1'*/ + 0x74, 0x6E, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("cent")*/ 0xA2, 0x00, /*'\x00a2'*/ + 0x64, 0x6E, 0x75, 0x6F, 0x70, 0x00, 0x00, 0x00, /*ToUInt64Key("pound")*/ 0xA3, 0x00, /*'\x00a3'*/ + 0x6E, 0x65, 0x72, 0x72, 0x75, 0x63, 0x00, 0x00, /*ToUInt64Key("curren")*/ 0xA4, 0x00, /*'\x00a4'*/ + 0x6E, 0x65, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("yen")*/ 0xA5, 0x00, /*'\x00a5'*/ + 0x72, 0x61, 0x62, 0x76, 0x72, 0x62, 0x00, 0x00, /*ToUInt64Key("brvbar")*/ 0xA6, 0x00, /*'\x00a6'*/ + 0x74, 0x63, 0x65, 0x73, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("sect")*/ 0xA7, 0x00, /*'\x00a7'*/ + 0x6C, 0x6D, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("uml")*/ 0xA8, 0x00, /*'\x00a8'*/ + 0x79, 0x70, 0x6F, 0x63, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("copy")*/ 0xA9, 0x00, /*'\x00a9'*/ + 0x66, 0x64, 0x72, 0x6F, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("ordf")*/ 0xAA, 0x00, /*'\x00aa'*/ + 0x6F, 0x75, 0x71, 0x61, 0x6C, 0x00, 0x00, 0x00, /*ToUInt64Key("laquo")*/ 0xAB, 0x00, /*'\x00ab'*/ + 0x74, 0x6F, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("not")*/ 0xAC, 0x00, /*'\x00ac'*/ + 0x79, 0x68, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("shy")*/ 0xAD, 0x00, /*'\x00ad'*/ + 0x67, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("reg")*/ 0xAE, 0x00, /*'\x00ae'*/ + 0x72, 0x63, 0x61, 0x6D, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("macr")*/ 0xAF, 0x00, /*'\x00af'*/ + 0x67, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("deg")*/ 0xB0, 0x00, /*'\x00b0'*/ + 0x6E, 0x6D, 0x73, 0x75, 0x6C, 0x70, 0x00, 0x00, /*ToUInt64Key("plusmn")*/ 0xB1, 0x00, /*'\x00b1'*/ + 0x32, 0x70, 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("sup2")*/ 0xB2, 0x00, /*'\x00b2'*/ + 0x33, 0x70, 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("sup3")*/ 0xB3, 0x00, /*'\x00b3'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x00, 0x00, 0x00, /*ToUInt64Key("acute")*/ 0xB4, 0x00, /*'\x00b4'*/ + 0x6F, 0x72, 0x63, 0x69, 0x6D, 0x00, 0x00, 0x00, /*ToUInt64Key("micro")*/ 0xB5, 0x00, /*'\x00b5'*/ + 0x61, 0x72, 0x61, 0x70, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("para")*/ 0xB6, 0x00, /*'\x00b6'*/ + 0x74, 0x6F, 0x64, 0x64, 0x69, 0x6D, 0x00, 0x00, /*ToUInt64Key("middot")*/ 0xB7, 0x00, /*'\x00b7'*/ + 0x6C, 0x69, 0x64, 0x65, 0x63, 0x00, 0x00, 0x00, /*ToUInt64Key("cedil")*/ 0xB8, 0x00, /*'\x00b8'*/ + 0x31, 0x70, 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("sup1")*/ 0xB9, 0x00, /*'\x00b9'*/ + 0x6D, 0x64, 0x72, 0x6F, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("ordm")*/ 0xBA, 0x00, /*'\x00ba'*/ + 0x6F, 0x75, 0x71, 0x61, 0x72, 0x00, 0x00, 0x00, /*ToUInt64Key("raquo")*/ 0xBB, 0x00, /*'\x00bb'*/ + 0x34, 0x31, 0x63, 0x61, 0x72, 0x66, 0x00, 0x00, /*ToUInt64Key("frac14")*/ 0xBC, 0x00, /*'\x00bc'*/ + 0x32, 0x31, 0x63, 0x61, 0x72, 0x66, 0x00, 0x00, /*ToUInt64Key("frac12")*/ 0xBD, 0x00, /*'\x00bd'*/ + 0x34, 0x33, 0x63, 0x61, 0x72, 0x66, 0x00, 0x00, /*ToUInt64Key("frac34")*/ 0xBE, 0x00, /*'\x00be'*/ + 0x74, 0x73, 0x65, 0x75, 0x71, 0x69, 0x00, 0x00, /*ToUInt64Key("iquest")*/ 0xBF, 0x00, /*'\x00bf'*/ + 0x65, 0x76, 0x61, 0x72, 0x67, 0x41, 0x00, 0x00, /*ToUInt64Key("Agrave")*/ 0xC0, 0x00, /*'\x00c0'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x41, 0x00, 0x00, /*ToUInt64Key("Aacute")*/ 0xC1, 0x00, /*'\x00c1'*/ + 0x63, 0x72, 0x69, 0x63, 0x41, 0x00, 0x00, 0x00, /*ToUInt64Key("Acirc")*/ 0xC2, 0x00, /*'\x00c2'*/ + 0x65, 0x64, 0x6C, 0x69, 0x74, 0x41, 0x00, 0x00, /*ToUInt64Key("Atilde")*/ 0xC3, 0x00, /*'\x00c3'*/ + 0x6C, 0x6D, 0x75, 0x41, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Auml")*/ 0xC4, 0x00, /*'\x00c4'*/ + 0x67, 0x6E, 0x69, 0x72, 0x41, 0x00, 0x00, 0x00, /*ToUInt64Key("Aring")*/ 0xC5, 0x00, /*'\x00c5'*/ + 0x67, 0x69, 0x6C, 0x45, 0x41, 0x00, 0x00, 0x00, /*ToUInt64Key("AElig")*/ 0xC6, 0x00, /*'\x00c6'*/ + 0x6C, 0x69, 0x64, 0x65, 0x63, 0x43, 0x00, 0x00, /*ToUInt64Key("Ccedil")*/ 0xC7, 0x00, /*'\x00c7'*/ + 0x65, 0x76, 0x61, 0x72, 0x67, 0x45, 0x00, 0x00, /*ToUInt64Key("Egrave")*/ 0xC8, 0x00, /*'\x00c8'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x45, 0x00, 0x00, /*ToUInt64Key("Eacute")*/ 0xC9, 0x00, /*'\x00c9'*/ + 0x63, 0x72, 0x69, 0x63, 0x45, 0x00, 0x00, 0x00, /*ToUInt64Key("Ecirc")*/ 0xCA, 0x00, /*'\x00ca'*/ + 0x6C, 0x6D, 0x75, 0x45, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Euml")*/ 0xCB, 0x00, /*'\x00cb'*/ + 0x65, 0x76, 0x61, 0x72, 0x67, 0x49, 0x00, 0x00, /*ToUInt64Key("Igrave")*/ 0xCC, 0x00, /*'\x00cc'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x49, 0x00, 0x00, /*ToUInt64Key("Iacute")*/ 0xCD, 0x00, /*'\x00cd'*/ + 0x63, 0x72, 0x69, 0x63, 0x49, 0x00, 0x00, 0x00, /*ToUInt64Key("Icirc")*/ 0xCE, 0x00, /*'\x00ce'*/ + 0x6C, 0x6D, 0x75, 0x49, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Iuml")*/ 0xCF, 0x00, /*'\x00cf'*/ + 0x48, 0x54, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("ETH")*/ 0xD0, 0x00, /*'\x00d0'*/ + 0x65, 0x64, 0x6C, 0x69, 0x74, 0x4E, 0x00, 0x00, /*ToUInt64Key("Ntilde")*/ 0xD1, 0x00, /*'\x00d1'*/ + 0x65, 0x76, 0x61, 0x72, 0x67, 0x4F, 0x00, 0x00, /*ToUInt64Key("Ograve")*/ 0xD2, 0x00, /*'\x00d2'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x4F, 0x00, 0x00, /*ToUInt64Key("Oacute")*/ 0xD3, 0x00, /*'\x00d3'*/ + 0x63, 0x72, 0x69, 0x63, 0x4F, 0x00, 0x00, 0x00, /*ToUInt64Key("Ocirc")*/ 0xD4, 0x00, /*'\x00d4'*/ + 0x65, 0x64, 0x6C, 0x69, 0x74, 0x4F, 0x00, 0x00, /*ToUInt64Key("Otilde")*/ 0xD5, 0x00, /*'\x00d5'*/ + 0x6C, 0x6D, 0x75, 0x4F, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Ouml")*/ 0xD6, 0x00, /*'\x00d6'*/ + 0x73, 0x65, 0x6D, 0x69, 0x74, 0x00, 0x00, 0x00, /*ToUInt64Key("times")*/ 0xD7, 0x00, /*'\x00d7'*/ + 0x68, 0x73, 0x61, 0x6C, 0x73, 0x4F, 0x00, 0x00, /*ToUInt64Key("Oslash")*/ 0xD8, 0x00, /*'\x00d8'*/ + 0x65, 0x76, 0x61, 0x72, 0x67, 0x55, 0x00, 0x00, /*ToUInt64Key("Ugrave")*/ 0xD9, 0x00, /*'\x00d9'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x55, 0x00, 0x00, /*ToUInt64Key("Uacute")*/ 0xDA, 0x00, /*'\x00da'*/ + 0x63, 0x72, 0x69, 0x63, 0x55, 0x00, 0x00, 0x00, /*ToUInt64Key("Ucirc")*/ 0xDB, 0x00, /*'\x00db'*/ + 0x6C, 0x6D, 0x75, 0x55, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Uuml")*/ 0xDC, 0x00, /*'\x00dc'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x59, 0x00, 0x00, /*ToUInt64Key("Yacute")*/ 0xDD, 0x00, /*'\x00dd'*/ + 0x4E, 0x52, 0x4F, 0x48, 0x54, 0x00, 0x00, 0x00, /*ToUInt64Key("THORN")*/ 0xDE, 0x00, /*'\x00de'*/ + 0x67, 0x69, 0x6C, 0x7A, 0x73, 0x00, 0x00, 0x00, /*ToUInt64Key("szlig")*/ 0xDF, 0x00, /*'\x00df'*/ + 0x65, 0x76, 0x61, 0x72, 0x67, 0x61, 0x00, 0x00, /*ToUInt64Key("agrave")*/ 0xE0, 0x00, /*'\x00e0'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x61, 0x00, 0x00, /*ToUInt64Key("aacute")*/ 0xE1, 0x00, /*'\x00e1'*/ + 0x63, 0x72, 0x69, 0x63, 0x61, 0x00, 0x00, 0x00, /*ToUInt64Key("acirc")*/ 0xE2, 0x00, /*'\x00e2'*/ + 0x65, 0x64, 0x6C, 0x69, 0x74, 0x61, 0x00, 0x00, /*ToUInt64Key("atilde")*/ 0xE3, 0x00, /*'\x00e3'*/ + 0x6C, 0x6D, 0x75, 0x61, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("auml")*/ 0xE4, 0x00, /*'\x00e4'*/ + 0x67, 0x6E, 0x69, 0x72, 0x61, 0x00, 0x00, 0x00, /*ToUInt64Key("aring")*/ 0xE5, 0x00, /*'\x00e5'*/ + 0x67, 0x69, 0x6C, 0x65, 0x61, 0x00, 0x00, 0x00, /*ToUInt64Key("aelig")*/ 0xE6, 0x00, /*'\x00e6'*/ + 0x6C, 0x69, 0x64, 0x65, 0x63, 0x63, 0x00, 0x00, /*ToUInt64Key("ccedil")*/ 0xE7, 0x00, /*'\x00e7'*/ + 0x65, 0x76, 0x61, 0x72, 0x67, 0x65, 0x00, 0x00, /*ToUInt64Key("egrave")*/ 0xE8, 0x00, /*'\x00e8'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x65, 0x00, 0x00, /*ToUInt64Key("eacute")*/ 0xE9, 0x00, /*'\x00e9'*/ + 0x63, 0x72, 0x69, 0x63, 0x65, 0x00, 0x00, 0x00, /*ToUInt64Key("ecirc")*/ 0xEA, 0x00, /*'\x00ea'*/ + 0x6C, 0x6D, 0x75, 0x65, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("euml")*/ 0xEB, 0x00, /*'\x00eb'*/ + 0x65, 0x76, 0x61, 0x72, 0x67, 0x69, 0x00, 0x00, /*ToUInt64Key("igrave")*/ 0xEC, 0x00, /*'\x00ec'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x69, 0x00, 0x00, /*ToUInt64Key("iacute")*/ 0xED, 0x00, /*'\x00ed'*/ + 0x63, 0x72, 0x69, 0x63, 0x69, 0x00, 0x00, 0x00, /*ToUInt64Key("icirc")*/ 0xEE, 0x00, /*'\x00ee'*/ + 0x6C, 0x6D, 0x75, 0x69, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("iuml")*/ 0xEF, 0x00, /*'\x00ef'*/ + 0x68, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("eth")*/ 0xF0, 0x00, /*'\x00f0'*/ + 0x65, 0x64, 0x6C, 0x69, 0x74, 0x6E, 0x00, 0x00, /*ToUInt64Key("ntilde")*/ 0xF1, 0x00, /*'\x00f1'*/ + 0x65, 0x76, 0x61, 0x72, 0x67, 0x6F, 0x00, 0x00, /*ToUInt64Key("ograve")*/ 0xF2, 0x00, /*'\x00f2'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x6F, 0x00, 0x00, /*ToUInt64Key("oacute")*/ 0xF3, 0x00, /*'\x00f3'*/ + 0x63, 0x72, 0x69, 0x63, 0x6F, 0x00, 0x00, 0x00, /*ToUInt64Key("ocirc")*/ 0xF4, 0x00, /*'\x00f4'*/ + 0x65, 0x64, 0x6C, 0x69, 0x74, 0x6F, 0x00, 0x00, /*ToUInt64Key("otilde")*/ 0xF5, 0x00, /*'\x00f5'*/ + 0x6C, 0x6D, 0x75, 0x6F, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("ouml")*/ 0xF6, 0x00, /*'\x00f6'*/ + 0x65, 0x64, 0x69, 0x76, 0x69, 0x64, 0x00, 0x00, /*ToUInt64Key("divide")*/ 0xF7, 0x00, /*'\x00f7'*/ + 0x68, 0x73, 0x61, 0x6C, 0x73, 0x6F, 0x00, 0x00, /*ToUInt64Key("oslash")*/ 0xF8, 0x00, /*'\x00f8'*/ + 0x65, 0x76, 0x61, 0x72, 0x67, 0x75, 0x00, 0x00, /*ToUInt64Key("ugrave")*/ 0xF9, 0x00, /*'\x00f9'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x75, 0x00, 0x00, /*ToUInt64Key("uacute")*/ 0xFA, 0x00, /*'\x00fa'*/ + 0x63, 0x72, 0x69, 0x63, 0x75, 0x00, 0x00, 0x00, /*ToUInt64Key("ucirc")*/ 0xFB, 0x00, /*'\x00fb'*/ + 0x6C, 0x6D, 0x75, 0x75, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("uuml")*/ 0xFC, 0x00, /*'\x00fc'*/ + 0x65, 0x74, 0x75, 0x63, 0x61, 0x79, 0x00, 0x00, /*ToUInt64Key("yacute")*/ 0xFD, 0x00, /*'\x00fd'*/ + 0x6E, 0x72, 0x6F, 0x68, 0x74, 0x00, 0x00, 0x00, /*ToUInt64Key("thorn")*/ 0xFE, 0x00, /*'\x00fe'*/ + 0x6C, 0x6D, 0x75, 0x79, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("yuml")*/ 0xFF, 0x00, /*'\x00ff'*/ + 0x67, 0x69, 0x6C, 0x45, 0x4F, 0x00, 0x00, 0x00, /*ToUInt64Key("OElig")*/ 0x52, 0x01, /*'\x0152'*/ + 0x67, 0x69, 0x6C, 0x65, 0x6F, 0x00, 0x00, 0x00, /*ToUInt64Key("oelig")*/ 0x53, 0x01, /*'\x0153'*/ + 0x6E, 0x6F, 0x72, 0x61, 0x63, 0x53, 0x00, 0x00, /*ToUInt64Key("Scaron")*/ 0x60, 0x01, /*'\x0160'*/ + 0x6E, 0x6F, 0x72, 0x61, 0x63, 0x73, 0x00, 0x00, /*ToUInt64Key("scaron")*/ 0x61, 0x01, /*'\x0161'*/ + 0x6C, 0x6D, 0x75, 0x59, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Yuml")*/ 0x78, 0x01, /*'\x0178'*/ + 0x66, 0x6F, 0x6E, 0x66, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("fnof")*/ 0x92, 0x01, /*'\x0192'*/ + 0x63, 0x72, 0x69, 0x63, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("circ")*/ 0xC6, 0x02, /*'\x02c6'*/ + 0x65, 0x64, 0x6C, 0x69, 0x74, 0x00, 0x00, 0x00, /*ToUInt64Key("tilde")*/ 0xDC, 0x02, /*'\x02dc'*/ + 0x61, 0x68, 0x70, 0x6C, 0x41, 0x00, 0x00, 0x00, /*ToUInt64Key("Alpha")*/ 0x91, 0x03, /*'\x0391'*/ + 0x61, 0x74, 0x65, 0x42, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Beta")*/ 0x92, 0x03, /*'\x0392'*/ + 0x61, 0x6D, 0x6D, 0x61, 0x47, 0x00, 0x00, 0x00, /*ToUInt64Key("Gamma")*/ 0x93, 0x03, /*'\x0393'*/ + 0x61, 0x74, 0x6C, 0x65, 0x44, 0x00, 0x00, 0x00, /*ToUInt64Key("Delta")*/ 0x94, 0x03, /*'\x0394'*/ + 0x6E, 0x6F, 0x6C, 0x69, 0x73, 0x70, 0x45, 0x00, /*ToUInt64Key("Epsilon")*/ 0x95, 0x03, /*'\x0395'*/ + 0x61, 0x74, 0x65, 0x5A, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Zeta")*/ 0x96, 0x03, /*'\x0396'*/ + 0x61, 0x74, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Eta")*/ 0x97, 0x03, /*'\x0397'*/ + 0x61, 0x74, 0x65, 0x68, 0x54, 0x00, 0x00, 0x00, /*ToUInt64Key("Theta")*/ 0x98, 0x03, /*'\x0398'*/ + 0x61, 0x74, 0x6F, 0x49, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Iota")*/ 0x99, 0x03, /*'\x0399'*/ + 0x61, 0x70, 0x70, 0x61, 0x4B, 0x00, 0x00, 0x00, /*ToUInt64Key("Kappa")*/ 0x9A, 0x03, /*'\x039a'*/ + 0x61, 0x64, 0x62, 0x6D, 0x61, 0x4C, 0x00, 0x00, /*ToUInt64Key("Lambda")*/ 0x9B, 0x03, /*'\x039b'*/ + 0x75, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Mu")*/ 0x9C, 0x03, /*'\x039c'*/ + 0x75, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Nu")*/ 0x9D, 0x03, /*'\x039d'*/ + 0x69, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Xi")*/ 0x9E, 0x03, /*'\x039e'*/ + 0x6E, 0x6F, 0x72, 0x63, 0x69, 0x6D, 0x4F, 0x00, /*ToUInt64Key("Omicron")*/ 0x9F, 0x03, /*'\x039f'*/ + 0x69, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Pi")*/ 0xA0, 0x03, /*'\x03a0'*/ + 0x6F, 0x68, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Rho")*/ 0xA1, 0x03, /*'\x03a1'*/ + 0x61, 0x6D, 0x67, 0x69, 0x53, 0x00, 0x00, 0x00, /*ToUInt64Key("Sigma")*/ 0xA3, 0x03, /*'\x03a3'*/ + 0x75, 0x61, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Tau")*/ 0xA4, 0x03, /*'\x03a4'*/ + 0x6E, 0x6F, 0x6C, 0x69, 0x73, 0x70, 0x55, 0x00, /*ToUInt64Key("Upsilon")*/ 0xA5, 0x03, /*'\x03a5'*/ + 0x69, 0x68, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Phi")*/ 0xA6, 0x03, /*'\x03a6'*/ + 0x69, 0x68, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Chi")*/ 0xA7, 0x03, /*'\x03a7'*/ + 0x69, 0x73, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("Psi")*/ 0xA8, 0x03, /*'\x03a8'*/ + 0x61, 0x67, 0x65, 0x6D, 0x4F, 0x00, 0x00, 0x00, /*ToUInt64Key("Omega")*/ 0xA9, 0x03, /*'\x03a9'*/ + 0x61, 0x68, 0x70, 0x6C, 0x61, 0x00, 0x00, 0x00, /*ToUInt64Key("alpha")*/ 0xB1, 0x03, /*'\x03b1'*/ + 0x61, 0x74, 0x65, 0x62, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("beta")*/ 0xB2, 0x03, /*'\x03b2'*/ + 0x61, 0x6D, 0x6D, 0x61, 0x67, 0x00, 0x00, 0x00, /*ToUInt64Key("gamma")*/ 0xB3, 0x03, /*'\x03b3'*/ + 0x61, 0x74, 0x6C, 0x65, 0x64, 0x00, 0x00, 0x00, /*ToUInt64Key("delta")*/ 0xB4, 0x03, /*'\x03b4'*/ + 0x6E, 0x6F, 0x6C, 0x69, 0x73, 0x70, 0x65, 0x00, /*ToUInt64Key("epsilon")*/ 0xB5, 0x03, /*'\x03b5'*/ + 0x61, 0x74, 0x65, 0x7A, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("zeta")*/ 0xB6, 0x03, /*'\x03b6'*/ + 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("eta")*/ 0xB7, 0x03, /*'\x03b7'*/ + 0x61, 0x74, 0x65, 0x68, 0x74, 0x00, 0x00, 0x00, /*ToUInt64Key("theta")*/ 0xB8, 0x03, /*'\x03b8'*/ + 0x61, 0x74, 0x6F, 0x69, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("iota")*/ 0xB9, 0x03, /*'\x03b9'*/ + 0x61, 0x70, 0x70, 0x61, 0x6B, 0x00, 0x00, 0x00, /*ToUInt64Key("kappa")*/ 0xBA, 0x03, /*'\x03ba'*/ + 0x61, 0x64, 0x62, 0x6D, 0x61, 0x6C, 0x00, 0x00, /*ToUInt64Key("lambda")*/ 0xBB, 0x03, /*'\x03bb'*/ + 0x75, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("mu")*/ 0xBC, 0x03, /*'\x03bc'*/ + 0x75, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("nu")*/ 0xBD, 0x03, /*'\x03bd'*/ + 0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("xi")*/ 0xBE, 0x03, /*'\x03be'*/ + 0x6E, 0x6F, 0x72, 0x63, 0x69, 0x6D, 0x6F, 0x00, /*ToUInt64Key("omicron")*/ 0xBF, 0x03, /*'\x03bf'*/ + 0x69, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("pi")*/ 0xC0, 0x03, /*'\x03c0'*/ + 0x6F, 0x68, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("rho")*/ 0xC1, 0x03, /*'\x03c1'*/ + 0x66, 0x61, 0x6D, 0x67, 0x69, 0x73, 0x00, 0x00, /*ToUInt64Key("sigmaf")*/ 0xC2, 0x03, /*'\x03c2'*/ + 0x61, 0x6D, 0x67, 0x69, 0x73, 0x00, 0x00, 0x00, /*ToUInt64Key("sigma")*/ 0xC3, 0x03, /*'\x03c3'*/ + 0x75, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("tau")*/ 0xC4, 0x03, /*'\x03c4'*/ + 0x6E, 0x6F, 0x6C, 0x69, 0x73, 0x70, 0x75, 0x00, /*ToUInt64Key("upsilon")*/ 0xC5, 0x03, /*'\x03c5'*/ + 0x69, 0x68, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("phi")*/ 0xC6, 0x03, /*'\x03c6'*/ + 0x69, 0x68, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("chi")*/ 0xC7, 0x03, /*'\x03c7'*/ + 0x69, 0x73, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("psi")*/ 0xC8, 0x03, /*'\x03c8'*/ + 0x61, 0x67, 0x65, 0x6D, 0x6F, 0x00, 0x00, 0x00, /*ToUInt64Key("omega")*/ 0xC9, 0x03, /*'\x03c9'*/ + 0x6D, 0x79, 0x73, 0x61, 0x74, 0x65, 0x68, 0x74, /*ToUInt64Key("thetasym")*/0xD1, 0x03, /*'\x03d1'*/ + 0x68, 0x69, 0x73, 0x70, 0x75, 0x00, 0x00, 0x00, /*ToUInt64Key("upsih")*/ 0xD2, 0x03, /*'\x03d2'*/ + 0x76, 0x69, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("piv")*/ 0xD6, 0x03, /*'\x03d6'*/ + 0x70, 0x73, 0x6E, 0x65, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("ensp")*/ 0x02, 0x20, /*'\x2002'*/ + 0x70, 0x73, 0x6D, 0x65, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("emsp")*/ 0x03, 0x20, /*'\x2003'*/ + 0x70, 0x73, 0x6E, 0x69, 0x68, 0x74, 0x00, 0x00, /*ToUInt64Key("thinsp")*/ 0x09, 0x20, /*'\x2009'*/ + 0x6A, 0x6E, 0x77, 0x7A, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("zwnj")*/ 0x0C, 0x20, /*'\x200c'*/ + 0x6A, 0x77, 0x7A, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("zwj")*/ 0x0D, 0x20, /*'\x200d'*/ + 0x6D, 0x72, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("lrm")*/ 0x0E, 0x20, /*'\x200e'*/ + 0x6D, 0x6C, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("rlm")*/ 0x0F, 0x20, /*'\x200f'*/ + 0x68, 0x73, 0x61, 0x64, 0x6E, 0x00, 0x00, 0x00, /*ToUInt64Key("ndash")*/ 0x13, 0x20, /*'\x2013'*/ + 0x68, 0x73, 0x61, 0x64, 0x6D, 0x00, 0x00, 0x00, /*ToUInt64Key("mdash")*/ 0x14, 0x20, /*'\x2014'*/ + 0x6F, 0x75, 0x71, 0x73, 0x6C, 0x00, 0x00, 0x00, /*ToUInt64Key("lsquo")*/ 0x18, 0x20, /*'\x2018'*/ + 0x6F, 0x75, 0x71, 0x73, 0x72, 0x00, 0x00, 0x00, /*ToUInt64Key("rsquo")*/ 0x19, 0x20, /*'\x2019'*/ + 0x6F, 0x75, 0x71, 0x62, 0x73, 0x00, 0x00, 0x00, /*ToUInt64Key("sbquo")*/ 0x1A, 0x20, /*'\x201a'*/ + 0x6F, 0x75, 0x71, 0x64, 0x6C, 0x00, 0x00, 0x00, /*ToUInt64Key("ldquo")*/ 0x1C, 0x20, /*'\x201c'*/ + 0x6F, 0x75, 0x71, 0x64, 0x72, 0x00, 0x00, 0x00, /*ToUInt64Key("rdquo")*/ 0x1D, 0x20, /*'\x201d'*/ + 0x6F, 0x75, 0x71, 0x64, 0x62, 0x00, 0x00, 0x00, /*ToUInt64Key("bdquo")*/ 0x1E, 0x20, /*'\x201e'*/ + 0x72, 0x65, 0x67, 0x67, 0x61, 0x64, 0x00, 0x00, /*ToUInt64Key("dagger")*/ 0x20, 0x20, /*'\x2020'*/ + 0x72, 0x65, 0x67, 0x67, 0x61, 0x44, 0x00, 0x00, /*ToUInt64Key("Dagger")*/ 0x21, 0x20, /*'\x2021'*/ + 0x6C, 0x6C, 0x75, 0x62, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("bull")*/ 0x22, 0x20, /*'\x2022'*/ + 0x70, 0x69, 0x6C, 0x6C, 0x65, 0x68, 0x00, 0x00, /*ToUInt64Key("hellip")*/ 0x26, 0x20, /*'\x2026'*/ + 0x6C, 0x69, 0x6D, 0x72, 0x65, 0x70, 0x00, 0x00, /*ToUInt64Key("permil")*/ 0x30, 0x20, /*'\x2030'*/ + 0x65, 0x6D, 0x69, 0x72, 0x70, 0x00, 0x00, 0x00, /*ToUInt64Key("prime")*/ 0x32, 0x20, /*'\x2032'*/ + 0x65, 0x6D, 0x69, 0x72, 0x50, 0x00, 0x00, 0x00, /*ToUInt64Key("Prime")*/ 0x33, 0x20, /*'\x2033'*/ + 0x6F, 0x75, 0x71, 0x61, 0x73, 0x6C, 0x00, 0x00, /*ToUInt64Key("lsaquo")*/ 0x39, 0x20, /*'\x2039'*/ + 0x6F, 0x75, 0x71, 0x61, 0x73, 0x72, 0x00, 0x00, /*ToUInt64Key("rsaquo")*/ 0x3A, 0x20, /*'\x203a'*/ + 0x65, 0x6E, 0x69, 0x6C, 0x6F, 0x00, 0x00, 0x00, /*ToUInt64Key("oline")*/ 0x3E, 0x20, /*'\x203e'*/ + 0x6C, 0x73, 0x61, 0x72, 0x66, 0x00, 0x00, 0x00, /*ToUInt64Key("frasl")*/ 0x44, 0x20, /*'\x2044'*/ + 0x6F, 0x72, 0x75, 0x65, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("euro")*/ 0xAC, 0x20, /*'\x20ac'*/ + 0x65, 0x67, 0x61, 0x6D, 0x69, 0x00, 0x00, 0x00, /*ToUInt64Key("image")*/ 0x11, 0x21, /*'\x2111'*/ + 0x70, 0x72, 0x65, 0x69, 0x65, 0x77, 0x00, 0x00, /*ToUInt64Key("weierp")*/ 0x18, 0x21, /*'\x2118'*/ + 0x6C, 0x61, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("real")*/ 0x1C, 0x21, /*'\x211c'*/ + 0x65, 0x64, 0x61, 0x72, 0x74, 0x00, 0x00, 0x00, /*ToUInt64Key("trade")*/ 0x22, 0x21, /*'\x2122'*/ + 0x6D, 0x79, 0x73, 0x66, 0x65, 0x6C, 0x61, 0x00, /*ToUInt64Key("alefsym")*/ 0x35, 0x21, /*'\x2135'*/ + 0x72, 0x72, 0x61, 0x6C, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("larr")*/ 0x90, 0x21, /*'\x2190'*/ + 0x72, 0x72, 0x61, 0x75, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("uarr")*/ 0x91, 0x21, /*'\x2191'*/ + 0x72, 0x72, 0x61, 0x72, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("rarr")*/ 0x92, 0x21, /*'\x2192'*/ + 0x72, 0x72, 0x61, 0x64, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("darr")*/ 0x93, 0x21, /*'\x2193'*/ + 0x72, 0x72, 0x61, 0x68, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("harr")*/ 0x94, 0x21, /*'\x2194'*/ + 0x72, 0x72, 0x61, 0x72, 0x63, 0x00, 0x00, 0x00, /*ToUInt64Key("crarr")*/ 0xB5, 0x21, /*'\x21b5'*/ + 0x72, 0x72, 0x41, 0x6C, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("lArr")*/ 0xD0, 0x21, /*'\x21d0'*/ + 0x72, 0x72, 0x41, 0x75, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("uArr")*/ 0xD1, 0x21, /*'\x21d1'*/ + 0x72, 0x72, 0x41, 0x72, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("rArr")*/ 0xD2, 0x21, /*'\x21d2'*/ + 0x72, 0x72, 0x41, 0x64, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("dArr")*/ 0xD3, 0x21, /*'\x21d3'*/ + 0x72, 0x72, 0x41, 0x68, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("hArr")*/ 0xD4, 0x21, /*'\x21d4'*/ + 0x6C, 0x6C, 0x61, 0x72, 0x6F, 0x66, 0x00, 0x00, /*ToUInt64Key("forall")*/ 0x00, 0x22, /*'\x2200'*/ + 0x74, 0x72, 0x61, 0x70, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("part")*/ 0x02, 0x22, /*'\x2202'*/ + 0x74, 0x73, 0x69, 0x78, 0x65, 0x00, 0x00, 0x00, /*ToUInt64Key("exist")*/ 0x03, 0x22, /*'\x2203'*/ + 0x79, 0x74, 0x70, 0x6D, 0x65, 0x00, 0x00, 0x00, /*ToUInt64Key("empty")*/ 0x05, 0x22, /*'\x2205'*/ + 0x61, 0x6C, 0x62, 0x61, 0x6E, 0x00, 0x00, 0x00, /*ToUInt64Key("nabla")*/ 0x07, 0x22, /*'\x2207'*/ + 0x6E, 0x69, 0x73, 0x69, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("isin")*/ 0x08, 0x22, /*'\x2208'*/ + 0x6E, 0x69, 0x74, 0x6F, 0x6E, 0x00, 0x00, 0x00, /*ToUInt64Key("notin")*/ 0x09, 0x22, /*'\x2209'*/ + 0x69, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("ni")*/ 0x0B, 0x22, /*'\x220b'*/ + 0x64, 0x6F, 0x72, 0x70, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("prod")*/ 0x0F, 0x22, /*'\x220f'*/ + 0x6D, 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("sum")*/ 0x11, 0x22, /*'\x2211'*/ + 0x73, 0x75, 0x6E, 0x69, 0x6D, 0x00, 0x00, 0x00, /*ToUInt64Key("minus")*/ 0x12, 0x22, /*'\x2212'*/ + 0x74, 0x73, 0x61, 0x77, 0x6F, 0x6C, 0x00, 0x00, /*ToUInt64Key("lowast")*/ 0x17, 0x22, /*'\x2217'*/ + 0x63, 0x69, 0x64, 0x61, 0x72, 0x00, 0x00, 0x00, /*ToUInt64Key("radic")*/ 0x1A, 0x22, /*'\x221a'*/ + 0x70, 0x6F, 0x72, 0x70, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("prop")*/ 0x1D, 0x22, /*'\x221d'*/ + 0x6E, 0x69, 0x66, 0x6E, 0x69, 0x00, 0x00, 0x00, /*ToUInt64Key("infin")*/ 0x1E, 0x22, /*'\x221e'*/ + 0x67, 0x6E, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("ang")*/ 0x20, 0x22, /*'\x2220'*/ + 0x64, 0x6E, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("and")*/ 0x27, 0x22, /*'\x2227'*/ + 0x72, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("or")*/ 0x28, 0x22, /*'\x2228'*/ + 0x70, 0x61, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("cap")*/ 0x29, 0x22, /*'\x2229'*/ + 0x70, 0x75, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("cup")*/ 0x2A, 0x22, /*'\x222a'*/ + 0x74, 0x6E, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("int")*/ 0x2B, 0x22, /*'\x222b'*/ + 0x34, 0x65, 0x72, 0x65, 0x68, 0x74, 0x00, 0x00, /*ToUInt64Key("there4")*/ 0x34, 0x22, /*'\x2234'*/ + 0x6D, 0x69, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("sim")*/ 0x3C, 0x22, /*'\x223c'*/ + 0x67, 0x6E, 0x6F, 0x63, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("cong")*/ 0x45, 0x22, /*'\x2245'*/ + 0x70, 0x6D, 0x79, 0x73, 0x61, 0x00, 0x00, 0x00, /*ToUInt64Key("asymp")*/ 0x48, 0x22, /*'\x2248'*/ + 0x65, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("ne")*/ 0x60, 0x22, /*'\x2260'*/ + 0x76, 0x69, 0x75, 0x71, 0x65, 0x00, 0x00, 0x00, /*ToUInt64Key("equiv")*/ 0x61, 0x22, /*'\x2261'*/ + 0x65, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("le")*/ 0x64, 0x22, /*'\x2264'*/ + 0x65, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("ge")*/ 0x65, 0x22, /*'\x2265'*/ + 0x62, 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("sub")*/ 0x82, 0x22, /*'\x2282'*/ + 0x70, 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("sup")*/ 0x83, 0x22, /*'\x2283'*/ + 0x62, 0x75, 0x73, 0x6E, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("nsub")*/ 0x84, 0x22, /*'\x2284'*/ + 0x65, 0x62, 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("sube")*/ 0x86, 0x22, /*'\x2286'*/ + 0x65, 0x70, 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("supe")*/ 0x87, 0x22, /*'\x2287'*/ + 0x73, 0x75, 0x6C, 0x70, 0x6F, 0x00, 0x00, 0x00, /*ToUInt64Key("oplus")*/ 0x95, 0x22, /*'\x2295'*/ + 0x73, 0x65, 0x6D, 0x69, 0x74, 0x6F, 0x00, 0x00, /*ToUInt64Key("otimes")*/ 0x97, 0x22, /*'\x2297'*/ + 0x70, 0x72, 0x65, 0x70, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("perp")*/ 0xA5, 0x22, /*'\x22a5'*/ + 0x74, 0x6F, 0x64, 0x73, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("sdot")*/ 0xC5, 0x22, /*'\x22c5'*/ + 0x6C, 0x69, 0x65, 0x63, 0x6C, 0x00, 0x00, 0x00, /*ToUInt64Key("lceil")*/ 0x08, 0x23, /*'\x2308'*/ + 0x6C, 0x69, 0x65, 0x63, 0x72, 0x00, 0x00, 0x00, /*ToUInt64Key("rceil")*/ 0x09, 0x23, /*'\x2309'*/ + 0x72, 0x6F, 0x6F, 0x6C, 0x66, 0x6C, 0x00, 0x00, /*ToUInt64Key("lfloor")*/ 0x0A, 0x23, /*'\x230a'*/ + 0x72, 0x6F, 0x6F, 0x6C, 0x66, 0x72, 0x00, 0x00, /*ToUInt64Key("rfloor")*/ 0x0B, 0x23, /*'\x230b'*/ + 0x67, 0x6E, 0x61, 0x6C, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("lang")*/ 0x29, 0x23, /*'\x2329'*/ + 0x67, 0x6E, 0x61, 0x72, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("rang")*/ 0x2A, 0x23, /*'\x232a'*/ + 0x7A, 0x6F, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, /*ToUInt64Key("loz")*/ 0xCA, 0x25, /*'\x25ca'*/ + 0x73, 0x65, 0x64, 0x61, 0x70, 0x73, 0x00, 0x00, /*ToUInt64Key("spades")*/ 0x60, 0x26, /*'\x2660'*/ + 0x73, 0x62, 0x75, 0x6C, 0x63, 0x00, 0x00, 0x00, /*ToUInt64Key("clubs")*/ 0x63, 0x26, /*'\x2663'*/ + 0x73, 0x74, 0x72, 0x61, 0x65, 0x68, 0x00, 0x00, /*ToUInt64Key("hearts")*/ 0x65, 0x26, /*'\x2665'*/ + 0x73, 0x6D, 0x61, 0x69, 0x64, 0x00, 0x00, 0x00, /*ToUInt64Key("diams")*/ 0x66, 0x26, /*'\x2666'*/ + ]; + + var dictionary = new Dictionary(tableData.Length / (sizeof(ulong) + sizeof(char))); + while (tableData.Length > 0) + { + ulong key = BitConverter.ToUInt64(tableData, 0); + char value = (char)BitConverter.ToUInt16(tableData, sizeof(ulong)); + dictionary[key] = value; + + byte[] tempTableData = new byte[tableData.Length - (sizeof(ulong) + sizeof(char))]; + Array.Copy(tableData, (sizeof(ulong) + sizeof(char)), tempTableData, 0, tempTableData.Length); + tableData = tempTableData; + } + return dictionary; + } + + // maps entity strings => unicode chars + private static readonly Dictionary s_lookupTable = InitializeLookupTable(); + + public static char Lookup(char[] entity) + { + // To avoid an allocation, keys of type "ulong" are used in the lookup table. + // Since all entity strings comprise 8 characters or less and are ASCII-only, they "fit" into an ulong (8 bytes). + if (entity.Length <= 8) + { + s_lookupTable.TryGetValue(ToUInt64Key(entity), out char result); + return result; + } + else + { + // Currently, there are no entities that are longer than 8 characters. + return (char)0; + } + } + + private static ulong ToUInt64Key(char[] entity) + { + // The ulong key is the reversed single-byte character representation of the actual entity string. + ulong key = 0; + for (int i = 0; i < entity.Length; i++) + { + if (entity[i] > 0xFF) + { + return 0; + } + + key = (key << 8) | entity[i]; + } + + return key; + } + } + } +} + +#endif diff --git a/SabreTools.RedumpLib.Legacy/SabreTools.RedumpLib.Legacy.csproj b/SabreTools.RedumpLib.Legacy/SabreTools.RedumpLib.Legacy.csproj index e2e23ac..12d1b08 100644 --- a/SabreTools.RedumpLib.Legacy/SabreTools.RedumpLib.Legacy.csproj +++ b/SabreTools.RedumpLib.Legacy/SabreTools.RedumpLib.Legacy.csproj @@ -30,10 +30,6 @@ - - - - diff --git a/SabreTools.RedumpLib.Legacy/Tools/Builder.cs b/SabreTools.RedumpLib.Legacy/Tools/Builder.cs index 50f6d05..9b38d40 100644 --- a/SabreTools.RedumpLib.Legacy/Tools/Builder.cs +++ b/SabreTools.RedumpLib.Legacy/Tools/Builder.cs @@ -5,11 +5,8 @@ using System.Net; #endif using System.Text.RegularExpressions; using System.Threading.Tasks; -using SabreTools.RedumpLib.Data; +using SabreTools.RedumpLib.Legacy.Data; using SabreTools.RedumpLib.Legacy.Web; -using Constants = SabreTools.RedumpLib.Legacy.Data.Constants; -using Language = SabreTools.RedumpLib.Legacy.Data.Language; -using SubmissionInfo = SabreTools.RedumpLib.Legacy.Data.SubmissionInfo; namespace SabreTools.RedumpLib.Legacy.Tools { @@ -94,7 +91,7 @@ namespace SabreTools.RedumpLib.Legacy.Tools { match = Constants.RegionRegex.Match(discData); if (match.Success) - info.CommonDiscInfo.Region = Data.Extensions.ToRegion(match.Groups[1].Value); + info.CommonDiscInfo.Region = match.Groups[1].Value.ToRegion(); } // Languages @@ -107,7 +104,7 @@ namespace SabreTools.RedumpLib.Legacy.Tools if (submatch is null) continue; - var language = Data.Extensions.ToLanguage(submatch.Groups[1].Value); + var language = submatch.Groups[1].Value.ToLanguage(); if (language is not null) tempLanguages.Add(language); } @@ -449,20 +446,20 @@ namespace SabreTools.RedumpLib.Legacy.Tools } // For some outdated tags, we need to use alternate names - text = text.Replace("Demos:", ((SiteCode?)SiteCode.PlayableDemos).ShortName()); - text = text.Replace("Disney ID:", ((SiteCode?)SiteCode.DisneyInteractiveID).ShortName()); - text = text.Replace("DMI:", ((SiteCode?)SiteCode.DMIHash).ShortName()); - text = text.Replace("LucasArts ID:", ((SiteCode?)SiteCode.LucasArtsID).ShortName()); - text = text.Replace("PFI:", ((SiteCode?)SiteCode.PFIHash).ShortName()); - text = text.Replace("SS:", ((SiteCode?)SiteCode.SSHash).ShortName()); - text = text.Replace("SSv1:", ((SiteCode?)SiteCode.SSHash).ShortName()); - text = text.Replace("SSv1:", ((SiteCode?)SiteCode.SSHash).ShortName()); - text = text.Replace("SSv2:", ((SiteCode?)SiteCode.SSHash).ShortName()); - text = text.Replace("SSv2:", ((SiteCode?)SiteCode.SSHash).ShortName()); - text = text.Replace("SS version:", ((SiteCode?)SiteCode.SSVersion).ShortName()); - text = text.Replace("Universal Hash (SHA-1):", ((SiteCode?)SiteCode.UniversalHash).ShortName()); - text = text.Replace("XeMID:", ((SiteCode?)SiteCode.XeMID).ShortName()); - text = text.Replace("XMID:", ((SiteCode?)SiteCode.XMID).ShortName()); + text = text.Replace("Demos:", SiteCode.PlayableDemos.ShortName()); + text = text.Replace("Disney ID:", SiteCode.DisneyInteractiveID.ShortName()); + text = text.Replace("DMI:", SiteCode.DMIHash.ShortName()); + text = text.Replace("LucasArts ID:", SiteCode.LucasArtsID.ShortName()); + text = text.Replace("PFI:", SiteCode.PFIHash.ShortName()); + text = text.Replace("SS:", SiteCode.SSHash.ShortName()); + text = text.Replace("SSv1:", SiteCode.SSHash.ShortName()); + text = text.Replace("SSv1:", SiteCode.SSHash.ShortName()); + text = text.Replace("SSv2:", SiteCode.SSHash.ShortName()); + text = text.Replace("SSv2:", SiteCode.SSHash.ShortName()); + text = text.Replace("SS version:", SiteCode.SSVersion.ShortName()); + text = text.Replace("Universal Hash (SHA-1):", SiteCode.UniversalHash.ShortName()); + text = text.Replace("XeMID:", SiteCode.XeMID.ShortName()); + text = text.Replace("XMID:", SiteCode.XMID.ShortName()); return text; } diff --git a/SabreTools.RedumpLib.Legacy/Tools/Formatter.cs b/SabreTools.RedumpLib.Legacy/Tools/Formatter.cs index 105ae64..9b22183 100644 --- a/SabreTools.RedumpLib.Legacy/Tools/Formatter.cs +++ b/SabreTools.RedumpLib.Legacy/Tools/Formatter.cs @@ -2,11 +2,8 @@ using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; -using SabreTools.RedumpLib.Data; using SabreTools.RedumpLib.Legacy.Data; using SabreTools.RedumpLib.Legacy.Data.Sections; -using PhysicalSystem = SabreTools.RedumpLib.Legacy.Data.PhysicalSystem; -using SubmissionInfo = SabreTools.RedumpLib.Legacy.Data.SubmissionInfo; namespace SabreTools.RedumpLib.Legacy.Tools { @@ -276,13 +273,13 @@ namespace SabreTools.RedumpLib.Legacy.Tools List? partiallyMatchedIDs) { // Extract the size from the hashes - long size = RedumpLib.Data.Extensions.ExtractSizeFromHashData(tawo?.ClrMameProData); + long size = Extensions.ExtractSizeFromHashData(tawo?.ClrMameProData); output.AppendLine("Common Disc Info:"); AddIfExists(output, Template.TitleField, section?.Title, 1); - AddIfExists(output, Template.ForeignTitleField, section?.ForeignTitleNonLatin, 1); - AddIfExists(output, Template.DiscNumberField, section?.DiscNumberLetter, 1); + AddIfExists(output, Template.ForeignTitleNonLatinField, section?.ForeignTitleNonLatin, 1); + AddIfExists(output, Template.DiscNumberLetterField, section?.DiscNumberLetter, 1); AddIfExists(output, Template.DiscTitleField, section?.DiscTitle, 1); AddIfExists(output, Template.SystemField, section?.System.LongName(), 1); AddIfExists(output, Template.MediaTypeField, GetFixedMediaType( @@ -294,14 +291,14 @@ namespace SabreTools.RedumpLib.Legacy.Tools sac?.Layerbreak3), 1); AddIfExists(output, Template.CategoryField, section?.Category.LongName(), 1); - AddIfExists(output, Template.FullyMatchingIDsField, fullyMatchedID?.ToString(), 1); + AddIfExists(output, Template.FullyMatchingIDField, fullyMatchedID?.ToString(), 1); AddIfExists(output, Template.PartiallyMatchingIDsField, partiallyMatchedIDs, 1); - AddIfExists(output, Template.RegionsField, section?.Region.LongName() ?? "SPACE! (CHANGE THIS)", 1); + AddIfExists(output, Template.RegionField, section?.Region.LongName() ?? "SPACE! (CHANGE THIS)", 1); AddIfExists(output, Template.LanguagesField, Array.ConvertAll(section?.Languages ?? [null], l => l.LongName() ?? "ADD LANGUAGES HERE (ONLY IF YOU TESTED)"), 1); AddIfExists(output, Template.PlaystationLanguageSelectionViaField, Array.ConvertAll(section?.LanguageSelection ?? [], l => l.LongName()), 1); - AddIfExists(output, Template.DiscSerialsField, section?.Serial, 1); + AddIfExists(output, Template.SerialField, section?.Serial, 1); output.AppendLine(); // All ringcode information goes in an indented area @@ -311,74 +308,74 @@ namespace SabreTools.RedumpLib.Legacy.Tools // If we have a triple-layer disc if (sac?.Layerbreak3 != default && sac?.Layerbreak3 != default(long)) { - AddIfExists(output, "Layer 0 " + Template.MasteringCodeField, section?.Layer0MasteringRing, 0); + AddIfExists(output, "Layer 0 " + Template.MasteringRingField, section?.Layer0MasteringRing, 0); AddIfExists(output, "Layer 0 " + Template.MasteringSIDField, section?.Layer0MasteringSID, 0); - AddIfExists(output, "Layer 0 " + Template.ToolstampsField, section?.Layer0ToolstampMasteringCode, 0); - AddIfExists(output, "Data Side " + Template.MouldSIDsField, section?.Layer0MouldSID, 0); - AddIfExists(output, "Data Side " + Template.AdditionalMouldsField, section?.Layer0AdditionalMould, 0); + AddIfExists(output, "Layer 0 " + Template.ToolstampMasteringCodeField, section?.Layer0ToolstampMasteringCode, 0); + AddIfExists(output, "Data Side " + Template.MouldSIDField, section?.Layer0MouldSID, 0); + AddIfExists(output, "Data Side " + Template.AdditionalMouldField, section?.Layer0AdditionalMould, 0); - AddIfExists(output, "Layer 1 " + Template.MasteringCodeField, section?.Layer1MasteringRing, 0); + AddIfExists(output, "Layer 1 " + Template.MasteringRingField, section?.Layer1MasteringRing, 0); AddIfExists(output, "Layer 1 " + Template.MasteringSIDField, section?.Layer1MasteringSID, 0); - AddIfExists(output, "Layer 1 " + Template.ToolstampsField, section?.Layer1ToolstampMasteringCode, 0); - AddIfExists(output, "Label Side " + Template.MouldSIDsField, section?.Layer1MouldSID, 0); - AddIfExists(output, "Label Side " + Template.AdditionalMouldsField, section?.Layer1AdditionalMould, 0); + AddIfExists(output, "Layer 1 " + Template.ToolstampMasteringCodeField, section?.Layer1ToolstampMasteringCode, 0); + AddIfExists(output, "Label Side " + Template.MouldSIDField, section?.Layer1MouldSID, 0); + AddIfExists(output, "Label Side " + Template.AdditionalMouldField, section?.Layer1AdditionalMould, 0); - AddIfExists(output, "Layer 2 " + Template.MasteringCodeField, section?.Layer2MasteringRing, 0); + AddIfExists(output, "Layer 2 " + Template.MasteringRingField, section?.Layer2MasteringRing, 0); AddIfExists(output, "Layer 2 " + Template.MasteringSIDField, section?.Layer2MasteringSID, 0); - AddIfExists(output, "Layer 2 " + Template.ToolstampsField, section?.Layer2ToolstampMasteringCode, 0); + AddIfExists(output, "Layer 2 " + Template.ToolstampMasteringCodeField, section?.Layer2ToolstampMasteringCode, 0); - AddIfExists(output, "Layer 3 " + Template.MasteringCodeField, section?.Layer3MasteringRing, 0); + AddIfExists(output, "Layer 3 " + Template.MasteringRingField, section?.Layer3MasteringRing, 0); AddIfExists(output, "Layer 3 " + Template.MasteringSIDField, section?.Layer3MasteringSID, 0); - AddIfExists(output, "Layer 3 " + Template.ToolstampsField, section?.Layer3ToolstampMasteringCode, 0); + AddIfExists(output, "Layer 3 " + Template.ToolstampMasteringCodeField, section?.Layer3ToolstampMasteringCode, 0); } // If we have a triple-layer disc else if (sac?.Layerbreak2 != default && sac?.Layerbreak2 != default(long)) { - AddIfExists(output, "Layer 0 " + Template.MasteringCodeField, section?.Layer0MasteringRing, 0); + AddIfExists(output, "Layer 0 " + Template.MasteringRingField, section?.Layer0MasteringRing, 0); AddIfExists(output, "Layer 0 " + Template.MasteringSIDField, section?.Layer0MasteringSID, 0); - AddIfExists(output, "Layer 0 " + Template.ToolstampsField, section?.Layer0ToolstampMasteringCode, 0); - AddIfExists(output, "Data Side " + Template.MouldSIDsField, section?.Layer0MouldSID, 0); - AddIfExists(output, "Data Side " + Template.AdditionalMouldsField, section?.Layer0AdditionalMould, 0); + AddIfExists(output, "Layer 0 " + Template.ToolstampMasteringCodeField, section?.Layer0ToolstampMasteringCode, 0); + AddIfExists(output, "Data Side " + Template.MouldSIDField, section?.Layer0MouldSID, 0); + AddIfExists(output, "Data Side " + Template.AdditionalMouldField, section?.Layer0AdditionalMould, 0); - AddIfExists(output, "Layer 1 " + Template.MasteringCodeField, section?.Layer1MasteringRing, 0); + AddIfExists(output, "Layer 1 " + Template.MasteringRingField, section?.Layer1MasteringRing, 0); AddIfExists(output, "Layer 1 " + Template.MasteringSIDField, section?.Layer1MasteringSID, 0); - AddIfExists(output, "Layer 1 " + Template.ToolstampsField, section?.Layer1ToolstampMasteringCode, 0); - AddIfExists(output, "Label Side " + Template.MouldSIDsField, section?.Layer1MouldSID, 0); - AddIfExists(output, "Label Side " + Template.AdditionalMouldsField, section?.Layer1AdditionalMould, 0); + AddIfExists(output, "Layer 1 " + Template.ToolstampMasteringCodeField, section?.Layer1ToolstampMasteringCode, 0); + AddIfExists(output, "Label Side " + Template.MouldSIDField, section?.Layer1MouldSID, 0); + AddIfExists(output, "Label Side " + Template.AdditionalMouldField, section?.Layer1AdditionalMould, 0); - AddIfExists(output, "Layer 2 " + Template.MasteringCodeField, section?.Layer2MasteringRing, 0); + AddIfExists(output, "Layer 2 " + Template.MasteringRingField, section?.Layer2MasteringRing, 0); AddIfExists(output, "Layer 2 " + Template.MasteringSIDField, section?.Layer2MasteringSID, 0); - AddIfExists(output, "Layer 2 " + Template.ToolstampsField, section?.Layer2ToolstampMasteringCode, 0); + AddIfExists(output, "Layer 2 " + Template.ToolstampMasteringCodeField, section?.Layer2ToolstampMasteringCode, 0); } // If we have a dual-layer disc else if (sac?.Layerbreak != default && sac?.Layerbreak != default(long)) { - AddIfExists(output, "Layer 0 " + Template.MasteringCodeField, section?.Layer0MasteringRing, 0); + AddIfExists(output, "Layer 0 " + Template.MasteringRingField, section?.Layer0MasteringRing, 0); AddIfExists(output, "Layer 0 " + Template.MasteringSIDField, section?.Layer0MasteringSID, 0); - AddIfExists(output, "Layer 0 " + Template.ToolstampsField, section?.Layer0ToolstampMasteringCode, 0); - AddIfExists(output, "Data Side " + Template.MouldSIDsField, section?.Layer0MouldSID, 0); - AddIfExists(output, "Data Side " + Template.AdditionalMouldsField, section?.Layer0AdditionalMould, 0); + AddIfExists(output, "Layer 0 " + Template.ToolstampMasteringCodeField, section?.Layer0ToolstampMasteringCode, 0); + AddIfExists(output, "Data Side " + Template.MouldSIDField, section?.Layer0MouldSID, 0); + AddIfExists(output, "Data Side " + Template.AdditionalMouldField, section?.Layer0AdditionalMould, 0); - AddIfExists(output, "Layer 1 " + Template.MasteringCodeField, section?.Layer1MasteringRing, 0); + AddIfExists(output, "Layer 1 " + Template.MasteringRingField, section?.Layer1MasteringRing, 0); AddIfExists(output, "Layer 1 " + Template.MasteringSIDField, section?.Layer1MasteringSID, 0); - AddIfExists(output, "Layer 1 " + Template.ToolstampsField, section?.Layer1ToolstampMasteringCode, 0); - AddIfExists(output, "Label Side " + Template.MouldSIDsField, section?.Layer1MouldSID, 0); - AddIfExists(output, "Label Side " + Template.AdditionalMouldsField, section?.Layer1AdditionalMould, 0); + AddIfExists(output, "Layer 1 " + Template.ToolstampMasteringCodeField, section?.Layer1ToolstampMasteringCode, 0); + AddIfExists(output, "Label Side " + Template.MouldSIDField, section?.Layer1MouldSID, 0); + AddIfExists(output, "Label Side " + Template.AdditionalMouldField, section?.Layer1AdditionalMould, 0); } // If we have a single-layer disc else { - AddIfExists(output, "Data Side " + Template.MasteringCodeField, section?.Layer0MasteringRing, 0); + AddIfExists(output, "Data Side " + Template.MasteringRingField, section?.Layer0MasteringRing, 0); AddIfExists(output, "Data Side " + Template.MasteringSIDField, section?.Layer0MasteringSID, 0); - AddIfExists(output, "Data Side " + Template.ToolstampsField, section?.Layer0ToolstampMasteringCode, 0); - AddIfExists(output, "Data Side " + Template.MouldSIDsField, section?.Layer0MouldSID, 0); - AddIfExists(output, "Data Side " + Template.AdditionalMouldsField, section?.Layer0AdditionalMould, 0); + AddIfExists(output, "Data Side " + Template.ToolstampMasteringCodeField, section?.Layer0ToolstampMasteringCode, 0); + AddIfExists(output, "Data Side " + Template.MouldSIDField, section?.Layer0MouldSID, 0); + AddIfExists(output, "Data Side " + Template.AdditionalMouldField, section?.Layer0AdditionalMould, 0); - AddIfExists(output, "Label Side " + Template.MasteringCodeField, section?.Layer1MasteringRing, 0); + AddIfExists(output, "Label Side " + Template.MasteringRingField, section?.Layer1MasteringRing, 0); AddIfExists(output, "Label Side " + Template.MasteringSIDField, section?.Layer1MasteringSID, 0); - AddIfExists(output, "Label Side " + Template.ToolstampsField, section?.Layer1ToolstampMasteringCode, 0); - AddIfExists(output, "Label Side " + Template.MouldSIDsField, section?.Layer1MouldSID, 0); - AddIfExists(output, "Label Side " + Template.AdditionalMouldsField, section?.Layer1AdditionalMould, 0); + AddIfExists(output, "Label Side " + Template.ToolstampMasteringCodeField, section?.Layer1ToolstampMasteringCode, 0); + AddIfExists(output, "Label Side " + Template.MouldSIDField, section?.Layer1MouldSID, 0); + AddIfExists(output, "Label Side " + Template.AdditionalMouldField, section?.Layer1AdditionalMould, 0); } var offset = tawo?.OtherWriteOffsets; @@ -388,9 +385,9 @@ namespace SabreTools.RedumpLib.Legacy.Tools AddIfExists(output, Template.WriteOffsetField, offset, 0); output.AppendLine(); - AddIfExists(output, Template.BarcodesField, section?.Barcode, 1); - AddIfExists(output, Template.EXEDate, section?.EXEDateBuildDate, 1); - AddIfExists(output, Template.ErrorCountField, section?.ErrorsCount, 1); + AddIfExists(output, Template.BarcodeField, section?.Barcode, 1); + AddIfExists(output, Template.EXEDateBuildDate, section?.EXEDateBuildDate, 1); + AddIfExists(output, Template.ErrorsCountField, section?.ErrorsCount, 1); AddIfExists(output, Template.CommentsField, section?.Comments?.Trim(), 1); AddIfExists(output, Template.ContentsField, section?.Contents?.Trim(), 1); } @@ -446,11 +443,11 @@ namespace SabreTools.RedumpLib.Legacy.Tools AddIfExists(output, Template.PICField, section.PIC, 1); AddIfExists(output, Template.HeaderField, section.Header, 1); AddIfExists(output, Template.BCAField, section.BCA, 1); - AddIfExists(output, Template.SectorRangesField, section.SecuritySectorRanges, 1); + AddIfExists(output, Template.SecuritySectorRangesField, section.SecuritySectorRanges, 1); } /// - /// Format a ExtrasSection + /// Format a CopyProtectionSection /// internal static void FormatOutputData(StringBuilder output, CopyProtectionSection? section, @@ -476,11 +473,11 @@ namespace SabreTools.RedumpLib.Legacy.Tools { AddIfExists(output, Template.PlayStationAntiModchipField, section.AntiModchip.LongName(), 1); AddIfExists(output, Template.PlayStationLibCryptField, section.LibCrypt.LongName(), 1); - AddIfExists(output, Template.SBIField, section.LibCryptData, 1); + AddIfExists(output, Template.LibCryptDataField, section.LibCryptData, 1); } AddIfExists(output, Template.ProtectionField, section.Protection, 1); - AddIfExists(output, Template.SBIField, section.SecuROMData, 1); + AddIfExists(output, Template.SecuROMDataField, section.SecuROMData, 1); } /// @@ -490,7 +487,7 @@ namespace SabreTools.RedumpLib.Legacy.Tools { output.AppendLine("Tracks and Write Offsets:"); - AddIfExists(output, Template.DatField, section.ClrMameProData + "\n", 1); + AddIfExists(output, Template.ClrMameProDataField, section.ClrMameProData + "\n", 1); AddIfExists(output, Template.CuesheetField, section.Cuesheet, 1); // TODO: Figure out how to emit raw cuesheet field instead of normal cuesheet var offset = section.OtherWriteOffsets; diff --git a/SabreTools.RedumpLib.Legacy/Tools/Validator.cs b/SabreTools.RedumpLib.Legacy/Tools/Validator.cs index 4286a1d..d45ce49 100644 --- a/SabreTools.RedumpLib.Legacy/Tools/Validator.cs +++ b/SabreTools.RedumpLib.Legacy/Tools/Validator.cs @@ -1,9 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -using SabreTools.RedumpLib.Data; +using SabreTools.RedumpLib.Legacy.Data; using SabreTools.RedumpLib.Legacy.Web; -using Constants = SabreTools.RedumpLib.Legacy.Data.Constants; -using SubmissionInfo = SabreTools.RedumpLib.Legacy.Data.SubmissionInfo; namespace SabreTools.RedumpLib.Legacy.Tools { diff --git a/SabreTools.RedumpLib.Legacy/Web/Client.cs b/SabreTools.RedumpLib.Legacy/Web/Client.cs index b06f46e..2da5542 100644 --- a/SabreTools.RedumpLib.Legacy/Web/Client.cs +++ b/SabreTools.RedumpLib.Legacy/Web/Client.cs @@ -9,15 +9,7 @@ using System.Net.Http.Headers; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; -using SabreTools.RedumpLib.Data; using SabreTools.RedumpLib.Legacy.Data; -using SabreTools.RedumpLib.Web; -using Constants = SabreTools.RedumpLib.Legacy.Data.Constants; -using DiscSubpath = SabreTools.RedumpLib.Legacy.Data.DiscSubpath; -using Language = SabreTools.RedumpLib.Legacy.Data.Language; -using PackType = SabreTools.RedumpLib.Legacy.Data.PackType; -using PhysicalSystem = SabreTools.RedumpLib.Legacy.Data.PhysicalSystem; -using Region = SabreTools.RedumpLib.Legacy.Data.Region; namespace SabreTools.RedumpLib.Legacy.Web { @@ -419,7 +411,7 @@ namespace SabreTools.RedumpLib.Legacy.Web public async Task?> CheckSingleDiscsPage(bool? antimodchip = null, bool barcode = false, DiscCategory? category = null, - MediaType? discType = null, + DiscType? discType = null, string? dumper = null, YesNo? edc = null, string? edition = null, @@ -559,7 +551,7 @@ namespace SabreTools.RedumpLib.Legacy.Web bool? antimodchip = null, bool barcode = false, DiscCategory? category = null, - MediaType? discType = null, + DiscType? discType = null, string? dumper = null, YesNo? edc = null, string? edition = null, diff --git a/SabreTools.RedumpLib.Legacy/Web/CookieWebClient.cs b/SabreTools.RedumpLib.Legacy/Web/CookieWebClient.cs new file mode 100644 index 0000000..803a29c --- /dev/null +++ b/SabreTools.RedumpLib.Legacy/Web/CookieWebClient.cs @@ -0,0 +1,70 @@ +using System; +using System.Net; + +namespace SabreTools.RedumpLib.Legacy.Web +{ +#if NET6_0_OR_GREATER +#pragma warning disable SYSLIB0014 +#endif + internal class CookieWebClient : WebClient + { + /// + /// Last retrieved URL from a web request + /// + public Uri? LastUrl { get; private set; } + + /// + /// The timespan to wait before the request times out. + /// + public TimeSpan Timeout { get; set; } + + // https://stackoverflow.com/questions/1777221/using-cookiecontainer-with-webclient-class + private readonly CookieContainer _container = new(); + + /// + /// Get the last downloaded filename, if possible + /// + public string? GetLastFilename() + { + // If the response headers are null or empty + if (ResponseHeaders is null || ResponseHeaders.Count == 0) + return null; + + // If we don't have the response header we care about + string? headerValue = ResponseHeaders.Get("Content-Disposition"); + if (string.IsNullOrEmpty(headerValue)) + return null; + + // Extract the filename from the value +#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER + return headerValue[(headerValue.IndexOf("filename=") + 9)..].Replace("\"", ""); +#else + return headerValue.Substring(headerValue.IndexOf("filename=") + 9).Replace("\"", ""); +#endif + } + + /// + protected override WebRequest GetWebRequest(Uri address) + { + WebRequest request = base.GetWebRequest(address); + if (request is HttpWebRequest webRequest) + { + webRequest.Timeout = (int)Timeout.TotalMilliseconds; + webRequest.CookieContainer = _container; + } + + return request; + } + + /// + protected override WebResponse GetWebResponse(WebRequest request) + { + WebResponse response = base.GetWebResponse(request); + LastUrl = response.ResponseUri; + return response; + } + } +#if NET6_0_OR_GREATER +#pragma warning restore SYSLIB0014 +#endif +} diff --git a/SabreTools.RedumpLib.Legacy/Web/DelayHelper.cs b/SabreTools.RedumpLib.Legacy/Web/DelayHelper.cs new file mode 100644 index 0000000..0e2ec57 --- /dev/null +++ b/SabreTools.RedumpLib.Legacy/Web/DelayHelper.cs @@ -0,0 +1,21 @@ +using System; +using System.Threading; + +namespace SabreTools.RedumpLib.Legacy.Web +{ + /// + /// Helper class for delaying + /// + internal static class DelayHelper + { + /// + /// Delay a random amount of time up to 5 seconds + /// + public static void DelayRandom() + { + var r = new Random(); + int delay = r.Next(0, 50); + Thread.Sleep(delay * 100); + } + } +} diff --git a/SabreTools.RedumpLib.Legacy/Web/Discs.cs b/SabreTools.RedumpLib.Legacy/Web/Discs.cs index 95a791e..6e4cbf0 100644 --- a/SabreTools.RedumpLib.Legacy/Web/Discs.cs +++ b/SabreTools.RedumpLib.Legacy/Web/Discs.cs @@ -1,12 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using SabreTools.RedumpLib.Data; -using SabreTools.RedumpLib.Web; -using DiscSubpath = SabreTools.RedumpLib.Legacy.Data.DiscSubpath; -using Language = SabreTools.RedumpLib.Legacy.Data.Language; -using PhysicalSystem = SabreTools.RedumpLib.Legacy.Data.PhysicalSystem; -using Region = SabreTools.RedumpLib.Legacy.Data.Region; +using SabreTools.RedumpLib.Legacy.Data; namespace SabreTools.RedumpLib.Legacy.Web { @@ -52,7 +47,7 @@ namespace SabreTools.RedumpLib.Legacy.Web bool? antimodchip = null, bool barcode = false, DiscCategory? category = null, - MediaType? discType = null, + DiscType? discType = null, string? dumper = null, YesNo? edc = null, string? edition = null, @@ -221,7 +216,7 @@ namespace SabreTools.RedumpLib.Legacy.Web bool? antimodchip = null, bool barcode = false, DiscCategory? category = null, - MediaType? discType = null, + DiscType? discType = null, string? dumper = null, YesNo? edc = null, string? edition = null, diff --git a/SabreTools.RedumpLib.Legacy/Web/Packs.cs b/SabreTools.RedumpLib.Legacy/Web/Packs.cs index 2fa54ea..931daeb 100644 --- a/SabreTools.RedumpLib.Legacy/Web/Packs.cs +++ b/SabreTools.RedumpLib.Legacy/Web/Packs.cs @@ -1,7 +1,6 @@ using System; using System.Threading.Tasks; -using PackType = SabreTools.RedumpLib.Legacy.Data.PackType; -using PhysicalSystem = SabreTools.RedumpLib.Legacy.Data.PhysicalSystem; +using SabreTools.RedumpLib.Legacy.Data; namespace SabreTools.RedumpLib.Legacy.Web { diff --git a/SabreTools.RedumpLib.Legacy/Web/UrlBuilder.cs b/SabreTools.RedumpLib.Legacy/Web/UrlBuilder.cs index befb191..fdc8c55 100644 --- a/SabreTools.RedumpLib.Legacy/Web/UrlBuilder.cs +++ b/SabreTools.RedumpLib.Legacy/Web/UrlBuilder.cs @@ -1,12 +1,6 @@ using System; using System.Text; -using SabreTools.RedumpLib.Data; using SabreTools.RedumpLib.Legacy.Data; -using DiscSubpath = SabreTools.RedumpLib.Legacy.Data.DiscSubpath; -using Language = SabreTools.RedumpLib.Legacy.Data.Language; -using PackType = SabreTools.RedumpLib.Legacy.Data.PackType; -using PhysicalSystem = SabreTools.RedumpLib.Legacy.Data.PhysicalSystem; -using Region = SabreTools.RedumpLib.Legacy.Data.Region; // TODO: Errors should validate number or number range (# or #-#) @@ -176,7 +170,7 @@ namespace SabreTools.RedumpLib.Legacy.Web public static string BuildDiscsUrl(bool? antimodchip = null, bool barcode = false, DiscCategory? category = null, - MediaType? discType = null, + DiscType? discType = null, string? dumper = null, YesNo? edc = null, string? edition = null, @@ -304,7 +298,6 @@ namespace SabreTools.RedumpLib.Legacy.Web case SortCategory.System: case SortCategory.Version: case SortCategory.Edition: - case SortCategory.Language: case SortCategory.Languages: case SortCategory.Serial: case SortCategory.Status: @@ -327,7 +320,7 @@ namespace SabreTools.RedumpLib.Legacy.Web } // Status - if (status is not null && status >= DumpStatus.UnknownGrey && status <= DumpStatus.VerifiedGreen) + if (status is not null && status >= DumpStatus.UnknownGrey && status <= DumpStatus.TwoOrMoreGreen) sb.Append($"status/{(int)status}/"); // System / Disc Type Search diff --git a/SabreTools.RedumpLib.Legacy/Web/WIP.cs b/SabreTools.RedumpLib.Legacy/Web/WIP.cs index cf129b5..bda2b81 100644 --- a/SabreTools.RedumpLib.Legacy/Web/WIP.cs +++ b/SabreTools.RedumpLib.Legacy/Web/WIP.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Threading.Tasks; -using SabreTools.RedumpLib.Web; namespace SabreTools.RedumpLib.Legacy.Web { diff --git a/SabreTools.RedumpLib.Test/RedumpOrg/UrlBuilderTests.cs b/SabreTools.RedumpLib.Test/RedumpOrg/UrlBuilderTests.cs index 6e0133c..4ccb38b 100644 --- a/SabreTools.RedumpLib.Test/RedumpOrg/UrlBuilderTests.cs +++ b/SabreTools.RedumpLib.Test/RedumpOrg/UrlBuilderTests.cs @@ -1,10 +1,7 @@ using System; -using SabreTools.RedumpLib.Data; +using SabreTools.RedumpLib.Legacy.Data; using SabreTools.RedumpLib.Legacy.Web; using Xunit; -using DiscSubpath = SabreTools.RedumpLib.Legacy.Data.DiscSubpath; -using PackType = SabreTools.RedumpLib.Legacy.Data.PackType; -using PhysicalSystem = SabreTools.RedumpLib.Legacy.Data.PhysicalSystem; namespace SabreTools.RedumpLib.Test.RedumpOrg { diff --git a/SabreTools.RedumpLib/Data/Enumerations.cs b/SabreTools.RedumpLib/Data/Enumerations.cs index 9ee9097..4afc1dc 100644 --- a/SabreTools.RedumpLib/Data/Enumerations.cs +++ b/SabreTools.RedumpLib/Data/Enumerations.cs @@ -71,15 +71,12 @@ namespace SabreTools.RedumpLib.Data [HumanReadable(LongName = "Disabled", ShortName = "red")] DisabledRed = 2, - // Known as "Possible Bad Dump" on redump.org [HumanReadable(LongName = "Questionable", ShortName = "yellow")] QuestionableYellow = 3, - // Known as "Original Media" on redump.org [HumanReadable(LongName = "Unverified", ShortName = "blue")] UnverifiedBlue = 4, - // Known as "Two or More" on redump.org [HumanReadable(LongName = "Verified", ShortName = "green")] VerifiedGreen = 5, } @@ -1931,7 +1928,6 @@ namespace SabreTools.RedumpLib.Data /// List of all known systems not bound to specific site limitations /// /// TODO: Remove marker items - /// TODO: Does "Banned" now only mean that things like keys can't be downloaded? public enum PhysicalSystem { #region BIOS Sets @@ -3820,14 +3816,9 @@ namespace SabreTools.RedumpLib.Data [HumanReadable(LongName = "Edition", ShortName = "edition")] Edition, - /// redump.info only [HumanReadable(LongName = "Language", ShortName = "language")] Language, - /// redump.org only - [HumanReadable(LongName = "Languages", ShortName = "languages")] - Languages, - [HumanReadable(LongName = "Serial", ShortName = "serial")] Serial, diff --git a/SabreTools.RedumpLib/Data/Template.cs b/SabreTools.RedumpLib/Data/Template.cs index cef14a1..3e53b19 100644 --- a/SabreTools.RedumpLib/Data/Template.cs +++ b/SabreTools.RedumpLib/Data/Template.cs @@ -36,7 +36,7 @@ public const string DiscSerialsField = "Disc Serials"; public const string EditionsField = "Editions"; - public const string BarcodesField = "Barcode"; + public const string BarcodesField = "Barcodes"; public const string VersionField = "Version"; public const string ErrorCountField = "Error Count"; public const string EXEDate = "EXE Date"; @@ -108,13 +108,5 @@ public const string DiscNotDetected = "Disc Not Detected"; #endregion - - #region Redump.org only - - public const string PlayStationAntiModchipField = "Anti-modchip"; - public const string PlaystationLanguageSelectionViaField = "Language Selection Via"; - public const string PlayStationLibCryptField = "LibCrypt"; - - #endregion } } diff --git a/SabreTools.RedumpLib/SabreTools.RedumpLib.csproj b/SabreTools.RedumpLib/SabreTools.RedumpLib.csproj index d8ac6ff..3f12c71 100644 --- a/SabreTools.RedumpLib/SabreTools.RedumpLib.csproj +++ b/SabreTools.RedumpLib/SabreTools.RedumpLib.csproj @@ -23,7 +23,6 @@ -