mirror of
https://github.com/9ParsonsB/Pulsar.git
synced 2025-12-18 05:24:56 +01:00
Journals Now processed in own thread
Some invalid journal data is now handled Journals now use polymorphic deserialization Added Event names to all journal events Remove unused controllers
This commit is contained in:
21
ObservatoryFramework/JournalInvalidFloatConverter.cs
Normal file
21
ObservatoryFramework/JournalInvalidFloatConverter.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Observatory.Framework;
|
||||
|
||||
public class JournalInvalidFloatConverter : JsonConverter<float>
|
||||
{
|
||||
public override float Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
var success = reader.TryGetSingle(out var value);
|
||||
if (success)
|
||||
return value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, float value, JsonSerializerOptions options)
|
||||
{
|
||||
JsonSerializer.Serialize(writer, value, options);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user