Fix numeric serialization

This commit is contained in:
Robert committed 2021-09-30 23:45:26 +02:00
1 parent 50b4c71142
commit 245c418b9b
3 files changed
+40 -9

No files matched your search

@@ -0,0 +1,25 @@
using System;
using Newtonsoft.Json;
namespace Artemis.Core.JsonConverters
{
internal class NumericJsonConverter : JsonConverter<Numeric>
{
#region Overrides of JsonConverter<Numeric>
/// <inheritdoc />
public override void WriteJson(JsonWriter writer, Numeric value, JsonSerializer serializer)
{
float floatValue = value;
writer.WriteValue(floatValue);
}
/// <inheritdoc />
public override Numeric ReadJson(JsonReader reader, Type objectType, Numeric existingValue, bool hasExistingValue, JsonSerializer serializer)
{
return new Numeric(reader.Value);
}
#endregion
}
}