mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
24 lines
638 B
C#
24 lines
638 B
C#
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
|
|
} |