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.
Prowlarr/NzbDrone.SignalR/Serializer.cs

29 lines
767 B

using System;
using System.IO;
using Microsoft.AspNet.SignalR.Json;
using NzbDrone.Common.Serializer;
11 years ago
namespace NzbDrone.SignalR
{
public class Serializer : IJsonSerializer
{
private readonly JsonNetSerializer _signalRSerializer = new JsonNetSerializer();
public void Serialize(object value, TextWriter writer)
{
if (value.GetType().FullName.StartsWith("NzbDrone"))
{
Json.Serialize(value, writer);
}
else
{
_signalRSerializer.Serialize(value, writer);
}
}
12 years ago
public object Parse(TextReader reader, Type targetType)
{
12 years ago
return Json.Deserialize(reader.ReadToEnd(), targetType);
}
}
}