2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-12-16 04:44:56 +01:00

Add Startup Events to Database

Now emit startup events on conneciton
Some events still to add
This commit is contained in:
2024-05-25 19:41:38 +10:00
parent 579b2b115d
commit 68eff73dbd
80 changed files with 586 additions and 229 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 MaterialConverter : JsonConverter<ImmutableList<Material>>
public class MaterialConverter : JsonConverter<IReadOnlyCollection<Material>>
{
public override ImmutableList<Material> Read(ref Utf8JsonReader reader, Type typeToConvert,
public override IReadOnlyCollection<Material> Read(ref Utf8JsonReader reader, Type typeToConvert,
JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.StartObject)
@@ -41,13 +41,13 @@ public class MaterialConverter : JsonConverter<ImmutableList<Material>>
}
}
return materialComposition.ToImmutableList();
return materialComposition;
}
return JsonSerializer.Deserialize<ImmutableList<Material>>(ref reader, options)!;
return JsonSerializer.Deserialize<IReadOnlyCollection<Material>>(ref reader, options)!;
}
public override void Write(Utf8JsonWriter writer, ImmutableList<Material> value, JsonSerializerOptions options)
public override void Write(Utf8JsonWriter writer, IReadOnlyCollection<Material> value, JsonSerializerOptions options)
{
JsonSerializer.Serialize(writer, value, options);
}