Catch filenotfound errors for non-PS3 ISOs

This commit is contained in:
Deterous
2023-12-04 23:45:04 +13:00
parent 0443ba5b9f
commit 8b82ec3d4e
+34 -36
View File
@@ -302,53 +302,51 @@ namespace IRDKit
} }
// Write PS3_DISC.SFB info // Write PS3_DISC.SFB info
using (DiscUtils.Streams.SparseStream s = reader.OpenFile("PS3_DISC.SFB", FileMode.Open, FileAccess.Read)) try
{ {
try using DiscUtils.Streams.SparseStream s = reader.OpenFile("PS3_DISC.SFB", FileMode.Open, FileAccess.Read);
PS3_DiscSFB ps3_DiscSFB = new(s);
if (json)
{ {
PS3_DiscSFB ps3_DiscSFB = new(s); if (outPath != null)
if (json) File.AppendAllText(outPath, "\"PS3_DISC.SFB\": ");
{
if (outPath != null)
File.AppendAllText(outPath, "\"PS3_DISC.SFB\": ");
else
Console.Write("\"PS3_DISC.SFB\": ");
ps3_DiscSFB.PrintJson(outPath);
if (outPath != null)
File.AppendAllText(outPath, ",\n");
else
Console.WriteLine(',');
}
else else
ps3_DiscSFB.Print(outPath); Console.Write("\"PS3_DISC.SFB\": ");
} ps3_DiscSFB.PrintJson(outPath);
catch if (outPath != null)
{ File.AppendAllText(outPath, ",\n");
Console.WriteLine("PS3_DISC.SFB not found"); else
Console.WriteLine(',');
} }
else
ps3_DiscSFB.Print(outPath);
}
catch (FileNotFoundException)
{
if (!json)
Console.WriteLine("PS3_DISC.SFB not found. Not a valid PS3 ISO?");
} }
// Write PARAM.SFO info // Write PARAM.SFO info
using (DiscUtils.Streams.SparseStream s = reader.OpenFile("PS3_GAME\\PARAM.SFO", FileMode.Open, FileAccess.Read)) try
{ {
try using DiscUtils.Streams.SparseStream s = reader.OpenFile("PS3_GAME\\PARAM.SFO", FileMode.Open, FileAccess.Read);
ParamSFO paramSFO = new(s);
if (json)
{ {
ParamSFO paramSFO = new(s); if (outPath != null)
if (json) File.AppendAllText(outPath, "\"PARAM.SFO\": ");
{
if (outPath != null)
File.AppendAllText(outPath, "\"PARAM.SFO\": ");
else
Console.Write("\"PARAM.SFO\": ");
paramSFO.PrintJson(outPath);
}
else else
paramSFO.Print(outPath); Console.Write("\"PARAM.SFO\": ");
} paramSFO.PrintJson(outPath);
catch
{
Console.WriteLine("PS3_GAME\\PARAM.SFO not found");
} }
else
paramSFO.Print(outPath);
}
catch (FileNotFoundException)
{
if (!json)
Console.WriteLine("PS3_GAME\\PARAM.SFO not found. Not a valid PS3 ISO?");
} }
// End JSON object // End JSON object