2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-01 08:23:42 -04:00

Implement Other state events

now emitted to websocket connections on connect
This commit is contained in:
2024-05-25 22:49:08 +10:00
parent 68eff73dbd
commit 7eae5e5ee6
68 changed files with 222 additions and 182 deletions

View File

@ -9,9 +9,9 @@ namespace Observatory.Framework.Files.Converters;
/// The format used for materials changed from an object with a key for each material to an array of objects containing "name" and "percent".
/// Need to handle both if we're going to read historical data. This reads the old format into a class reflecting the new structure.
/// </summary>
public class MaterialCompositionConverter : JsonConverter<IReadOnlyCollection<MaterialComposition>>
public class MaterialCompositionConverter : JsonConverter<List<MaterialComposition>>
{
public override IReadOnlyCollection<MaterialComposition> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
public override List<MaterialComposition> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.StartObject)
{
@ -42,10 +42,10 @@ public class MaterialCompositionConverter : JsonConverter<IReadOnlyCollection<Ma
return materialComposition;
}
return JsonSerializer.Deserialize<IReadOnlyCollection<MaterialComposition>>(ref reader, options)!;
return JsonSerializer.Deserialize<List<MaterialComposition>>(ref reader, options)!;
}
public override void Write(Utf8JsonWriter writer, IReadOnlyCollection<MaterialComposition> value,
public override void Write(Utf8JsonWriter writer, List<MaterialComposition> value,
JsonSerializerOptions options)
{
JsonSerializer.Serialize(writer, value, options);

View File

@ -9,9 +9,9 @@ namespace Observatory.Framework.Files.Converters;
/// The format used for materials changed from an object with a key for each material to an array of objects containing "name" and "percent".
/// Need to handle both if we're going to read historical data. This reads the old format into a class reflecting the new structure.
/// </summary>
public class MaterialConverter : JsonConverter<IReadOnlyCollection<Material>>
public class MaterialConverter : JsonConverter<List<Material>>
{
public override IReadOnlyCollection<Material> Read(ref Utf8JsonReader reader, Type typeToConvert,
public override List<Material> Read(ref Utf8JsonReader reader, Type typeToConvert,
JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.StartObject)
@ -44,10 +44,10 @@ public class MaterialConverter : JsonConverter<IReadOnlyCollection<Material>>
return materialComposition;
}
return JsonSerializer.Deserialize<IReadOnlyCollection<Material>>(ref reader, options)!;
return JsonSerializer.Deserialize<List<Material>>(ref reader, options)!;
}
public override void Write(Utf8JsonWriter writer, IReadOnlyCollection<Material> value, JsonSerializerOptions options)
public override void Write(Utf8JsonWriter writer, List<Material> value, JsonSerializerOptions options)
{
JsonSerializer.Serialize(writer, value, options);
}