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.Core.Tools;
|
||||||
using SabreTools.DatFiles.Formats;
|
using SabreTools.DatFiles.Formats;
|
||||||
using SabreTools.Filter;
|
using SabreTools.Filter;
|
||||||
|
using SabreTools.Serialization;
|
||||||
|
|
||||||
namespace SabreTools.DatFiles
|
namespace SabreTools.DatFiles
|
||||||
{
|
{
|
||||||
@@ -207,8 +208,14 @@ namespace SabreTools.DatFiles
|
|||||||
if (string.IsNullOrEmpty(fieldName) || !_header.ContainsKey(fieldName!))
|
if (string.IsNullOrEmpty(fieldName) || !_header.ContainsKey(fieldName!))
|
||||||
return default;
|
return default;
|
||||||
|
|
||||||
// Get the value based on the type
|
// Try to parse directly
|
||||||
return _header.ReadDouble(fieldName!);
|
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>
|
/// <summary>
|
||||||
@@ -222,8 +229,14 @@ namespace SabreTools.DatFiles
|
|||||||
if (string.IsNullOrEmpty(fieldName) || !_header.ContainsKey(fieldName!))
|
if (string.IsNullOrEmpty(fieldName) || !_header.ContainsKey(fieldName!))
|
||||||
return default;
|
return default;
|
||||||
|
|
||||||
// Get the value based on the type
|
// Try to parse directly
|
||||||
return _header.ReadLong(fieldName!);
|
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>
|
/// <summary>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
|
using SabreTools.Core.Tools;
|
||||||
using SabreTools.Filter;
|
using SabreTools.Filter;
|
||||||
|
|
||||||
namespace SabreTools.DatItems
|
namespace SabreTools.DatItems
|
||||||
@@ -107,8 +108,14 @@ namespace SabreTools.DatItems
|
|||||||
if (string.IsNullOrEmpty(fieldName) || !_machine.ContainsKey(fieldName!))
|
if (string.IsNullOrEmpty(fieldName) || !_machine.ContainsKey(fieldName!))
|
||||||
return default;
|
return default;
|
||||||
|
|
||||||
// Get the value based on the type
|
// Try to parse directly
|
||||||
return _machine.ReadDouble(fieldName!);
|
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>
|
/// <summary>
|
||||||
@@ -122,8 +129,14 @@ namespace SabreTools.DatItems
|
|||||||
if (string.IsNullOrEmpty(fieldName) || !_machine.ContainsKey(fieldName!))
|
if (string.IsNullOrEmpty(fieldName) || !_machine.ContainsKey(fieldName!))
|
||||||
return default;
|
return default;
|
||||||
|
|
||||||
// Get the value based on the type
|
// Try to parse directly
|
||||||
return _machine.ReadLong(fieldName!);
|
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>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user