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.
30 lines
872 B
30 lines
872 B
11 years ago
|
using System;
|
||
12 years ago
|
using Newtonsoft.Json;
|
||
|
|
||
11 years ago
|
namespace NzbDrone.Core.Download.Clients.Sabnzbd.JsonConverters
|
||
12 years ago
|
{
|
||
|
public class SabnzbdPriorityTypeConverter : JsonConverter
|
||
|
{
|
||
|
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||
|
{
|
||
|
var priorityType = (SabPriorityType)value;
|
||
|
writer.WriteValue(priorityType.ToString());
|
||
|
}
|
||
|
|
||
|
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||
|
{
|
||
|
var queuePriority = reader.Value.ToString();
|
||
|
|
||
|
SabPriorityType output;
|
||
|
Enum.TryParse(queuePriority, out output);
|
||
|
|
||
|
return output;
|
||
|
}
|
||
|
|
||
|
public override bool CanConvert(Type objectType)
|
||
|
{
|
||
|
return objectType == typeof(SabPriorityType);
|
||
|
}
|
||
|
}
|
||
|
}
|