mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Sync get value changes from DatItem
This commit is contained in:
@@ -7,6 +7,7 @@ using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.DatFiles.Formats;
|
||||
using SabreTools.Filter;
|
||||
using SabreTools.Serialization;
|
||||
|
||||
namespace SabreTools.DatFiles
|
||||
{
|
||||
@@ -207,8 +208,14 @@ namespace SabreTools.DatFiles
|
||||
if (string.IsNullOrEmpty(fieldName) || !_header.ContainsKey(fieldName!))
|
||||
return default;
|
||||
|
||||
// Get the value based on the type
|
||||
return _header.ReadDouble(fieldName!);
|
||||
// Try to parse directly
|
||||
double? doubleValue = _header.ReadDouble(fieldName!);
|
||||
if (doubleValue != null)
|
||||
return doubleValue;
|
||||
|
||||
// Try to parse from the string
|
||||
string? stringValue = _header.ReadString(fieldName!);
|
||||
return NumberHelper.ConvertToDouble(stringValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -222,8 +229,14 @@ namespace SabreTools.DatFiles
|
||||
if (string.IsNullOrEmpty(fieldName) || !_header.ContainsKey(fieldName!))
|
||||
return default;
|
||||
|
||||
// Get the value based on the type
|
||||
return _header.ReadLong(fieldName!);
|
||||
// Try to parse directly
|
||||
long? longValue = _header.ReadLong(fieldName!);
|
||||
if (longValue != null)
|
||||
return longValue;
|
||||
|
||||
// Try to parse from the string
|
||||
string? stringValue = _header.ReadString(fieldName!);
|
||||
return NumberHelper.ConvertToInt64(stringValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.Filter;
|
||||
|
||||
namespace SabreTools.DatItems
|
||||
@@ -107,8 +108,14 @@ namespace SabreTools.DatItems
|
||||
if (string.IsNullOrEmpty(fieldName) || !_machine.ContainsKey(fieldName!))
|
||||
return default;
|
||||
|
||||
// Get the value based on the type
|
||||
return _machine.ReadDouble(fieldName!);
|
||||
// Try to parse directly
|
||||
double? doubleValue = _machine.ReadDouble(fieldName!);
|
||||
if (doubleValue != null)
|
||||
return doubleValue;
|
||||
|
||||
// Try to parse from the string
|
||||
string? stringValue = _machine.ReadString(fieldName!);
|
||||
return NumberHelper.ConvertToDouble(stringValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -122,8 +129,14 @@ namespace SabreTools.DatItems
|
||||
if (string.IsNullOrEmpty(fieldName) || !_machine.ContainsKey(fieldName!))
|
||||
return default;
|
||||
|
||||
// Get the value based on the type
|
||||
return _machine.ReadLong(fieldName!);
|
||||
// Try to parse directly
|
||||
long? longValue = _machine.ReadLong(fieldName!);
|
||||
if (longValue != null)
|
||||
return longValue;
|
||||
|
||||
// Try to parse from the string
|
||||
string? stringValue = _machine.ReadString(fieldName!);
|
||||
return NumberHelper.ConvertToInt64(stringValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user