You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

19 lines
689 B

using IPA.Utilities;
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace IPA.JsonConverters
{
internal class AlmostVersionConverter : JsonConverter<AlmostVersion>
{
public override AlmostVersion Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
reader.TokenType == JsonTokenType.Null ? null : new AlmostVersion(reader.GetString());
public override void Write(Utf8JsonWriter writer, AlmostVersion value, JsonSerializerOptions options)
{
if (value == null) writer.WriteNullValue();
else writer.WriteStringValue(value.ToString());
}
}
}