Parse .getkey.log

This commit is contained in:
Deterous
2023-10-30 11:43:01 +13:00
parent 8fec42d243
commit b962c8240a
4 changed files with 245 additions and 35 deletions
+41 -3
View File
@@ -184,6 +184,44 @@ namespace LibIRD
#region Constructors
/// <summary>
/// Constructor using .getkey.log for Disc Key
/// </summary>
/// <param name="isoPath">Path to the ISO</param>
/// <param name="getKeyLog">Path to the GetKey log file</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="FileNotFoundException"></exception>
/// <exception cref="InvalidDataException"></exception>
public ReIRD(string isoPath, string getKeyLog)
{
// Validate ISO path
if (isoPath == null || isoPath.Length <= 0)
throw new ArgumentNullException(nameof(isoPath));
// Check file exists
var iso = new FileInfo(isoPath);
if (!iso.Exists)
throw new FileNotFoundException(isoPath);
// Calculate size of ISO
long size = iso.Length;
// Parse .getkey.log for the Disc Key (Data1Key)
ParseGetKeyLog(getKeyLog);
// Generate Data 2 using Disc ID, discarding ID from getKeyLog
GenerateD2(GenerateID(size));
// Generate Disc PIC, discarding PIC from getKeyLog
GeneratePIC(size);
// Generate Unique Identifier using ISO CRC32
GenerateUID(isoPath);
// Generate the IRD hashes
Generate(isoPath);
}
/// <summary>
/// Constructor with required redump-style IRD fields
/// </summary>
@@ -205,9 +243,6 @@ namespace LibIRD
// Calculate size of ISO
long size = iso.Length;
// Generate Unique Identifier using ISO CRC32
GenerateUID(isoPath);
// Generate Data 1 using Disc Key
GenerateD1(key);
@@ -217,6 +252,9 @@ namespace LibIRD
// Generate Disc PIC
GeneratePIC(size);
// Generate Unique Identifier using ISO CRC32
GenerateUID(isoPath);
// Generate the IRD hashes
Generate(isoPath);
}