Fix info printing

This commit is contained in:
Deterous
2023-11-30 12:36:24 +13:00
parent 4b0d796bd2
commit 7f9fd1c9d6
5 changed files with 30 additions and 9 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>0.2.0</Version>
<Version>0.2.1</Version>
<!-- Package Properties -->
<Authors>Deterous</Authors>
+26 -5
View File
@@ -126,7 +126,13 @@ namespace IRDKit
// Create new ISO reader
CDReader reader = new(fs, true, true);
File.WriteAllText(opt.OutPath, "{\n");
if (opt.Json)
{
if (opt.OutPath != null)
File.WriteAllText(opt.OutPath, "{\n");
else
Console.WriteLine('{');
}
// Write PS3_DISC.SFB info
using (DiscUtils.Streams.SparseStream s = reader.OpenFile("PS3_DISC.SFB", FileMode.Open, FileAccess.Read))
@@ -136,9 +142,15 @@ namespace IRDKit
PS3_DiscSFB ps3_DiscSFB = new(s);
if (opt.Json)
{
File.AppendAllText(opt.OutPath, "\"PS3_DISC.SFB\": ");
if (opt.OutPath != null)
File.AppendAllText(opt.OutPath, "\"PS3_DISC.SFB\": ");
else
Console.Write("\"PS3_DISC.SFB\": ");
ps3_DiscSFB.PrintJson(opt.OutPath);
File.AppendAllText(opt.OutPath, ",");
if (opt.OutPath != null)
File.AppendAllText(opt.OutPath, ",\n");
else
Console.WriteLine(',');
}
else
ps3_DiscSFB.Print(opt.OutPath);
@@ -157,7 +169,10 @@ namespace IRDKit
ParamSFO paramSFO = new(s);
if (opt.Json)
{
File.AppendAllText(opt.OutPath, "\n\"PARAM.SFO\": ");
if (opt.OutPath != null)
File.AppendAllText(opt.OutPath, "\"PARAM.SFO\": ");
else
Console.Write("\"PARAM.SFO\": ");
paramSFO.PrintJson(opt.OutPath);
}
else
@@ -169,7 +184,13 @@ namespace IRDKit
}
}
File.AppendAllText(opt.OutPath, "\n}");
if (opt.Json)
{
if (opt.OutPath != null)
File.AppendAllText(opt.OutPath, "\n}\n");
else
Console.WriteLine("\n}");
}
}
else
{
+1 -1
View File
@@ -1334,7 +1334,7 @@ namespace LibIRD
json.AppendLine($" \"Extra Config\": \"{ExtraConfig:X4}\",");
if (Attachments != 0x0000)
json.AppendLine($" \"Attachments\": \"{Attachments:X4}\",");
json.AppendLine($" \"Unique ID\": \"{UID:X8}");
json.AppendLine($" \"Unique ID\": \"{UID:X8}\",");
json.AppendLine($" \"Data 1 Key\": \"{Convert.ToHexString(Data1Key)}\",");
json.AppendLine($" \"Data 2 Key\": \"{Convert.ToHexString(Data2Key)}\",");
json.AppendLine($" \"PIC\": \"{Convert.ToHexString(PIC)}\"");
+1 -1
View File
@@ -6,7 +6,7 @@
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>0.2.0</Version>
<Version>0.2.1</Version>
<!-- Package Properties -->
<Authors>Deterous</Authors>
+1 -1
View File
@@ -132,7 +132,7 @@ namespace LibIRD
// Build string from parameters
StringBuilder printText = new();
printText.AppendLine("PARAM.SFO Contents:");
printText.AppendLine("====================");
printText.AppendLine("===================");
// Loop through all parameters in PARAM.SFO
foreach (KeyValuePair<string, string> field in Field)