|
|
@@ -446,8 +446,8 @@ namespace InABox.Core
|
|
|
/// <remarks>
|
|
|
/// Handles <see cref="byte"/>[], <see cref="Array"/>s of serialisable values, <see cref="Enum"/>, <see cref="bool"/>, <see cref="string"/>,
|
|
|
/// <see cref="Guid"/>, <see cref="byte"/>, <see cref="Int16"/>, <see cref="Int32"/>, <see cref="Int64"/>, <see cref="float"/>, <see cref="double"/>,
|
|
|
- /// <see cref="DateTime"/>, <see cref="TimeSpan"/>, <see cref="LoggablePropertyAttribute"/>, <see cref="IPackable"/>, <see cref="Nullable{T}"/>
|
|
|
- /// and <see cref="ISerializeBinary"/>.
|
|
|
+ /// <see cref="decimal"/>, <see cref="DateTime"/>, <see cref="TimeSpan"/>, <see cref="LoggablePropertyAttribute"/>, <see cref="IPackable"/>,
|
|
|
+ /// <see cref="Nullable{T}"/> and <see cref="ISerializeBinary"/>.
|
|
|
/// </remarks>
|
|
|
/// <param name="writer"></param>
|
|
|
/// <param name="type"></param>
|
|
|
@@ -524,6 +524,9 @@ namespace InABox.Core
|
|
|
else if (MatchType<double, object>(type) && value is double f64)
|
|
|
writer.Write(f64);
|
|
|
|
|
|
+ else if (MatchType<decimal, object>(type) && value is decimal d)
|
|
|
+ writer.Write(d);
|
|
|
+
|
|
|
else if (MatchType<DateTime, object>(type) && value is DateTime date)
|
|
|
writer.Write(date.Ticks);
|
|
|
|
|
|
@@ -571,7 +574,7 @@ namespace InABox.Core
|
|
|
/// </summary>
|
|
|
/// <remarks>
|
|
|
/// Handles <see cref="byte"/>[], <see cref="Array"/>s of serialisable values, <see cref="Enum"/>, <see cref="bool"/>, <see cref="string"/>,
|
|
|
- /// <see cref="Guid"/>, <see cref="byte"/>, <see cref="Int16"/>, <see cref="Int32"/>, <see cref="Int64"/>, <see cref="float"/>, <see cref="double"/>,
|
|
|
+ /// <see cref="Guid"/>, <see cref="byte"/>, <see cref="Int16"/>, <see cref="Int32"/>, <see cref="Int64"/>, <see cref="float"/>, <see cref="double"/>, <see cref="decimal"/>,
|
|
|
/// <see cref="DateTime"/>, <see cref="TimeSpan"/>, <see cref="LoggablePropertyAttribute"/>, <see cref="IPackable"/>, <see cref="Nullable{T}"/>
|
|
|
/// and <see cref="ISerializeBinary"/>.
|
|
|
/// </remarks>
|
|
|
@@ -638,6 +641,10 @@ namespace InABox.Core
|
|
|
{
|
|
|
return reader.ReadDouble();
|
|
|
}
|
|
|
+ else if (type == typeof(decimal))
|
|
|
+ {
|
|
|
+ return reader.ReadDecimal();
|
|
|
+ }
|
|
|
else if (type == typeof(DateTime))
|
|
|
{
|
|
|
return new DateTime(reader.ReadInt64());
|
|
|
@@ -967,6 +974,8 @@ namespace InABox.Core
|
|
|
case JsonTokenType.Number:
|
|
|
if (reader.TryGetInt32(out int intValue))
|
|
|
return intValue;
|
|
|
+ if (reader.TryGetDecimal(out var decimalValue))
|
|
|
+ return decimalValue;
|
|
|
if (reader.TryGetDouble(out double doubleValue))
|
|
|
return doubleValue;
|
|
|
return null;
|
|
|
@@ -1067,6 +1076,8 @@ namespace InABox.Core
|
|
|
writer.WriteNumberValue(f);
|
|
|
else if (value is double dVal)
|
|
|
writer.WriteNumberValue(dVal);
|
|
|
+ else if (value is decimal decVal)
|
|
|
+ writer.WriteNumberValue(decVal);
|
|
|
else if (value is DateTime dtVal)
|
|
|
writer.WriteStringValue(dtVal.ToString());
|
|
|
else if (value is TimeSpan tsVal)
|
|
|
@@ -1138,6 +1149,10 @@ namespace InABox.Core
|
|
|
{
|
|
|
return lValue;
|
|
|
}
|
|
|
+ else if(reader.TryGetDecimal(out var decValue))
|
|
|
+ {
|
|
|
+ return decValue;
|
|
|
+ }
|
|
|
else if(reader.TryGetDouble(out var dValue))
|
|
|
{
|
|
|
return dValue;
|