1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-19 10:54:05 +02:00
Sonarr/NzbDrone.SignalR/Serializer.cs

29 lines
767 B
C#
Raw Normal View History

using System;
using System.IO;
using Microsoft.AspNet.SignalR.Json;
2013-05-12 19:52:55 -07:00
using NzbDrone.Common.Serializer;
2013-09-10 23:33:47 -07:00
namespace NzbDrone.SignalR
{
public class Serializer : IJsonSerializer
{
2013-05-12 19:52:55 -07:00
private readonly JsonNetSerializer _signalRSerializer = new JsonNetSerializer();
public void Serialize(object value, TextWriter writer)
{
if (value.GetType().FullName.StartsWith("NzbDrone"))
{
2013-05-12 19:52:55 -07:00
Json.Serialize(value, writer);
}
else
{
_signalRSerializer.Serialize(value, writer);
}
}
2013-05-23 18:41:17 -07:00
public object Parse(TextReader reader, Type targetType)
{
2013-05-23 18:41:17 -07:00
return Json.Deserialize(reader.ReadToEnd(), targetType);
}
}
}