Fix many issues with SoftwareList-specific functionality

This commit is contained in:
Matt Nadareski
2024-03-12 16:17:05 -04:00
parent fbaddb40d5
commit 1235e72432
4 changed files with 87 additions and 19 deletions

View File

@@ -155,8 +155,14 @@ namespace SabreTools.DatItems
if (string.IsNullOrEmpty(fieldName) || !_internal.ContainsKey(fieldName!))
return default;
// Get the value based on the type
return _internal.ReadDouble(fieldName!);
// Try to parse directly
double? doubleValue = _internal.ReadDouble(fieldName!);
if (doubleValue != null)
return doubleValue;
// Try to parse from the string
string? stringValue = _internal.ReadString(fieldName!);
return NumberHelper.ConvertToDouble(stringValue);
}
/// <summary>
@@ -170,8 +176,14 @@ namespace SabreTools.DatItems
if (string.IsNullOrEmpty(fieldName) || !_internal.ContainsKey(fieldName!))
return default;
// Get the value based on the type
return _internal.ReadLong(fieldName!);
// Try to parse directly
long? longValue = _internal.ReadLong(fieldName!);
if (longValue != null)
return longValue;
// Try to parse from the string
string? stringValue = _internal.ReadString(fieldName!);
return NumberHelper.ConvertToInt64(stringValue);
}
/// <summary>