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.
Lidarr/src/NzbDrone.Core/Datastore/Converters/CustomFormatIntConverter.cs

21 lines
629 B

using System;
using System.Text.Json;
using System.Text.Json.Serialization;
using NzbDrone.Core.CustomFormats;
namespace NzbDrone.Core.Datastore.Converters
{
public class CustomFormatIntConverter : JsonConverter<CustomFormat>
{
public override CustomFormat Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return new CustomFormat { Id = reader.GetInt32() };
}
public override void Write(Utf8JsonWriter writer, CustomFormat value, JsonSerializerOptions options)
{
writer.WriteNumberValue(value.Id);
}
}
}