Cleanup
This commit is contained in:
+1
-1
Submodule DiscUtils updated: a99992e5f4...299030c20b
+1
-1
@@ -1064,7 +1064,7 @@ namespace LibIRD
|
||||
CountFiles(dirInfo);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region IRD File
|
||||
|
||||
|
||||
@@ -131,6 +131,11 @@ namespace LibIRD
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Define JSON options once
|
||||
/// </summary>
|
||||
private readonly JsonSerializerOptions JsonOpts = new() { WriteIndented = true };
|
||||
|
||||
/// <summary>
|
||||
/// Prints parameters extracted from PS3_DISC.SFB to a json object
|
||||
/// </summary>
|
||||
@@ -138,7 +143,7 @@ namespace LibIRD
|
||||
public void PrintJson(string jsonPath = null)
|
||||
{
|
||||
// Serialise PS3_Disc.SFB data to a JSON object
|
||||
string json = JsonSerializer.Serialize(Field, new JsonSerializerOptions { WriteIndented = true });
|
||||
string json = JsonSerializer.Serialize(Field, JsonOpts);
|
||||
|
||||
// If no path given, output to console
|
||||
if (jsonPath == null)
|
||||
|
||||
+10
-5
@@ -103,7 +103,7 @@ namespace LibIRD
|
||||
- keyOffset[i];
|
||||
|
||||
// Read ith key name
|
||||
string key = Encoding.ASCII.GetString(br.ReadBytes((int) keyLen)).TrimEnd('\0');
|
||||
string key = Encoding.ASCII.GetString(br.ReadBytes((int)keyLen)).TrimEnd('\0');
|
||||
|
||||
// Move stream to ith data
|
||||
sfoStream.Position = dataTableStart + dataOffset[i];
|
||||
@@ -112,13 +112,13 @@ namespace LibIRD
|
||||
Field[key] = dataFormat[i] switch
|
||||
{
|
||||
// Non-null-terminated UTF-8 String
|
||||
0x0004 => Encoding.UTF8.GetString(br.ReadBytes((int) dataLength[i])),
|
||||
0x0004 => Encoding.UTF8.GetString(br.ReadBytes((int)dataLength[i])),
|
||||
// Null-terminated UTF-8 String
|
||||
0x0204 => Encoding.UTF8.GetString(br.ReadBytes((int) dataLength[i])).TrimEnd('\0'),
|
||||
0x0204 => Encoding.UTF8.GetString(br.ReadBytes((int)dataLength[i])).TrimEnd('\0'),
|
||||
// Integer
|
||||
0x0404 => br.ReadInt32().ToString(),
|
||||
// Unknown data format, assume null-terminated string
|
||||
_ => Encoding.UTF8.GetString(br.ReadBytes((int) dataLength[i])).TrimEnd('\0'),
|
||||
_ => Encoding.UTF8.GetString(br.ReadBytes((int)dataLength[i])).TrimEnd('\0'),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -159,6 +159,11 @@ namespace LibIRD
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Define JSON options once
|
||||
/// </summary>
|
||||
private readonly JsonSerializerOptions JsonOpts = new() { WriteIndented = true };
|
||||
|
||||
/// <summary>
|
||||
/// Prints parameters extracted from PARAM.SFO to a json object
|
||||
/// </summary>
|
||||
@@ -166,7 +171,7 @@ namespace LibIRD
|
||||
public void PrintJson(string jsonPath = null)
|
||||
{
|
||||
// Serialise PS3_Disc.SFB data to a JSON object
|
||||
string json = JsonSerializer.Serialize(Field, new JsonSerializerOptions { WriteIndented = true });
|
||||
string json = JsonSerializer.Serialize(Field, JsonOpts);
|
||||
|
||||
// If no path given, output to console
|
||||
if (jsonPath == null)
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Hashing;
|
||||
using System.Security;
|
||||
|
||||
namespace LibIRD
|
||||
{
|
||||
@@ -172,7 +171,7 @@ namespace LibIRD
|
||||
|
||||
// Total sectors used = num_sectors + Layer 0 start + sectors_between_layers (usually 0x01358C00 - 0x00CA73FE - 3)
|
||||
long total_sectors = (size / SectorSize) + l0_start_sector + (l1_start_sector - l0_end_sector - 3);
|
||||
byte[] ts = BitConverter.GetBytes((uint) total_sectors);
|
||||
byte[] ts = BitConverter.GetBytes((uint)total_sectors);
|
||||
|
||||
// Define the PIC
|
||||
pic = [
|
||||
|
||||
Reference in New Issue
Block a user