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.
28 lines
733 B
28 lines
733 B
using System;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
using NzbDrone.Common.Http;
|
|
|
|
namespace NzbDrone.Common.Serializer
|
|
{
|
|
public class STJHttpUriConverter : JsonConverter<HttpUri>
|
|
{
|
|
public override HttpUri Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
|
{
|
|
return new HttpUri(reader.GetString());
|
|
}
|
|
|
|
public override void Write(Utf8JsonWriter writer, HttpUri value, JsonSerializerOptions options)
|
|
{
|
|
if (value == null)
|
|
{
|
|
writer.WriteNullValue();
|
|
}
|
|
else
|
|
{
|
|
writer.WriteStringValue(value.FullUri);
|
|
}
|
|
}
|
|
}
|
|
}
|