mirror of
https://github.com/9ParsonsB/Pulsar.git
synced 2025-12-15 20:34:58 +01:00
Add Startup Events to Database
Now emit startup events on conneciton Some events still to add
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Observatory.Framework.Files.ParameterTypes;
|
||||
|
||||
namespace Observatory.Framework.Files.Converters;
|
||||
|
||||
class NumberOrStringConverter : JsonConverter<NumberOrString>
|
||||
{
|
||||
public override NumberOrString Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
return reader.TokenType == JsonTokenType.String ? new NumberOrString(reader.GetString()) : new NumberOrString(reader.GetDouble());
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, NumberOrString value, JsonSerializerOptions options)
|
||||
{
|
||||
if (value.IsString)
|
||||
writer.WriteStringValue(value.StringValue!);
|
||||
else
|
||||
writer.WriteNumberValue(value.DoubleValue!.Value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user