diff --git a/MediaBrowser.ApiInteraction.Metro/DataSerializer.cs b/MediaBrowser.ApiInteraction.Metro/DataSerializer.cs index 9be237fa6..452ca43f4 100644 --- a/MediaBrowser.ApiInteraction.Metro/DataSerializer.cs +++ b/MediaBrowser.ApiInteraction.Metro/DataSerializer.cs @@ -1,7 +1,7 @@ using System; using System.IO; +using Newtonsoft.Json; using ProtoBuf; -using ServiceStack.Text; namespace MediaBrowser.ApiInteraction { @@ -15,10 +15,16 @@ namespace MediaBrowser.ApiInteraction } if (format == ApiInteraction.SerializationFormats.Jsv) { - return TypeSerializer.DeserializeFromStream(stream); + throw new NotImplementedException(); } - return JsonSerializer.DeserializeFromStream(stream); + using (StreamReader streamReader = new StreamReader(stream)) + { + using (JsonReader jsonReader = new JsonTextReader(streamReader)) + { + return JsonSerializer.Create(new JsonSerializerSettings()).Deserialize(jsonReader); + } + } } public static object DeserializeFromStream(Stream stream, SerializationFormats format, Type type) @@ -29,17 +35,20 @@ namespace MediaBrowser.ApiInteraction } if (format == ApiInteraction.SerializationFormats.Jsv) { - return TypeSerializer.DeserializeFromStream(type, stream); + throw new NotImplementedException(); } - return JsonSerializer.DeserializeFromStream(type, stream); + using (StreamReader streamReader = new StreamReader(stream)) + { + using (JsonReader jsonReader = new JsonTextReader(streamReader)) + { + return JsonSerializer.Create(new JsonSerializerSettings()).Deserialize(jsonReader, type); + } + } } public static void Configure() { - JsConfig.DateHandler = ServiceStack.Text.JsonDateHandler.ISO8601; - JsConfig.ExcludeTypeInfo = true; - JsConfig.IncludeNullValues = false; } public static bool CanDeSerializeJsv diff --git a/MediaBrowser.ApiInteraction.Metro/MediaBrowser.ApiInteraction.Metro.csproj b/MediaBrowser.ApiInteraction.Metro/MediaBrowser.ApiInteraction.Metro.csproj index 51e08dd9d..f29871d94 100644 --- a/MediaBrowser.ApiInteraction.Metro/MediaBrowser.ApiInteraction.Metro.csproj +++ b/MediaBrowser.ApiInteraction.Metro/MediaBrowser.ApiInteraction.Metro.csproj @@ -49,12 +49,12 @@ + + ..\Json.Net\Portable\Newtonsoft.Json.dll + ..\protobuf-net\Full\portable\protobuf-net.dll - - ..\packages\ServiceStack.Text.3.9.5\lib\sl4-windowsphone71\ServiceStack.Text.WP.dll -