2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-04-05 01:29:38 -04:00
Ben Parsons ac30d3cd2a API & WebSocket now working
Can Read Status File & Broadcast contents via websocket
2024-04-18 14:45:16 +10:00

19 lines
679 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 });
}
}