From 2d06095447b972c8c7239277428e2c67c8b7ca86 Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Mon, 25 Feb 2013 22:43:04 -0500 Subject: plugin security fixes and other abstractions --- MediaBrowser.ApiInteraction/DataSerializer.cs | 66 --------------------------- 1 file changed, 66 deletions(-) delete mode 100644 MediaBrowser.ApiInteraction/DataSerializer.cs (limited to 'MediaBrowser.ApiInteraction/DataSerializer.cs') diff --git a/MediaBrowser.ApiInteraction/DataSerializer.cs b/MediaBrowser.ApiInteraction/DataSerializer.cs deleted file mode 100644 index cc13d55c88..0000000000 --- a/MediaBrowser.ApiInteraction/DataSerializer.cs +++ /dev/null @@ -1,66 +0,0 @@ -using ProtoBuf; -using ProtoBuf.Meta; -using ServiceStack.Text; -using System; -using System.IO; - -namespace MediaBrowser.ApiInteraction -{ - /// - /// Class DataSerializer - /// - public static class DataSerializer - { - /// - /// Gets or sets the dynamically created serializer. - /// - /// The dynamic serializer. - public static TypeModel DynamicSerializer { get; set; } - - /// - /// Deserializes an object - /// - /// The stream. - /// The format. - /// The type. - /// System.Object. - /// - public static object DeserializeFromStream(Stream stream, SerializationFormats format, Type type) - { - if (format == SerializationFormats.Protobuf) - { - if (DynamicSerializer != null) - { - return DynamicSerializer.Deserialize(stream, null, type); - } - return Serializer.NonGeneric.Deserialize(type, stream); - } - if (format == SerializationFormats.Json) - { - return JsonSerializer.DeserializeFromStream(type, stream); - } - - throw new NotImplementedException(); - } - - /// - /// Serializes to json. - /// - /// The obj. - /// System.String. - public static string SerializeToJsonString(object obj) - { - return JsonSerializer.SerializeToString(obj, obj.GetType()); - } - - /// - /// Configures this instance. - /// - public static void Configure() - { - JsConfig.DateHandler = JsonDateHandler.ISO8601; - JsConfig.ExcludeTypeInfo = true; - JsConfig.IncludeNullValues = false; - } - } -} -- cgit v1.2.3