Tweak the check for offset roms

This commit is contained in:
Matt Nadareski
2025-05-13 11:42:22 -04:00
parent f2a06189a4
commit 6fc301f49f

View File

@@ -1013,8 +1013,8 @@ namespace SabreTools.DatFiles
addRoms.Add(romItem);
}
// If there is only one item and the sizes don't match
if (addRoms.Count == 1)
// If there is only one item left, check sizes
if (roms.Length > 1 && addRoms.Count == 1)
{
long? dataAreaSize = dataAreaItem.GetInt64FieldValue(Models.Metadata.DataArea.SizeKey);
long? romSize = addRoms[0].GetInt64FieldValue(Models.Metadata.Rom.SizeKey);
@@ -1423,34 +1423,6 @@ namespace SabreTools.DatFiles
}
}
/// <summary>
/// Get a numeric value from a string that's possibly hex
/// </summary>
private static long? ParseAsPossibleHex(string? numeric)
{
// If the value is null
if (string.IsNullOrEmpty(numeric))
return null;
try
{
// Get the value from the string
if (!long.TryParse(numeric, out long value))
{
if (!numeric!.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return null;
value = long.Parse(numeric.Substring(2), NumberStyles.HexNumber);
}
return value;
}
catch
{
return null;
}
}
#endregion
}
}