Questionable/Questionable.Model/Questing/Converter/IdConverter.cs

20 lines
525 B
C#
Raw Normal View History

2024-08-03 18:30:18 +00:00
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Questionable.Model.Questing.Converter;
public class IdConverter : JsonConverter<IId>
{
public override IId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
uint value = reader.GetUInt32();
return Id.From(value);
}
public override void Write(Utf8JsonWriter writer, IId value, JsonSerializerOptions options)
{
throw new NotImplementedException();
}
}