mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-09-21 22:44:51 +00:00
Replace SiteCode enum with SiteCode type
This commit is contained in:
@@ -2324,7 +2324,6 @@ namespace SabreTools.RedumpLib.Test.Data
|
||||
SiteCode.InternalSerialName,
|
||||
SiteCode.ISBN,
|
||||
SiteCode.ISSN,
|
||||
SiteCode.LogsLink,
|
||||
SiteCode.Multisession,
|
||||
SiteCode.PCMacHybrid,
|
||||
SiteCode.PFIHash,
|
||||
@@ -2437,7 +2436,7 @@ namespace SabreTools.RedumpLib.Test.Data
|
||||
[MemberData(nameof(GenerateBooleanSiteCodesTestData))]
|
||||
public void SiteCode_IsBoolean(SiteCode? siteCode, bool expected)
|
||||
{
|
||||
bool actual = siteCode.IsBoolean();
|
||||
bool actual = siteCode?.IsBoolean ?? false;
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -2450,7 +2449,7 @@ namespace SabreTools.RedumpLib.Test.Data
|
||||
[MemberData(nameof(GenerateCommentSiteCodesTestData))]
|
||||
public void SiteCode_IsCommentCode(SiteCode? siteCode, bool expected)
|
||||
{
|
||||
bool actual = siteCode.IsCommentCode();
|
||||
bool actual = siteCode?.IsCommentCode ?? false;
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -2463,7 +2462,7 @@ namespace SabreTools.RedumpLib.Test.Data
|
||||
[MemberData(nameof(GenerateContentSiteCodesTestData))]
|
||||
public void SiteCode_IsContentCode(SiteCode? siteCode, bool expected)
|
||||
{
|
||||
bool actual = siteCode.IsContentCode();
|
||||
bool actual = siteCode?.IsContentCode ?? false;
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -2476,7 +2475,7 @@ namespace SabreTools.RedumpLib.Test.Data
|
||||
[MemberData(nameof(GenerateMultilineSiteCodesTestData))]
|
||||
public void SiteCode_IsMultiLine(SiteCode? siteCode, bool expected)
|
||||
{
|
||||
bool actual = siteCode.IsMultiLine();
|
||||
bool actual = siteCode?.IsMultiLine ?? false;
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -2489,7 +2488,7 @@ namespace SabreTools.RedumpLib.Test.Data
|
||||
[MemberData(nameof(GenerateSiteCodeTestData))]
|
||||
public void SiteCode_LongName(SiteCode? siteCode, bool expectNull)
|
||||
{
|
||||
var actual = siteCode.LongName();
|
||||
var actual = siteCode?.HTML;
|
||||
|
||||
if (expectNull)
|
||||
Assert.Null(actual);
|
||||
@@ -2506,7 +2505,7 @@ namespace SabreTools.RedumpLib.Test.Data
|
||||
[MemberData(nameof(GenerateSiteCodeTestData))]
|
||||
public void SiteCode_ShortName(SiteCode? siteCode, bool expectNull)
|
||||
{
|
||||
var actual = siteCode.ShortName();
|
||||
var actual = siteCode?.Code;
|
||||
|
||||
if (expectNull)
|
||||
Assert.Null(actual);
|
||||
@@ -2521,7 +2520,7 @@ namespace SabreTools.RedumpLib.Test.Data
|
||||
public static TheoryData<SiteCode?, bool> GenerateSiteCodeTestData()
|
||||
{
|
||||
var testData = new TheoryData<SiteCode?, bool>() { { null, true } };
|
||||
foreach (SiteCode? siteCode in Enum.GetValues<SiteCode>().Cast<SiteCode?>())
|
||||
foreach (SiteCode? siteCode in SiteCode.AllSiteCodes)
|
||||
{
|
||||
testData.Add(siteCode, false);
|
||||
}
|
||||
@@ -2536,7 +2535,7 @@ namespace SabreTools.RedumpLib.Test.Data
|
||||
public static TheoryData<SiteCode?, bool> GenerateBooleanSiteCodesTestData()
|
||||
{
|
||||
var testData = new TheoryData<SiteCode?, bool>() { { null, false } };
|
||||
foreach (SiteCode siteCode in Enum.GetValues<SiteCode>())
|
||||
foreach (SiteCode siteCode in SiteCode.AllSiteCodes)
|
||||
{
|
||||
if (_booleanSiteCodes.Contains(siteCode))
|
||||
testData.Add(siteCode, true);
|
||||
@@ -2554,7 +2553,7 @@ namespace SabreTools.RedumpLib.Test.Data
|
||||
public static TheoryData<SiteCode?, bool> GenerateCommentSiteCodesTestData()
|
||||
{
|
||||
var testData = new TheoryData<SiteCode?, bool>() { { null, false } };
|
||||
foreach (SiteCode siteCode in Enum.GetValues<SiteCode>())
|
||||
foreach (SiteCode siteCode in SiteCode.AllSiteCodes)
|
||||
{
|
||||
if (_commentSiteCodes.Contains(siteCode))
|
||||
testData.Add(siteCode, true);
|
||||
@@ -2572,7 +2571,7 @@ namespace SabreTools.RedumpLib.Test.Data
|
||||
public static TheoryData<SiteCode?, bool> GenerateContentSiteCodesTestData()
|
||||
{
|
||||
var testData = new TheoryData<SiteCode?, bool>() { { null, false } };
|
||||
foreach (SiteCode siteCode in Enum.GetValues<SiteCode>())
|
||||
foreach (SiteCode siteCode in SiteCode.AllSiteCodes)
|
||||
{
|
||||
if (_contentSiteCodes.Contains(siteCode))
|
||||
testData.Add(siteCode, true);
|
||||
@@ -2590,7 +2589,7 @@ namespace SabreTools.RedumpLib.Test.Data
|
||||
public static TheoryData<SiteCode?, bool> GenerateMultilineSiteCodesTestData()
|
||||
{
|
||||
var testData = new TheoryData<SiteCode?, bool>() { { null, false } };
|
||||
foreach (SiteCode siteCode in Enum.GetValues<SiteCode>())
|
||||
foreach (SiteCode siteCode in SiteCode.AllSiteCodes)
|
||||
{
|
||||
if (_multilineSiteCodes.Contains(siteCode))
|
||||
testData.Add(siteCode, true);
|
||||
|
||||
@@ -1068,7 +1068,7 @@ namespace SabreTools.RedumpLib.Test.Tools
|
||||
public void OrderCommentTags_All_Ordered()
|
||||
{
|
||||
Dictionary<SiteCode, string> tags = [];
|
||||
foreach (SiteCode code in Enum.GetValues<SiteCode>())
|
||||
foreach (SiteCode code in SiteCode.AllSiteCodes)
|
||||
{
|
||||
tags[code] = "XXXXXX";
|
||||
}
|
||||
@@ -1107,7 +1107,7 @@ namespace SabreTools.RedumpLib.Test.Tools
|
||||
public void OrderContentTags_All_Ordered()
|
||||
{
|
||||
Dictionary<SiteCode, string> tags = [];
|
||||
foreach (SiteCode code in Enum.GetValues<SiteCode>())
|
||||
foreach (SiteCode code in SiteCode.AllSiteCodes)
|
||||
{
|
||||
tags[code] = "XXXXXX";
|
||||
}
|
||||
|
||||
@@ -292,304 +292,6 @@ namespace SabreTools.RedumpLib.Data
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of all Redump site codes
|
||||
/// </summary>
|
||||
/// TODO: Add numeric values or convert to constants
|
||||
public enum SiteCode
|
||||
{
|
||||
[HumanReadable(ShortName = "[T:ACC]", LongName = "<b>Acclaim ID</b>:")]
|
||||
AcclaimID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Accolade ID</b>:", LongName = "<b>Accolade ID</b>:")]
|
||||
AccoladeID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:ACT]", LongName = "<b>Activision ID</b>:")]
|
||||
ActivisionID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Additional BCA Data</b>:", LongName = "<b>Additional BCA Data</b>:")]
|
||||
AdditionalBCAData,
|
||||
|
||||
[HumanReadable(ShortName = "[T:ALT]", LongName = "<b>Alternative Title</b>:")]
|
||||
AlternativeTitle,
|
||||
|
||||
[HumanReadable(ShortName = "[T:ALTF]", LongName = "<b>Alternative Foreign Title</b>:")]
|
||||
AlternativeForeignTitle,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Applications</b>:", LongName = "<b>Applications</b>:")]
|
||||
Applications,
|
||||
|
||||
[HumanReadable(ShortName = "[T:BID]", LongName = "<b>Bandai ID</b>:")]
|
||||
BandaiID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:BBFC]", LongName = "<b>BBFC Reg. No.</b>:")]
|
||||
BBFCRegistrationNumber,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Bethesda ID</b>:", LongName = "<b>Bethesda ID</b>:")]
|
||||
BethesdaID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>CD Projekt ID</b>:", LongName = "<b>CD Projekt ID</b>:")]
|
||||
CDProjektID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Compatible OS</b>:", LongName = "<b>Compatible OS</b>:")]
|
||||
CompatibleOS,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Cover ID</b>:", LongName = "<b>Cover ID</b>:")]
|
||||
CoverID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Dice Multimedia</b>:", LongName = "<b>Dice Multimedia</b>:")]
|
||||
DiceMultimedia,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Disc Hologram ID</b>:", LongName = "<b>Disc Hologram ID</b>:")]
|
||||
DiscHologramID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Disc ID</b>:", LongName = "<b>Disc ID</b>:")]
|
||||
DiscID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Disc Title (non-Latin)</b>:", LongName = "<b>Disc Title (non-Latin)</b>:")]
|
||||
DiscTitleNonLatin,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Disney Interactive ID</b>", LongName = "<b>Disney Interactive ID</b>:")]
|
||||
DisneyInteractiveID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>DMI</b>:", LongName = "<b>DMI</b>:")]
|
||||
DMIHash,
|
||||
|
||||
[HumanReadable(ShortName = "[T:DNAS]", LongName = "<b>DNAS Disc ID</b>:")]
|
||||
DNASDiscID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Edition (non-Latin)</b>:", LongName = "<b>Edition (non-Latin)</b>:")]
|
||||
EditionNonLatin,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Eidos ID</b>:", LongName = "<b>Eidos ID</b>:")]
|
||||
EidosID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:EAID]", LongName = "<b>Electronic Arts ID</b>:")]
|
||||
ElectronicArtsID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:X]", LongName = "<b>Extras</b>:")]
|
||||
Extras,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Filename</b>:", LongName = "<b>Filename</b>:")]
|
||||
Filename,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Focus Multimedia</b>:", LongName = "<b>Focus Multimedia</b>:")]
|
||||
FocusMultimedia,
|
||||
|
||||
[HumanReadable(ShortName = "[T:FIID]", LongName = "<b>Fox Interactive ID</b>:")]
|
||||
FoxInteractiveID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:GF]", LongName = "<b>Game Footage</b>:")]
|
||||
GameFootage,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Games</b>:", LongName = "<b>Games</b>:")]
|
||||
Games,
|
||||
|
||||
[HumanReadable(ShortName = "[T:G]", LongName = "<b>Genre</b>:")]
|
||||
Genre,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>GSP Software</b>:", LongName = "<b>GSP Software</b>:")]
|
||||
GSPSoftware,
|
||||
|
||||
[HumanReadable(ShortName = "[T:GTID]", LongName = "<b>GT Interactive ID</b>:")]
|
||||
GTInteractiveID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>High Sierra Volume Descriptor</b>:", LongName = "<b>High Sierra Volume Descriptor</b>:")]
|
||||
HighSierraVolumeDescriptor,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Internal Name</b>:", LongName = "<b>Internal Name</b>:")]
|
||||
InternalName,
|
||||
|
||||
[HumanReadable(ShortName = "[T:ISN]", LongName = "<b>Internal Serial</b>:")]
|
||||
InternalSerialName,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Interplay ID</b>:", LongName = "<b>Interplay ID</b>:")]
|
||||
InterplayID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:ISBN]", LongName = "<b>ISBN</b>:")]
|
||||
ISBN,
|
||||
|
||||
[HumanReadable(ShortName = "[T:ISSN]", LongName = "<b>ISSN</b>:")]
|
||||
ISSN,
|
||||
|
||||
[HumanReadable(ShortName = "[T:JID]", LongName = "<b>JASRAC ID</b>:")]
|
||||
JASRACID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:KIRZ]", LongName = "<b>King Records ID</b>:")]
|
||||
KingRecordsID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:KOEI]", LongName = "<b>Koei ID</b>:")]
|
||||
KoeiID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:KID]", LongName = "<b>Konami ID</b>:")]
|
||||
KonamiID,
|
||||
|
||||
// This doesn't have a site tag yet, promoted to field in redump.info
|
||||
[HumanReadable(ShortName = "<b>Logs Link</b>:", LongName = "<b>Logs Link</b>:")]
|
||||
LogsLink,
|
||||
|
||||
[HumanReadable(ShortName = "[T:LAID]", LongName = "<b>Lucas Arts ID</b>:")]
|
||||
LucasArtsID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Microsoft ID</b>:", LongName = "<b>Microsoft ID</b>:")]
|
||||
MicrosoftID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Multisession</b>:", LongName = "<b>Multisession</b>:")]
|
||||
Multisession,
|
||||
|
||||
[HumanReadable(ShortName = "[T:NGID]", LongName = "<b>Nagano ID</b>:")]
|
||||
NaganoID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:NID]", LongName = "<b>Namco ID</b>:")]
|
||||
NamcoID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:NYG]", LongName = "<b>Net Yaroze Games</b>:")]
|
||||
NetYarozeGames,
|
||||
|
||||
[HumanReadable(ShortName = "[T:NPS]", LongName = "<b>Nippon Ichi Software ID</b>:")]
|
||||
NipponIchiSoftwareID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:OID]", LongName = "<b>Origin ID</b>:")]
|
||||
OriginID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:P]", LongName = "<b>Patches</b>:")]
|
||||
Patches,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
/// <remarks>No text value after</remarks>
|
||||
[HumanReadable(ShortName = "PC/Mac Hybrid", LongName = "PC/Mac Hybrid")]
|
||||
PCMacHybrid,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>PFI</b>:", LongName = "<b>PFI</b>:")]
|
||||
PFIHash,
|
||||
|
||||
[HumanReadable(ShortName = "[T:PD]", LongName = "<b>Playable Demos</b>:")]
|
||||
PlayableDemos,
|
||||
|
||||
[HumanReadable(ShortName = "[T:PCID]", LongName = "<b>Pony Canyon ID</b>:")]
|
||||
PonyCanyonID,
|
||||
|
||||
/// <remarks>No text value after</remarks>
|
||||
[HumanReadable(ShortName = "[T:PT2]", LongName = "<b>Postgap type</b>: Form 2")]
|
||||
PostgapType,
|
||||
|
||||
[HumanReadable(ShortName = "[T:PPN]", LongName = "<b>PPN</b>:")]
|
||||
PPN,
|
||||
|
||||
// This doesn't have a site tag for some systems yet
|
||||
[HumanReadable(ShortName = "<b>Protection</b>:", LongName = "<b>Protection</b>:")]
|
||||
Protection,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Ring Perfect Audio Offset</b>:", LongName = "<b>Ring Perfect Audio Offset</b>:")]
|
||||
RingPerfectAudioOffset,
|
||||
|
||||
[HumanReadable(ShortName = "[T:RD]", LongName = "<b>Rolling Demos</b>:")]
|
||||
RollingDemos,
|
||||
|
||||
[HumanReadable(ShortName = "[T:SG]", LongName = "<b>Savegames</b>:")]
|
||||
Savegames,
|
||||
|
||||
[HumanReadable(ShortName = "[T:SID]", LongName = "<b>Sega ID</b>:")]
|
||||
SegaID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:SNID]", LongName = "<b>Selen ID</b>:")]
|
||||
SelenID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:S]", LongName = "<b>Series</b>:")]
|
||||
Series,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Sierra ID</b>:", LongName = "<b>Sierra ID</b>:")]
|
||||
SierraID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>SS</b>:", LongName = "<b>SS</b>:")]
|
||||
SSHash,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>SS version</b>:", LongName = "<b>SS version</b>:")]
|
||||
SSVersion,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Steam App ID</b>:", LongName = "<b>Steam AppID</b>:")]
|
||||
SteamAppID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Steam Depot ID (.sis/.csm/.csd)</b>:", LongName = "<b>Steam Depot ID (.sis/.csm/.csd)</b>:")]
|
||||
SteamCsmCsdDepotID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Steam Depot ID (.sis/.sim/.sid)</b>:", LongName = "<b>Steam Depot ID (.sis/.sim/.sid)</b>:")]
|
||||
SteamSimSidDepotID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:TID]", LongName = "<b>Taito ID</b>:")]
|
||||
TaitoID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:TD]", LongName = "<b>Tech Demos</b>:")]
|
||||
TechDemos,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Title ID</b>:", LongName = "<b>Title ID</b>:")]
|
||||
TitleID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>2K Games ID</b>:", LongName = "<b>2K Games ID</b>:")]
|
||||
TwoKGamesID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:UID]", LongName = "<b>Ubisoft ID</b>:")]
|
||||
UbisoftID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:VID]", LongName = "<b>Valve ID</b>:")]
|
||||
ValveID,
|
||||
|
||||
[HumanReadable(ShortName = "[T:VFC]", LongName = "<b>VFC code</b>:")]
|
||||
VFCCode,
|
||||
|
||||
[HumanReadable(ShortName = "[T:V]", LongName = "<b>Videos</b>:")]
|
||||
Videos,
|
||||
|
||||
[HumanReadable(ShortName = "[T:VOL]", LongName = "<b>Volume Label</b>:")]
|
||||
VolumeLabel,
|
||||
|
||||
/// <remarks>No text value after</remarks>
|
||||
[HumanReadable(ShortName = "[T:VCD]", LongName = "<b>V-CD</b>")]
|
||||
VCD,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>XeMID</b>:", LongName = "<b>XeMID</b>:")]
|
||||
XeMID,
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>XMID</b>:", LongName = "<b>XMID</b>:")]
|
||||
XMID,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of all recognized sort parameters
|
||||
/// </summary>
|
||||
|
||||
@@ -883,14 +883,14 @@ namespace SabreTools.RedumpLib.Data
|
||||
{
|
||||
var siteCodes = new List<string>();
|
||||
|
||||
foreach (var val in Enum.GetValues(typeof(SiteCode)))
|
||||
foreach (var val in SiteCode.AllSiteCodes)
|
||||
{
|
||||
string? shortName = ((SiteCode?)val).ShortName()?.TrimEnd(':');
|
||||
string? longName = ((SiteCode?)val).LongName()?.TrimEnd(':');
|
||||
string? shortName = val.Code?.TrimEnd(':');
|
||||
string longName = val.HTML.TrimEnd(':');
|
||||
|
||||
bool isCommentCode = ((SiteCode?)val).IsCommentCode();
|
||||
bool isContentCode = ((SiteCode?)val).IsContentCode();
|
||||
bool isMultiline = ((SiteCode?)val).IsMultiLine();
|
||||
bool isCommentCode = val.IsCommentCode;
|
||||
bool isContentCode = val.IsContentCode;
|
||||
bool isMultiline = val.IsMultiLine;
|
||||
|
||||
// Invalid codes should be skipped
|
||||
if (shortName is null || longName is null)
|
||||
@@ -924,221 +924,6 @@ namespace SabreTools.RedumpLib.Data
|
||||
return siteCodes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a site code is boolean or not
|
||||
/// </summary>
|
||||
/// <param name="siteCode">SiteCode to check</param>
|
||||
/// <returns>True if the code field is a flag with no value, false otherwise</returns>
|
||||
public static bool IsBoolean(this SiteCode siteCode)
|
||||
=> ((SiteCode?)siteCode).IsBoolean();
|
||||
|
||||
/// <summary>
|
||||
/// Check if a site code is boolean or not
|
||||
/// </summary>
|
||||
/// <param name="siteCode">SiteCode to check</param>
|
||||
/// <returns>True if the code field is a flag with no value, false otherwise</returns>
|
||||
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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a site code should live in the comments section
|
||||
/// </summary>
|
||||
/// <returns>True if the code field is in comments by default, false otherwise</returns>
|
||||
public static bool IsCommentCode(this SiteCode siteCode)
|
||||
=> ((SiteCode?)siteCode).IsCommentCode();
|
||||
|
||||
/// <summary>
|
||||
/// Check if a site code should live in the comments section
|
||||
/// </summary>
|
||||
/// <returns>True if the code field is in comments by default, false otherwise</returns>
|
||||
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.RingPerfectAudioOffset => true,
|
||||
SiteCode.Series => true,
|
||||
SiteCode.SSHash => true,
|
||||
SiteCode.SSVersion => true,
|
||||
SiteCode.SteamAppID => true,
|
||||
SiteCode.TitleID => 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.DiceMultimedia => true,
|
||||
SiteCode.DisneyInteractiveID => true,
|
||||
SiteCode.EidosID => true,
|
||||
SiteCode.ElectronicArtsID => true,
|
||||
SiteCode.FocusMultimedia => true,
|
||||
SiteCode.FoxInteractiveID => true,
|
||||
SiteCode.GSPSoftware => 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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a site code should live in the contents section
|
||||
/// </summary>
|
||||
/// <returns>True if the code field is in contents by default, false otherwise</returns>
|
||||
public static bool IsContentCode(this SiteCode siteCode)
|
||||
=> ((SiteCode?)siteCode).IsContentCode();
|
||||
|
||||
/// <summary>
|
||||
/// Check if a site code should live in the contents section
|
||||
/// </summary>
|
||||
/// <returns>True if the code field is in contents by default, false otherwise</returns>
|
||||
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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a site code is multi-line or not
|
||||
/// </summary>
|
||||
/// <returns>True if the code field is multiline by default, false otherwise</returns>
|
||||
public static bool IsMultiLine(this SiteCode siteCode)
|
||||
=> ((SiteCode?)siteCode).IsMultiLine();
|
||||
|
||||
/// <summary>
|
||||
/// Check if a site code is multi-line or not
|
||||
/// </summary>
|
||||
/// <returns>True if the code field is multiline by default, false otherwise</returns>
|
||||
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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the HTML version for each known site code
|
||||
/// </summary>
|
||||
public static string? LongName(this SiteCode siteCode)
|
||||
=> AttributeHelper<SiteCode>.GetHumanReadableAttribute(siteCode)?.LongName;
|
||||
|
||||
/// <summary>
|
||||
/// Get the HTML version for each known site code
|
||||
/// </summary>
|
||||
public static string? LongName(this SiteCode? siteCode)
|
||||
=> AttributeHelper<SiteCode?>.GetHumanReadableAttribute(siteCode)?.LongName;
|
||||
|
||||
/// <summary>
|
||||
/// Get the short tag for each known site code
|
||||
/// </summary>
|
||||
public static string? ShortName(this SiteCode siteCode)
|
||||
=> AttributeHelper<SiteCode>.GetHumanReadableAttribute(siteCode)?.ShortName;
|
||||
|
||||
/// <summary>
|
||||
/// Get the short tag for each known site code
|
||||
/// </summary>
|
||||
public static string? ShortName(this SiteCode? siteCode)
|
||||
=> AttributeHelper<SiteCode?>.GetHumanReadableAttribute(siteCode)?.ShortName;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sort Category
|
||||
|
||||
568
SabreTools.RedumpLib/Data/SiteCode.cs
Normal file
568
SabreTools.RedumpLib/Data/SiteCode.cs
Normal file
@@ -0,0 +1,568 @@
|
||||
namespace SabreTools.RedumpLib.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a single site code
|
||||
/// </summary>
|
||||
public sealed class SiteCode
|
||||
{
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// HTML tag representing the code
|
||||
/// </summary>
|
||||
public readonly string HTML;
|
||||
|
||||
/// <summary>
|
||||
/// Short code, if it exists
|
||||
/// </summary>
|
||||
public readonly string? Code;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if a site code is boolean
|
||||
/// </summary>
|
||||
public readonly bool IsBoolean;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the site code can go in the comments section
|
||||
/// </summary>
|
||||
public readonly bool IsCommentCode;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the site code can go in the contents section
|
||||
/// </summary>
|
||||
public readonly bool IsContentCode;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the site code can span multiple lines
|
||||
/// </summary>
|
||||
public readonly bool IsMultiLine;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
private SiteCode(string html,
|
||||
string? code = null,
|
||||
bool isBoolean = false,
|
||||
bool isCommentCode = false,
|
||||
bool isContentCode = false,
|
||||
bool isMultiLine = false)
|
||||
{
|
||||
HTML = html;
|
||||
|
||||
Code = code;
|
||||
IsBoolean = isBoolean;
|
||||
IsCommentCode = isCommentCode;
|
||||
IsContentCode = isContentCode;
|
||||
IsMultiLine = isMultiLine;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Static Instances
|
||||
|
||||
public static readonly SiteCode AcclaimID = new("<b>Acclaim ID</b>:",
|
||||
code: "[T:ACC]",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode AccoladeID = new("<b>Accolade ID</b>:",
|
||||
code: "<b>Accolade ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode ActivisionID = new("<b>Activision ID</b>:",
|
||||
code: "[T:ACT]",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode AdditionalBCAData = new("<b>Additional BCA Data</b>:",
|
||||
code: "<b>Additional BCA Data</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode AlternativeTitle = new("<b>Alternative Title</b>:",
|
||||
code: "[T:ALT]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode AlternativeForeignTitle = new("<b>Alternative Foreign Title</b>:",
|
||||
code: "[T:ALTF]",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode Applications = new("<b>Applications</b>:",
|
||||
code: "<b>Applications</b>:",
|
||||
isContentCode: true);
|
||||
|
||||
public static readonly SiteCode BandaiID = new("<b>Bandai ID</b>:",
|
||||
code: "[T:BID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode BBFCRegistrationNumber = new("<b>BBFC Reg. No.</b>:",
|
||||
code: "[T:BBFC]",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode BethesdaID = new("<b>Bethesda ID</b>:",
|
||||
code: "<b>Bethesda ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode CDProjektID = new("<b>CD Projekt ID</b>:",
|
||||
code: "<b>CD Projekt ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode CompatibleOS = new("<b>Compatible OS</b>:",
|
||||
code: "<b>Compatible OS</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode CoverID = new("<b>Cover ID</b>:",
|
||||
code: "<b>Cover ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode DiceMultimedia = new("<b>Dice Multimedia</b>:",
|
||||
code: "<b>Dice Multimedia</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode DiscHologramID = new("<b>Disc Hologram ID</b>:",
|
||||
code: "<b>Disc Hologram ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode DiscID = new("<b>Disc ID</b>:",
|
||||
code: "<b>Disc ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode DiscTitleNonLatin = new("<b>Disc Title (non-Latin)</b>:",
|
||||
code: "<b>Disc Title (non-Latin)</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode DisneyInteractiveID = new("<b>Disney Interactive ID</b>:",
|
||||
code: "<b>Disney Interactive ID</b>",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode DMIHash = new("<b>DMI</b>:",
|
||||
code: "<b>DMI</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode DNASDiscID = new("<b>DNAS Disc ID</b>:",
|
||||
code: "[T:DNAS]",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode EditionNonLatin = new("<b>Edition (non-Latin)</b>:",
|
||||
code: "<b>Edition (non-Latin)</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode EidosID = new("<b>Eidos ID</b>:",
|
||||
code: "<b>Eidos ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode ElectronicArtsID = new("<b>Electronic Arts ID</b>:",
|
||||
code: "[T:EAID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode Extras = new("<b>Extras</b>:",
|
||||
code: "[T:X]",
|
||||
isContentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode Filename = new("<b>Filename</b>:",
|
||||
code: "<b>Filename</b>:",
|
||||
isCommentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode FocusMultimedia = new("<b>Focus Multimedia</b>:",
|
||||
code: "<b>Focus Multimedia</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode FoxInteractiveID = new("<b>Fox Interactive ID</b>:",
|
||||
code: "[T:FIID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode GameFootage = new("<b>Game Footage</b>:",
|
||||
code: "[T:GF]",
|
||||
isContentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode Games = new("<b>Games</b>:",
|
||||
code: "<b>Games</b>:",
|
||||
isContentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
public static readonly SiteCode Genre = new("<b>Genre</b>:",
|
||||
code: "[T:G]",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode GSPSoftware = new("<b>GSP Software</b>:",
|
||||
code: "<b>GSP Software</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode GTInteractiveID = new("<b>GT Interactive ID</b>:",
|
||||
code: "[T:GTID]",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode HighSierraVolumeDescriptor = new("<b>High Sierra Volume Descriptor</b>:",
|
||||
code: "<b>High Sierra Volume Descriptor</b>:",
|
||||
isCommentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode InternalName = new("<b>Internal Name</b>:",
|
||||
code: "<b>Internal Name</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode InternalSerialName = new("<b>Internal Serial</b>:",
|
||||
code: "[T:ISN]",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode InterplayID = new("<b>Interplay ID</b>:",
|
||||
code: "<b>Interplay ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode ISBN = new("<b>ISBN</b>:",
|
||||
code: "[T:ISBN]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode ISSN = new("<b>ISSN</b>:",
|
||||
code: "[T:ISSN]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode JASRACID = new("<b>JASRAC ID</b>:",
|
||||
code: "[T:JID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode KingRecordsID = new("<b>King Records ID</b>:",
|
||||
code: "[T:KIRZ]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode KoeiID = new("<b>Koei ID</b>:",
|
||||
code: "[T:KOEI]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode KonamiID = new("<b>Konami ID</b>:",
|
||||
code: "[T:KID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode LucasArtsID = new("<b>Lucas Arts ID</b>:",
|
||||
code: "[T:LAID]",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode MicrosoftID = new("<b>Microsoft ID</b>:",
|
||||
code: "<b>Microsoft ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode Multisession = new("<b>Multisession</b>:",
|
||||
code: "<b>Multisession</b>:",
|
||||
isCommentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
public static readonly SiteCode NaganoID = new("<b>Nagano ID</b>:",
|
||||
code: "[T:NGID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode NamcoID = new("<b>Namco ID</b>:",
|
||||
code: "[T:NID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode NetYarozeGames = new("<b>Net Yaroze Games</b>:",
|
||||
code: "[T:NYG]",
|
||||
isContentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
public static readonly SiteCode NipponIchiSoftwareID = new("<b>Nippon Ichi Software ID</b>:",
|
||||
code: "[T:NPS]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode OriginID = new("<b>Origin ID</b>:",
|
||||
code: "[T:OID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode Patches = new("<b>Patches</b>:",
|
||||
code: "[T:P]",
|
||||
isContentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
public static readonly SiteCode PCMacHybrid = new("PC/Mac Hybrid",
|
||||
code: "PC/Mac Hybrid",
|
||||
isBoolean: true,
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode PFIHash = new("<b>PFI</b>:",
|
||||
code: "<b>PFI</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode PlayableDemos = new("<b>Playable Demos</b>:",
|
||||
code: "[T:PD]",
|
||||
isContentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
public static readonly SiteCode PonyCanyonID = new("<b>Pony Canyon ID</b>:",
|
||||
code: "[T:PCID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode PostgapType = new("<b>Postgap type</b>: Form 2",
|
||||
code: "[T:PT2]",
|
||||
isBoolean: true,
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode PPN = new("<b>PPN</b>:",
|
||||
code: "[T:PPN]",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag for some systems yet
|
||||
public static readonly SiteCode Protection = new("<b>Protection</b>:",
|
||||
code: "<b>Protection</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode RingPerfectAudioOffset = new("<b>Ring Perfect Audio Offset</b>:",
|
||||
code: "<b>Ring Perfect Audio Offset</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode RollingDemos = new("<b>Rolling Demos</b>:",
|
||||
code: "[T:RD]",
|
||||
isContentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
public static readonly SiteCode Savegames = new("<b>Savegames</b>:",
|
||||
code: "[T:SG]",
|
||||
isContentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
public static readonly SiteCode SegaID = new("<b>Sega ID</b>:",
|
||||
code: "[T:SID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode SelenID = new("<b>Selen ID</b>:",
|
||||
code: "[T:SNID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode Series = new("<b>Series</b>:",
|
||||
code: "[T:S]",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode SierraID = new("<b>Sierra ID</b>:",
|
||||
code: "<b>Sierra ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode SSHash = new("<b>SS</b>:",
|
||||
code: "<b>SS</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode SSVersion = new("<b>SS version</b>:",
|
||||
code: "<b>SS version</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode SteamAppID = new("<b>Steam AppID</b>:",
|
||||
code: "<b>Steam App ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode SteamCsmCsdDepotID = new("<b>Steam Depot ID (.sis/.csm/.csd)</b>:",
|
||||
code: "<b>Steam Depot ID (.sis/.csm/.csd)</b>:",
|
||||
isContentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode SteamSimSidDepotID = new("<b>Steam Depot ID (.sis/.sim/.sid)</b>:",
|
||||
code: "<b>Steam Depot ID (.sis/.sim/.sid)</b>:",
|
||||
isContentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
public static readonly SiteCode TaitoID = new("<b>Taito ID</b>:",
|
||||
code: "[T:TID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode TechDemos = new("<b>Tech Demos</b>:",
|
||||
code: "[T:TD]",
|
||||
isContentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode TitleID = new("<b>Title ID</b>:",
|
||||
code: "<b>Title ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode TwoKGamesID = new("<b>2K Games ID</b>:",
|
||||
code: "<b>2K Games ID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode UbisoftID = new("<b>Ubisoft ID</b>:",
|
||||
code: "[T:UID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode ValveID = new("<b>Valve ID</b>:",
|
||||
code: "[T:VID]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode VFCCode = new("<b>VFC code</b>:",
|
||||
code: "[T:VFC]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode Videos = new("<b>Videos</b>:",
|
||||
code: "[T:V]",
|
||||
isContentCode: true,
|
||||
isMultiLine: true);
|
||||
|
||||
public static readonly SiteCode VolumeLabel = new("<b>Volume Label</b>:",
|
||||
code: "[T:VOL]",
|
||||
isCommentCode: true);
|
||||
|
||||
public static readonly SiteCode VCD = new("<b>V-CD</b>",
|
||||
code: "[T:VCD]",
|
||||
isBoolean: true,
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode XeMID = new("<b>XeMID</b>:",
|
||||
code: "<b>XeMID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
// This doesn't have a site tag yet
|
||||
public static readonly SiteCode XMID = new("<b>XMID</b>:",
|
||||
code: "<b>XMID</b>:",
|
||||
isCommentCode: true);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Static Collections
|
||||
|
||||
/// <summary>
|
||||
/// All site codes
|
||||
/// </summary>
|
||||
/// TODO: Figure out how to remove delimiters
|
||||
public static readonly SiteCode[] AllSiteCodes =
|
||||
[
|
||||
AcclaimID,
|
||||
AccoladeID,
|
||||
ActivisionID,
|
||||
AdditionalBCAData,
|
||||
AlternativeTitle,
|
||||
AlternativeForeignTitle,
|
||||
Applications,
|
||||
|
||||
BandaiID,
|
||||
BBFCRegistrationNumber,
|
||||
BethesdaID,
|
||||
|
||||
CDProjektID,
|
||||
CompatibleOS,
|
||||
CoverID,
|
||||
|
||||
DiceMultimedia,
|
||||
DiscHologramID,
|
||||
DiscID,
|
||||
DiscTitleNonLatin,
|
||||
DisneyInteractiveID,
|
||||
DMIHash,
|
||||
DNASDiscID,
|
||||
|
||||
EditionNonLatin,
|
||||
EidosID,
|
||||
ElectronicArtsID,
|
||||
Extras,
|
||||
|
||||
Filename,
|
||||
FocusMultimedia,
|
||||
FoxInteractiveID,
|
||||
|
||||
GameFootage,
|
||||
Games,
|
||||
Genre,
|
||||
GSPSoftware,
|
||||
GTInteractiveID,
|
||||
|
||||
HighSierraVolumeDescriptor,
|
||||
|
||||
InternalName,
|
||||
InternalSerialName,
|
||||
InterplayID,
|
||||
ISBN,
|
||||
ISSN,
|
||||
|
||||
JASRACID,
|
||||
|
||||
KingRecordsID,
|
||||
KoeiID,
|
||||
KonamiID,
|
||||
|
||||
LucasArtsID,
|
||||
|
||||
MicrosoftID,
|
||||
Multisession,
|
||||
|
||||
NaganoID,
|
||||
NamcoID,
|
||||
NetYarozeGames,
|
||||
|
||||
NipponIchiSoftwareID,
|
||||
|
||||
OriginID,
|
||||
|
||||
Patches,
|
||||
PCMacHybrid,
|
||||
PFIHash,
|
||||
PlayableDemos,
|
||||
PonyCanyonID,
|
||||
PostgapType,
|
||||
PPN,
|
||||
Protection,
|
||||
|
||||
RingPerfectAudioOffset,
|
||||
RollingDemos,
|
||||
|
||||
Savegames,
|
||||
SegaID,
|
||||
SelenID,
|
||||
Series,
|
||||
SierraID,
|
||||
SSHash,
|
||||
SSVersion,
|
||||
SteamAppID,
|
||||
SteamCsmCsdDepotID,
|
||||
SteamSimSidDepotID,
|
||||
|
||||
TaitoID,
|
||||
TechDemos,
|
||||
TitleID,
|
||||
TwoKGamesID,
|
||||
|
||||
UbisoftID,
|
||||
|
||||
ValveID,
|
||||
VFCCode,
|
||||
Videos,
|
||||
VolumeLabel,
|
||||
VCD,
|
||||
|
||||
XeMID,
|
||||
XMID,
|
||||
];
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -159,7 +159,7 @@ namespace SabreTools.RedumpLib.Tools
|
||||
{
|
||||
match = Constants.SerialRegex.Match(discData);
|
||||
if (match.Success)
|
||||
info.DiscIdentifiers.DiscSerials = $"(VERIFY THIS) {WebUtility.HtmlDecode(match.Groups[1].Value)}";
|
||||
info.DiscIdentifiers.DiscSerials = $"(VERIFY THIS) {WebUtility.HtmlDecode(match.Groups[1].Value)}";
|
||||
}
|
||||
|
||||
// Error Count
|
||||
@@ -236,8 +236,7 @@ namespace SabreTools.RedumpLib.Tools
|
||||
continue;
|
||||
|
||||
// If the line doesn't contain this tag, just skip
|
||||
var shortName = siteCode.ShortName();
|
||||
if (shortName is null || !commentLine.Contains(shortName))
|
||||
if (siteCode.Code is null || !commentLine.Contains(siteCode.Code))
|
||||
continue;
|
||||
|
||||
// Mark as having found a tag
|
||||
@@ -247,19 +246,19 @@ namespace SabreTools.RedumpLib.Tools
|
||||
lastSiteCode = siteCode;
|
||||
|
||||
// A subset of tags can be multiline
|
||||
addToLast = siteCode.IsMultiLine();
|
||||
addToLast = siteCode.IsMultiLine;
|
||||
|
||||
// Skip certain site codes because of data issues
|
||||
if (ShouldSkipSiteCode(siteCode))
|
||||
continue;
|
||||
|
||||
// If we don't already have this site code, add it to the dictionary
|
||||
if (!info.DumpMetadata.CommentsSpecialFields.ContainsKey(siteCode.Value))
|
||||
info.DumpMetadata.CommentsSpecialFields[siteCode.Value] = $"(VERIFY THIS) {commentLine.Replace(shortName, string.Empty).Trim()}";
|
||||
if (!info.DumpMetadata.CommentsSpecialFields.ContainsKey(siteCode))
|
||||
info.DumpMetadata.CommentsSpecialFields[siteCode] = $"(VERIFY THIS) {commentLine.Replace(siteCode.Code, string.Empty).Trim()}";
|
||||
|
||||
// Otherwise, append the value to the existing key
|
||||
else
|
||||
info.DumpMetadata.CommentsSpecialFields[siteCode.Value] += $", {commentLine.Replace(shortName, string.Empty).Trim()}";
|
||||
info.DumpMetadata.CommentsSpecialFields[siteCode] += $", {commentLine.Replace(siteCode.Code, string.Empty).Trim()}";
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -269,10 +268,10 @@ namespace SabreTools.RedumpLib.Tools
|
||||
{
|
||||
if (addToLast && lastSiteCode is not null && !ShouldSkipSiteCode(lastSiteCode))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(info.DumpMetadata.CommentsSpecialFields![lastSiteCode.Value]))
|
||||
info.DumpMetadata.CommentsSpecialFields[lastSiteCode.Value] += "\n";
|
||||
if (!string.IsNullOrEmpty(info.DumpMetadata.CommentsSpecialFields![lastSiteCode]))
|
||||
info.DumpMetadata.CommentsSpecialFields[lastSiteCode] += "\n";
|
||||
|
||||
info.DumpMetadata.CommentsSpecialFields[lastSiteCode.Value] += commentLine;
|
||||
info.DumpMetadata.CommentsSpecialFields[lastSiteCode] += commentLine;
|
||||
}
|
||||
else if (!addToLast || lastSiteCode is null)
|
||||
{
|
||||
@@ -333,19 +332,18 @@ namespace SabreTools.RedumpLib.Tools
|
||||
continue;
|
||||
|
||||
// If the line doesn't contain this tag, just skip
|
||||
var shortName = siteCode.ShortName();
|
||||
if (shortName is null || !contentLine.Contains(shortName))
|
||||
if (siteCode.Code is null || !contentLine.Contains(siteCode.Code))
|
||||
continue;
|
||||
|
||||
// Cache the current site code
|
||||
lastSiteCode = siteCode;
|
||||
|
||||
// If we don't already have this site code, add it to the dictionary
|
||||
if (!info.DumpMetadata.ContentsSpecialFields.ContainsKey(siteCode.Value))
|
||||
info.DumpMetadata.ContentsSpecialFields[siteCode.Value] = $"(VERIFY THIS) {contentLine.Replace(shortName, string.Empty).Trim()}";
|
||||
if (!info.DumpMetadata.ContentsSpecialFields.ContainsKey(siteCode))
|
||||
info.DumpMetadata.ContentsSpecialFields[siteCode] = $"(VERIFY THIS) {contentLine.Replace(siteCode.Code, string.Empty).Trim()}";
|
||||
|
||||
// A subset of tags can be multiline
|
||||
addToLast = siteCode.IsMultiLine();
|
||||
addToLast = siteCode.IsMultiLine;
|
||||
|
||||
// Mark as having found a tag
|
||||
foundTag = true;
|
||||
@@ -357,10 +355,10 @@ namespace SabreTools.RedumpLib.Tools
|
||||
{
|
||||
if (addToLast && lastSiteCode is not null && !ShouldSkipSiteCode(lastSiteCode))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(info.DumpMetadata.ContentsSpecialFields![lastSiteCode.Value]))
|
||||
info.DumpMetadata.ContentsSpecialFields[lastSiteCode.Value] += "\n";
|
||||
if (!string.IsNullOrEmpty(info.DumpMetadata.ContentsSpecialFields![lastSiteCode]))
|
||||
info.DumpMetadata.ContentsSpecialFields[lastSiteCode] += "\n";
|
||||
|
||||
info.DumpMetadata.ContentsSpecialFields[lastSiteCode.Value] += contentLine;
|
||||
info.DumpMetadata.ContentsSpecialFields[lastSiteCode] += contentLine;
|
||||
}
|
||||
else if (!addToLast || lastSiteCode is null)
|
||||
{
|
||||
@@ -470,39 +468,49 @@ namespace SabreTools.RedumpLib.Tools
|
||||
/// </summary>
|
||||
private static bool ShouldSkipSiteCode(SiteCode? siteCode)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return siteCode switch
|
||||
{
|
||||
// Multiple
|
||||
SiteCode.HighSierraVolumeDescriptor
|
||||
or SiteCode.InternalSerialName
|
||||
or SiteCode.Multisession
|
||||
or SiteCode.VolumeLabel => true,
|
||||
// Multiple
|
||||
if (siteCode == SiteCode.HighSierraVolumeDescriptor)
|
||||
return true;
|
||||
else if (siteCode == SiteCode.InternalSerialName)
|
||||
return true;
|
||||
else if (siteCode == SiteCode.Multisession)
|
||||
return true;
|
||||
else if (siteCode == SiteCode.VolumeLabel)
|
||||
return true;
|
||||
|
||||
// Audio CD
|
||||
SiteCode.RingPerfectAudioOffset => true,
|
||||
// Audio CD
|
||||
if (siteCode == SiteCode.RingPerfectAudioOffset)
|
||||
return true;
|
||||
|
||||
// Microsoft Xbox and Xbox 360
|
||||
SiteCode.DMIHash
|
||||
or SiteCode.PFIHash
|
||||
or SiteCode.SSHash
|
||||
or SiteCode.SSVersion
|
||||
or SiteCode.XMID
|
||||
or SiteCode.XeMID => true,
|
||||
// Microsoft Xbox and Xbox 360
|
||||
if (siteCode == SiteCode.DMIHash)
|
||||
return true;
|
||||
else if (siteCode == SiteCode.PFIHash)
|
||||
return true;
|
||||
else if (siteCode == SiteCode.SSHash)
|
||||
return true;
|
||||
else if (siteCode == SiteCode.SSVersion)
|
||||
return true;
|
||||
else if (siteCode == SiteCode.XMID)
|
||||
return true;
|
||||
else if (siteCode == SiteCode.XeMID)
|
||||
return true;
|
||||
|
||||
// Microsoft Xbox One and Series X/S
|
||||
SiteCode.Filename => true,
|
||||
SiteCode.TitleID => true,
|
||||
// Microsoft Xbox One and Series X/S
|
||||
if (siteCode == SiteCode.Filename)
|
||||
return true;
|
||||
else if (siteCode == SiteCode.TitleID)
|
||||
return true;
|
||||
|
||||
// Nintendo Gamecube
|
||||
SiteCode.InternalName => true,
|
||||
// Nintendo Gamecube
|
||||
if (siteCode == SiteCode.InternalName)
|
||||
return true;
|
||||
|
||||
// Protection
|
||||
SiteCode.Protection => true,
|
||||
// Protection
|
||||
if (siteCode == SiteCode.Protection)
|
||||
return true;
|
||||
|
||||
_ => false,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -520,27 +528,26 @@ namespace SabreTools.RedumpLib.Tools
|
||||
if (text.Length == 0)
|
||||
return text;
|
||||
|
||||
foreach (SiteCode? siteCode in Enum.GetValues(typeof(SiteCode)))
|
||||
foreach (SiteCode? siteCode in SiteCode.AllSiteCodes)
|
||||
{
|
||||
var longname = siteCode.LongName();
|
||||
if (!string.IsNullOrEmpty(longname))
|
||||
text = text.Replace(longname, siteCode.ShortName());
|
||||
if (!string.IsNullOrEmpty(siteCode.HTML))
|
||||
text = text.Replace(siteCode.HTML, siteCode.Code);
|
||||
}
|
||||
|
||||
// For some outdated tags, we need to use alternate names
|
||||
text = text.Replace("<b>Demos</b>:", ((SiteCode?)SiteCode.PlayableDemos).ShortName());
|
||||
text = text.Replace("<b>Disney ID</b>:", ((SiteCode?)SiteCode.DisneyInteractiveID).ShortName());
|
||||
text = text.Replace("DMI:", ((SiteCode?)SiteCode.DMIHash).ShortName());
|
||||
text = text.Replace("<b>LucasArts ID</b>:", ((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("<b>SSv1</b>:", ((SiteCode?)SiteCode.SSHash).ShortName());
|
||||
text = text.Replace("SSv2:", ((SiteCode?)SiteCode.SSHash).ShortName());
|
||||
text = text.Replace("<b>SSv2</b>:", ((SiteCode?)SiteCode.SSHash).ShortName());
|
||||
text = text.Replace("SS version:", ((SiteCode?)SiteCode.SSVersion).ShortName());
|
||||
text = text.Replace("XeMID:", ((SiteCode?)SiteCode.XeMID).ShortName());
|
||||
text = text.Replace("XMID:", ((SiteCode?)SiteCode.XMID).ShortName());
|
||||
text = text.Replace("<b>Demos</b>:", SiteCode.PlayableDemos.Code);
|
||||
text = text.Replace("<b>Disney ID</b>:", SiteCode.DisneyInteractiveID.Code);
|
||||
text = text.Replace("DMI:", SiteCode.DMIHash.Code);
|
||||
text = text.Replace("<b>LucasArts ID</b>:", SiteCode.LucasArtsID.Code);
|
||||
text = text.Replace("PFI:", SiteCode.PFIHash.Code);
|
||||
text = text.Replace("SS:", SiteCode.SSHash.Code);
|
||||
text = text.Replace("SSv1:", SiteCode.SSHash.Code);
|
||||
text = text.Replace("<b>SSv1</b>:", SiteCode.SSHash.Code);
|
||||
text = text.Replace("SSv2:", SiteCode.SSHash.Code);
|
||||
text = text.Replace("<b>SSv2</b>:", SiteCode.SSHash.Code);
|
||||
text = text.Replace("SS version:", SiteCode.SSVersion.Code);
|
||||
text = text.Replace("XeMID:", SiteCode.XeMID.Code);
|
||||
text = text.Replace("XMID:", SiteCode.XMID.Code);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -588,11 +588,10 @@ namespace SabreTools.RedumpLib.Tools
|
||||
if (value.Length == 0)
|
||||
return string.Empty;
|
||||
|
||||
bool isMultiLine = code.IsMultiLine();
|
||||
string line = $"{code.ShortName()}{(isMultiLine ? "\n" : " ")}";
|
||||
string line = $"{code.Code}{(code.IsMultiLine ? "\n" : " ")}";
|
||||
|
||||
// Special case for boolean fields
|
||||
if (code.IsBoolean())
|
||||
if (code.IsBoolean)
|
||||
{
|
||||
if (value != true.ToString())
|
||||
return string.Empty;
|
||||
@@ -600,7 +599,7 @@ namespace SabreTools.RedumpLib.Tools
|
||||
return line.Trim();
|
||||
}
|
||||
|
||||
return $"{line}{value}{(isMultiLine ? "\n" : string.Empty)}";
|
||||
return $"{line}{value}{(code.IsMultiLine ? "\n" : string.Empty)}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user