mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-02-06 05:35:34 +00:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
341edc56bd | ||
|
|
da4bdac6e2 | ||
|
|
7fe595ee0a | ||
|
|
8a9f62f5a4 | ||
|
|
dbb7cf7ef9 | ||
|
|
d591ee1550 | ||
|
|
9153c931a5 | ||
|
|
99ebd1f3ac | ||
|
|
844f5506f5 | ||
|
|
4be01b25ab | ||
|
|
22e2e73f65 | ||
|
|
831ea86d4f | ||
|
|
4475dba94c | ||
|
|
63a758c005 | ||
|
|
7e81f723ca | ||
|
|
f69c7e6bb2 | ||
|
|
9d2803a6df | ||
|
|
23f1ceac99 | ||
|
|
55c621b615 | ||
|
|
29cce4d4b9 | ||
|
|
1f37ece28d | ||
|
|
6acac60376 |
43
.github/workflows/build_nupkg.yml
vendored
Normal file
43
.github/workflows/build_nupkg.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: Nuget Pack
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Pack
|
||||
run: dotnet pack
|
||||
|
||||
- name: Upload build
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: 'Nuget Package'
|
||||
path: 'bin/Release/*.nupkg'
|
||||
|
||||
- name: Upload to rolling
|
||||
uses: ncipollo/release-action@v1.14.0
|
||||
with:
|
||||
allowUpdates: True
|
||||
artifacts: 'bin/Release/*.nupkg'
|
||||
body: 'Last built commit: ${{ github.sha }}'
|
||||
name: 'Rolling Release'
|
||||
prerelease: True
|
||||
replacesArtifacts: True
|
||||
tag: "rolling"
|
||||
updateOnlyUnreleased: True
|
||||
17
.github/workflows/check_pr.yml
vendored
Normal file
17
.github/workflows/check_pr.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: Build PR
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
|
||||
- name: Build
|
||||
run: dotnet build
|
||||
@@ -386,6 +386,15 @@ namespace SabreTools.RedumpLib
|
||||
info.DumpersAndStatus.Dumpers = [.. tempDumpers];
|
||||
}
|
||||
|
||||
// PS3 DiscKey
|
||||
if (string.IsNullOrEmpty(info.Extras!.DiscKey))
|
||||
{
|
||||
// Validate key is not NULL
|
||||
match = Constants.PS3DiscKey.Match(discData);
|
||||
if (match.Success && match.Groups[1].Value != "<span class=\"null\">NULL</span>")
|
||||
info.Extras.DiscKey = match.Groups[1].Value;
|
||||
}
|
||||
|
||||
// TODO: Unify handling of fields that can include site codes (Comments/Contents)
|
||||
|
||||
// Comments
|
||||
|
||||
@@ -102,6 +102,11 @@ namespace SabreTools.RedumpLib.Data
|
||||
/// </summary>
|
||||
public static Regex PartialMatchRegex = new(@"<td class=""static"">partial match ids: (.*?)</td>");
|
||||
|
||||
/// <summary>
|
||||
/// Regex matching the disc key on a PS3 disc page
|
||||
/// </summary>
|
||||
public static Regex PS3DiscKey = new(@"<th>Disc Key</th><th>Disc ID</th><th>Permanent Information & Control \(PIC\)</th></tr><tr><td>(.*?)</td><td>");
|
||||
|
||||
/// <summary>
|
||||
/// Regex matching the PVD field on a disc page
|
||||
/// </summary>
|
||||
|
||||
@@ -3526,16 +3526,28 @@ namespace SabreTools.RedumpLib.Data
|
||||
[HumanReadable(ShortName = "[T:ALTF]", LongName = "<b>Alternative Foreign Title</b>:")]
|
||||
AlternativeForeignTitle,
|
||||
|
||||
// TODO: 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,
|
||||
|
||||
// TODO: This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Bethesda ID</b>:", LongName = "<b>Bethesda ID</b>:")]
|
||||
BethesdaID,
|
||||
|
||||
// TODO: This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>CD Projekt ID</b>:", LongName = "<b>CD Projekt ID</b>:")]
|
||||
CDProjektID,
|
||||
|
||||
// TODO: This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Compatible OS</b>:", LongName = "<b>Compatible OS</b>:")]
|
||||
CompatibleOS,
|
||||
|
||||
// TODO: This doesn't have a site tag yet
|
||||
[HumanReadable(ShortName = "<b>Disc Hologram ID</b>:", LongName = "<b>Disc Hologram ID</b>:")]
|
||||
DiscHologramID,
|
||||
@@ -3547,6 +3559,10 @@ namespace SabreTools.RedumpLib.Data
|
||||
[HumanReadable(ShortName = "[T:DNAS]", LongName = "<b>DNAS Disc ID</b>:")]
|
||||
DNASDiscID,
|
||||
|
||||
// TODO: 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,
|
||||
|
||||
|
||||
@@ -239,6 +239,7 @@ namespace SabreTools.RedumpLib.Data
|
||||
|
||||
// https://en.wikipedia.org/wiki/Game_Wave_Family_Entertainment_System
|
||||
case RedumpSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem:
|
||||
types.Add(MediaType.CDROM); // Firmware discs only(?)
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
@@ -1062,6 +1063,148 @@ namespace SabreTools.RedumpLib.Data
|
||||
|
||||
#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 == null || longName == 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 should live in the comments section
|
||||
/// </summary>
|
||||
/// <param name="siteCode">SiteCode to check</param>
|
||||
/// <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.AlternativeTitle => true,
|
||||
SiteCode.AlternativeForeignTitle => true,
|
||||
SiteCode.BBFCRegistrationNumber => true,
|
||||
SiteCode.CompatibleOS => true,
|
||||
SiteCode.DiscHologramID => true,
|
||||
SiteCode.DMIHash => true,
|
||||
SiteCode.DNASDiscID => true,
|
||||
SiteCode.Filename => true,
|
||||
SiteCode.Genre => true,
|
||||
SiteCode.InternalName => true,
|
||||
SiteCode.InternalSerialName => true,
|
||||
SiteCode.ISBN => true,
|
||||
SiteCode.ISSN => true,
|
||||
SiteCode.Multisession => true,
|
||||
SiteCode.PFIHash => true,
|
||||
SiteCode.PostgapType => true,
|
||||
SiteCode.PPN => true,
|
||||
SiteCode.RingNonZeroDataStart => true,
|
||||
SiteCode.Series => true,
|
||||
SiteCode.SSHash => true,
|
||||
SiteCode.SSVersion => true,
|
||||
SiteCode.UniversalHash => true,
|
||||
SiteCode.VCD => true,
|
||||
SiteCode.VFCCode => true,
|
||||
SiteCode.VolumeLabel => true,
|
||||
SiteCode.XeMID => true,
|
||||
SiteCode.XMID => true,
|
||||
|
||||
// Publisher / Company IDs
|
||||
SiteCode.AcclaimID => true,
|
||||
SiteCode.ActivisionID => true,
|
||||
SiteCode.BandaiID => true,
|
||||
SiteCode.BethesdaID => true,
|
||||
SiteCode.CDProjektID => true,
|
||||
SiteCode.EidosID => true,
|
||||
SiteCode.ElectronicArtsID => true,
|
||||
SiteCode.FoxInteractiveID => true,
|
||||
SiteCode.GTInteractiveID => 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>
|
||||
/// <param name="siteCode">SiteCode to check</param>
|
||||
/// <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.TechDemos => true,
|
||||
SiteCode.Videos => true,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a site code is multi-line or not
|
||||
/// </summary>
|
||||
|
||||
@@ -530,6 +530,10 @@ namespace SabreTools.RedumpLib.Data
|
||||
/// </summary>
|
||||
public class DumpingInfoSection : ICloneable
|
||||
{
|
||||
// Name not defined by Redump -- Only used with MPF
|
||||
[JsonProperty(PropertyName = "d_frontend_version", Required = Required.AllowNull)]
|
||||
public string? FrontendVersion { get; set; }
|
||||
|
||||
// Name not defined by Redump
|
||||
[JsonProperty(PropertyName = "d_dumping_program", Required = Required.AllowNull)]
|
||||
public string? DumpingProgram { get; set; }
|
||||
@@ -554,16 +558,22 @@ namespace SabreTools.RedumpLib.Data
|
||||
[JsonProperty(PropertyName = "d_reported_disc_type", Required = Required.AllowNull)]
|
||||
public string? ReportedDiscType { get; set; }
|
||||
|
||||
// Name not defined by Redump -- Only used with Redumper
|
||||
[JsonProperty(PropertyName = "d_errors_c2", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string? C2ErrorsCount { get; set; }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new DumpingInfoSection
|
||||
{
|
||||
FrontendVersion = this.FrontendVersion,
|
||||
DumpingProgram = this.DumpingProgram,
|
||||
DumpingDate = this.DumpingDate,
|
||||
Manufacturer = this.Manufacturer,
|
||||
Model = this.Model,
|
||||
Firmware = this.Firmware,
|
||||
ReportedDiscType = this.ReportedDiscType,
|
||||
C2ErrorsCount = this.C2ErrorsCount,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,12 +35,14 @@
|
||||
|
||||
// Automatic Information
|
||||
|
||||
public const string FrontendVersionField = "Frontend Version";
|
||||
public const string DumpingProgramField = "Dumping Program";
|
||||
public const string DumpingDateField = "Date";
|
||||
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 C2ErrorCountField = "C2 Error Count";
|
||||
public const string PVDField = "Primary Volume Descriptor (PVD)";
|
||||
public const string DATField = "DAT";
|
||||
public const string SizeField = "Size";
|
||||
|
||||
16
Formatter.cs
16
Formatter.cs
@@ -229,12 +229,14 @@ namespace SabreTools.RedumpLib
|
||||
|
||||
// Dumping Info section
|
||||
output.Add(""); output.Add("Dumping Info:");
|
||||
AddIfExists(output, Template.FrontendVersionField, info.DumpingInfo?.FrontendVersion, 1);
|
||||
AddIfExists(output, Template.DumpingProgramField, info.DumpingInfo?.DumpingProgram, 1);
|
||||
AddIfExists(output, Template.DumpingDateField, info.DumpingInfo?.DumpingDate, 1);
|
||||
AddIfExists(output, Template.DumpingDriveManufacturer, info.DumpingInfo?.Manufacturer, 1);
|
||||
AddIfExists(output, Template.DumpingDriveModel, info.DumpingInfo?.Model, 1);
|
||||
AddIfExists(output, Template.DumpingDriveFirmware, info.DumpingInfo?.Firmware, 1);
|
||||
AddIfExists(output, Template.ReportedDiscType, info.DumpingInfo?.ReportedDiscType, 1);
|
||||
AddIfExists(output, Template.C2ErrorCountField, info.DumpingInfo?.C2ErrorsCount, 1);
|
||||
|
||||
// Make sure there aren't any instances of two blank lines in a row
|
||||
string? last = null;
|
||||
@@ -562,8 +564,6 @@ namespace SabreTools.RedumpLib
|
||||
|
||||
if (tags.ContainsKey(SiteCode.BBFCRegistrationNumber))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.BBFCRegistrationNumber, tags[SiteCode.BBFCRegistrationNumber]));
|
||||
if (tags.ContainsKey(SiteCode.CDProjektID))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.CDProjektID, tags[SiteCode.CDProjektID]));
|
||||
if (tags.ContainsKey(SiteCode.DiscHologramID))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.DiscHologramID, tags[SiteCode.DiscHologramID]));
|
||||
if (tags.ContainsKey(SiteCode.DNASDiscID))
|
||||
@@ -577,6 +577,8 @@ namespace SabreTools.RedumpLib
|
||||
if (tags.ContainsKey(SiteCode.VFCCode))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.VFCCode, tags[SiteCode.VFCCode]));
|
||||
|
||||
if (tags.ContainsKey(SiteCode.CompatibleOS))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.CompatibleOS, tags[SiteCode.CompatibleOS]));
|
||||
if (tags.ContainsKey(SiteCode.Genre))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.Genre, tags[SiteCode.Genre]));
|
||||
if (tags.ContainsKey(SiteCode.Series))
|
||||
@@ -593,6 +595,12 @@ namespace SabreTools.RedumpLib
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.ActivisionID, tags[SiteCode.ActivisionID]));
|
||||
if (tags.ContainsKey(SiteCode.BandaiID))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.BandaiID, tags[SiteCode.BandaiID]));
|
||||
if (tags.ContainsKey(SiteCode.BethesdaID))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.BethesdaID, tags[SiteCode.BethesdaID]));
|
||||
if (tags.ContainsKey(SiteCode.CDProjektID))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.CDProjektID, tags[SiteCode.CDProjektID]));
|
||||
if (tags.ContainsKey(SiteCode.EidosID))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.EidosID, tags[SiteCode.EidosID]));
|
||||
if (tags.ContainsKey(SiteCode.ElectronicArtsID))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.ElectronicArtsID, tags[SiteCode.ElectronicArtsID]));
|
||||
if (tags.ContainsKey(SiteCode.FoxInteractiveID))
|
||||
@@ -649,6 +657,10 @@ namespace SabreTools.RedumpLib
|
||||
if (tags == null || tags.Count == 0)
|
||||
return sorted;
|
||||
|
||||
// Applications
|
||||
if (tags.ContainsKey(SiteCode.Applications))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.Applications, tags[SiteCode.Applications]));
|
||||
|
||||
// Games
|
||||
if (tags.ContainsKey(SiteCode.Games))
|
||||
sorted.Add(new KeyValuePair<SiteCode?, string>(SiteCode.Games, tags[SiteCode.Games]));
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Version>1.3.2</Version>
|
||||
<Version>1.3.8</Version>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Authors>Matt Nadareski</Authors>
|
||||
<Description>Code to interact with redump.org</Description>
|
||||
<Copyright>Copyright (c) Matt Nadareski 2020-2023</Copyright>
|
||||
<Copyright>Copyright (c) Matt Nadareski 2020-2024</Copyright>
|
||||
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<RepositoryUrl>https://github.com/SabreTools/SabreTools.RedumpLib</RepositoryUrl>
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.3.0" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.4.8" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user