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

Initial Commit

This commit is contained in:
2024-04-13 15:54:59 +10:00
parent 8e178cbb7b
commit 63ed43f4af
459 changed files with 8039 additions and 20504 deletions

View File

@ -1,24 +1,19 @@
using System;
using System.Collections.Immutable;
using System.Text;
using System.Text.Json;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Observatory.Framework.Files.Converters
{
class StringIntConverter : JsonConverter<int>
{
public override int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.String)
return Int32.Parse(reader.GetString());
else
return reader.GetInt32();
}
namespace Observatory.Framework.Files.Converters;
public override void Write(Utf8JsonWriter writer, int value, JsonSerializerOptions options)
{
writer.WriteStringValue(value.ToString());
}
class StringIntConverter : JsonConverter<int>
{
public override int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.String)
return int.Parse(reader.GetString());
return reader.GetInt32();
}
}
public override void Write(Utf8JsonWriter writer, int value, JsonSerializerOptions options)
{
writer.WriteStringValue(value.ToString());
}
}