Simplify conditionals

This commit is contained in:
Deterous
2023-12-23 00:07:02 +13:00
parent c1fa640e0b
commit 26bde9d753
+3 -24
View File
@@ -667,17 +667,10 @@ namespace LibIRD
{
bool titleIDFound = paramSFO.Field.TryGetValue("TITLE_ID", out string titleID);
if (titleIDFound)
{
if (titleID.Length == 9)
TitleID = titleID;
TitleID = titleID.Length == 9 ? titleID : titleID.PadRight(9, '\0')[..9];
else
TitleID = titleID.PadRight(9, '\0')[..9];
}
else
{
TitleID = "\0\0\0\0\0\0\0\0\0";
}
}
// Try use Title from PARAM.SFO
bool titleFound = paramSFO.Field.TryGetValue("TITLE", out string title);
@@ -688,32 +681,18 @@ namespace LibIRD
{
bool discVersionFound = paramSFO.Field.TryGetValue("VERSION", out string discVersion);
if (discVersionFound)
{
if (discVersion.Length == 5)
DiscVersion = discVersion;
DiscVersion = discVersion.Length == 5 ? discVersion : discVersion.PadRight(5, '\0')[..5];
else
DiscVersion = discVersion.PadRight(5, '\0')[..5];
}
else
{
DiscVersion = "\0\0\0\0\0";
}
}
// Try use App Version from PARAM.SFO
bool appVersionFound = paramSFO.Field.TryGetValue("APP_VER", out string appVersion);
if (appVersionFound)
{
if (appVersion.Length == 5)
AppVersion = appVersion;
AppVersion = appVersion.Length == 5 ? appVersion : appVersion.PadRight(5, '\0')[..5];
else
AppVersion = appVersion.PadRight(5, '\0')[..5];
}
else
{
AppVersion = "\0\0\0\0\0";
}
}
// Determine system update version
GetSystemVersion(fs, reader);