From 77be0ec477e4c64f76f2db79629642265a733225 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Thu, 24 Jan 2019 15:57:53 -0500 Subject: [PATCH] refactor: Removing unused code --- ICD.Common.Utils/Json/JsonUtils.cs | 86 ------------------------------ 1 file changed, 86 deletions(-) diff --git a/ICD.Common.Utils/Json/JsonUtils.cs b/ICD.Common.Utils/Json/JsonUtils.cs index 56270bb..059d631 100644 --- a/ICD.Common.Utils/Json/JsonUtils.cs +++ b/ICD.Common.Utils/Json/JsonUtils.cs @@ -22,28 +22,6 @@ namespace ICD.Common.Utils.Json private const string MESSAGE_NAME_PROPERTY = "m"; private const string MESSAGE_DATA_PROPERTY = "d"; - /// - /// Forces Newtonsoft to cache the given type for faster subsequent usage. - /// - /// - public static void CacheType() - where T : new() - { - CacheType(typeof(T)); - } - - /// - /// Forces Newtonsoft to cache the given type for faster subsequent usage. - /// - public static void CacheType(Type type) - { - if (type == null) - throw new ArgumentNullException("type"); - - string serialized = JsonConvert.SerializeObject(ReflectionUtils.CreateInstance(type)); - JsonConvert.DeserializeObject(serialized, type); - } - /// /// Gets the token as a DateTime value. /// @@ -87,31 +65,6 @@ namespace ICD.Common.Utils.Json } } - /// - /// Pretty-prints the JSON document. - /// - /// - [PublicAPI] - public static void Print(string json) - { - if (json == null) - throw new ArgumentNullException("json"); - - string formatted = Format(json); - IcdConsole.PrintLine(formatted); - } - - /// - /// Serializes the given item and pretty-prints to JSON. - /// - /// - [PublicAPI] - public static void Print(object value) - { - string formatted = Format(value); - IcdConsole.PrintLine(formatted); - } - /// /// Serializes the given item and formats the JSON into a human-readable form. /// @@ -317,44 +270,5 @@ namespace ICD.Common.Utils.Json }, json); } - - /// - /// Deserializes the given token based on the known type. - /// - /// - /// - /// - public static object Deserialize(Type type, JToken token) - { - if (type == null) - throw new ArgumentNullException("type"); - - if (token == null) - throw new ArgumentNullException("token"); - - return Deserialize(type, token, new JsonSerializer()); - } - - /// - /// Deserializes the given token based on the known type. - /// - /// - /// - /// - /// - public static object Deserialize(Type type, JToken token, JsonSerializer serializer) - { - if (type == null) - throw new ArgumentNullException("type"); - - if (token == null) - throw new ArgumentNullException("token"); - - if (serializer == null) - throw new ArgumentNullException("serializer"); - - using (JTokenReader jsonReader = new JTokenReader(token)) - return serializer.Deserialize(jsonReader, type); - } } }