Merge back the last of the enums

This commit is contained in:
Matt Nadareski
2026-06-14 19:20:19 -04:00
parent 67e0fb7927
commit 54da06a16c
12 changed files with 562 additions and 579 deletions

View File

@@ -2,7 +2,6 @@
using System.Data;
using System.Linq;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.RedumpOrg.Data;
using Xunit;
namespace SabreTools.RedumpLib.Test.RedumpOrg
@@ -145,7 +144,7 @@ namespace SabreTools.RedumpLib.Test.RedumpOrg
[Fact]
public void SiteCode_ListSiteCodes()
{
var actual = RedumpLib.RedumpOrg.Data.Extensions.ListSiteCodes();
var actual = Extensions.ListSiteCodes();
Assert.NotEmpty(actual);
}

View File

@@ -5,7 +5,6 @@ using System.Text;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Data.Sections;
using SabreTools.RedumpLib.RedumpOrg;
using SabreTools.RedumpLib.RedumpOrg.Data;
using Xunit;
namespace SabreTools.RedumpLib.Test.RedumpOrg

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using Newtonsoft.Json;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Data.Sections;
using SabreTools.RedumpLib.RedumpOrg.Data;
using Xunit;
namespace SabreTools.RedumpLib.Test

View File

@@ -3612,6 +3612,299 @@ namespace SabreTools.RedumpLib.Data
#endregion
}
/// <summary>
/// List of all Redump site codes
/// </summary>
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>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,
[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,
[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
[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 non-zero data start</b>:", LongName = "<b>Ring non-zero data start</b>:")]
RingNonZeroDataStart,
// 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,
// This doesn't have a site tag yet
[HumanReadable(ShortName = "<b>Universal Hash (SHA-1)</b>:", LongName = "<b>Universal Hash (SHA-1)</b>:")]
UniversalHash,
[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>

View File

@@ -1877,6 +1877,272 @@ namespace SabreTools.RedumpLib.Data
#endregion
#region Site Code
/// <summary>
/// List all site codes with their short usable names
/// </summary>
public static List<string> ListSiteCodes()
{
var siteCodes = new List<string>();
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<string>();
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;
}
/// <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.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
}
/// <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
/// <summary>

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using Newtonsoft.Json;
using SabreTools.RedumpLib.Converters;
using SabreTools.RedumpLib.RedumpOrg.Converters;
using SabreTools.RedumpLib.RedumpOrg.Data;
namespace SabreTools.RedumpLib.Data.Sections
{

View File

@@ -11,7 +11,6 @@ using System.Text.RegularExpressions;
using System.Threading.Tasks;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Web;
using static SabreTools.RedumpLib.RedumpOrg.Data.Extensions;
namespace SabreTools.RedumpLib.RedumpInfo
{

View File

@@ -1,7 +1,6 @@
using System;
using System.Text;
using SabreTools.RedumpLib.Data;
using static SabreTools.RedumpLib.RedumpOrg.Data.Extensions;
namespace SabreTools.RedumpLib.RedumpInfo
{

View File

@@ -1,297 +0,0 @@
using SabreTools.RedumpLib.Attributes;
namespace SabreTools.RedumpLib.RedumpOrg.Data
{
/// <summary>
/// List of all Redump site codes
/// </summary>
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>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,
[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,
[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
[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 non-zero data start</b>:", LongName = "<b>Ring non-zero data start</b>:")]
RingNonZeroDataStart,
// 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,
// This doesn't have a site tag yet
[HumanReadable(ShortName = "<b>Universal Hash (SHA-1)</b>:", LongName = "<b>Universal Hash (SHA-1)</b>:")]
UniversalHash,
[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,
}
}

View File

@@ -1,272 +0,0 @@
using System;
using System.Collections.Generic;
using SabreTools.RedumpLib.Attributes;
namespace SabreTools.RedumpLib.RedumpOrg.Data
{
/// <summary>
/// Information pertaining to Redump systems
/// </summary>
#pragma warning disable IDE0072
public static class Extensions
{
#region Site Code
/// <summary>
/// List all site codes with their short usable names
/// </summary>
public static List<string> ListSiteCodes()
{
var siteCodes = new List<string>();
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<string>();
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;
}
/// <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)
{
return siteCode switch
{
SiteCode.PCMacHybrid => true,
SiteCode.PostgapType => true,
SiteCode.VCD => true,
_ => false,
};
}
/// <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)
{
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,
};
}
/// <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)
{
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,
};
}
/// <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)
{
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,
};
}
/// <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
}
#pragma warning restore IDE0072
}

View File

@@ -4,7 +4,6 @@ using System.Text;
using System.Text.RegularExpressions;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Data.Sections;
using SabreTools.RedumpLib.RedumpOrg.Data;
namespace SabreTools.RedumpLib.RedumpOrg
{
@@ -278,7 +277,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
bool reverseOrder = system.HasReversedRingcodes();
// 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:");

View File

@@ -37,7 +37,7 @@ namespace SabreTools.RedumpLib
case MediaType.BD100:
case MediaType.BD128:
// Extract the size from the hashes
long size = Data.Extensions.ExtractSizeFromHashData(info.TracksAndWriteOffsets.ClrMameProData);
long size = Extensions.ExtractSizeFromHashData(info.TracksAndWriteOffsets.ClrMameProData);
if (info.SizeAndChecksums.Layerbreak3 != default)
info.CommonDiscInfo.Media = MediaType.BD128;