2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-04-05 17:39:39 -04:00
Ben Parsons bd811c861c Update Journal File Handling
Now Correctly deserializes Journal events
2024-05-12 14:24:53 +10:00

19 lines
684 B
C#

using System.Text.Json;
using System.Text.Json.Serialization;
namespace Observatory.Framework.Files.Converters;
class PipConverter : JsonConverter<(int Sys, int Eng, int Wep)>
{
public override (int Sys, int Eng, int Wep) Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var values = JsonSerializer.Deserialize<int[]>(ref reader);
return (Sys: values[0], Eng: values[1], Wep: values[2]);
}
public override void Write(Utf8JsonWriter writer, (int Sys, int Eng, int Wep) value, JsonSerializerOptions options)
{
JsonSerializer.Serialize(writer, new {value.Sys, value.Eng, value.Wep}, options);
}
}