diff --git a/ICD.Common.Utils/Extensions/JsonExtensions.cs b/ICD.Common.Utils/Extensions/JsonReaderExtensions.cs
similarity index 72%
rename from ICD.Common.Utils/Extensions/JsonExtensions.cs
rename to ICD.Common.Utils/Extensions/JsonReaderExtensions.cs
index 1d1cb09..0ef7078 100644
--- a/ICD.Common.Utils/Extensions/JsonExtensions.cs
+++ b/ICD.Common.Utils/Extensions/JsonReaderExtensions.cs
@@ -3,39 +3,14 @@ using System.Collections.Generic;
using System.Linq;
using ICD.Common.Properties;
using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
namespace ICD.Common.Utils.Extensions
{
///
/// Extension methods for working with JSON.
///
- public static class JsonExtensions
+ public static class JsonReaderExtensions
{
- ///
- /// Writes the object value.
- ///
- ///
- ///
- ///
- ///
- [PublicAPI]
- public static void WriteObject(this JsonWriter extends, object value, JsonSerializer serializer,
- JsonConverter converter)
- {
- if (extends == null)
- throw new ArgumentNullException("extends");
-
- if (serializer == null)
- throw new ArgumentNullException("serializer");
-
- if (converter == null)
- throw new ArgumentNullException("converter");
-
- JObject jObject = JObject.FromObject(value, serializer);
- jObject.WriteTo(extends, converter);
- }
-
///
/// Reads the current token in the reader and deserializes to the given type.
///
@@ -110,31 +85,6 @@ namespace ICD.Common.Utils.Extensions
}
}
- ///
- /// Writes the type value.
- ///
- ///
- ///
- [PublicAPI]
- public static void WriteType(this JsonWriter extends, Type type)
- {
- if (extends == null)
- throw new ArgumentNullException("extends");
-
- if (type == null)
- {
- extends.WriteNull();
- return;
- }
-
- // Find the smallest possible name representation for the type that will still resolve
- string name = Type.GetType(type.FullName) == null
- ? type.AssemblyQualifiedName
- : type.FullName;
-
- extends.WriteValue(name);
- }
-
///
/// Gets the current value as a Type.
///
@@ -240,58 +190,6 @@ namespace ICD.Common.Utils.Extensions
return (T)(object)extends.GetValueAsInt();
}
- ///
- /// Serializes the given sequence of items to the writer.
- ///
- ///
- ///
- ///
- ///
- public static void SerializeArray(this JsonSerializer extends, JsonWriter writer, IEnumerable items)
- {
- if (extends == null)
- throw new ArgumentNullException("extends");
-
- if (writer == null)
- throw new ArgumentNullException("writer");
-
- if (items == null)
- throw new ArgumentNullException("items");
-
- extends.SerializeArray(writer, items, (s, w, item) => s.Serialize(w, item));
- }
-
- ///
- /// Serializes the given sequence of items to the writer.
- ///
- ///
- ///
- ///
- ///
- ///
- public static void SerializeArray(this JsonSerializer extends, JsonWriter writer, IEnumerable items,
- Action write)
- {
- if (extends == null)
- throw new ArgumentNullException("extends");
-
- if (writer == null)
- throw new ArgumentNullException("writer");
-
- if (items == null)
- throw new ArgumentNullException("items");
-
- if (write == null)
- throw new ArgumentNullException("write");
-
- writer.WriteStartArray();
- {
- foreach (TItem item in items)
- write(extends, writer, item);
- }
- writer.WriteEndArray();
- }
-
///
/// Deserializes an array of items from the reader's current value.
///
diff --git a/ICD.Common.Utils/Extensions/JsonWriterExtensions.cs b/ICD.Common.Utils/Extensions/JsonWriterExtensions.cs
new file mode 100644
index 0000000..98b4fe8
--- /dev/null
+++ b/ICD.Common.Utils/Extensions/JsonWriterExtensions.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using ICD.Common.Properties;
+using Newtonsoft.Json;
+
+namespace ICD.Common.Utils.Extensions
+{
+ public static class JsonWriterExtensions
+ {
+ ///
+ /// Writes the type value.
+ ///
+ ///
+ ///
+ [PublicAPI]
+ public static void WriteType(this JsonWriter extends, Type type)
+ {
+ if (extends == null)
+ throw new ArgumentNullException("extends");
+
+ if (type == null)
+ {
+ extends.WriteNull();
+ return;
+ }
+
+ // Find the smallest possible name representation for the type that will still resolve
+ string name = Type.GetType(type.FullName) == null
+ ? type.AssemblyQualifiedName
+ : type.FullName;
+
+ extends.WriteValue(name);
+ }
+
+ ///
+ /// Serializes the given sequence of items to the writer.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void SerializeArray(this JsonSerializer extends, JsonWriter writer, IEnumerable items)
+ {
+ if (extends == null)
+ throw new ArgumentNullException("extends");
+
+ if (writer == null)
+ throw new ArgumentNullException("writer");
+
+ if (items == null)
+ throw new ArgumentNullException("items");
+
+ extends.SerializeArray(writer, items, (s, w, item) => s.Serialize(w, item));
+ }
+
+ ///
+ /// Serializes the given sequence of items to the writer.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void SerializeArray(this JsonSerializer extends, JsonWriter writer, IEnumerable items,
+ Action write)
+ {
+ if (extends == null)
+ throw new ArgumentNullException("extends");
+
+ if (writer == null)
+ throw new ArgumentNullException("writer");
+
+ if (items == null)
+ throw new ArgumentNullException("items");
+
+ if (write == null)
+ throw new ArgumentNullException("write");
+
+ writer.WriteStartArray();
+ {
+ foreach (TItem item in items)
+ write(extends, writer, item);
+ }
+ writer.WriteEndArray();
+ }
+ }
+}
diff --git a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj
index 103d153..64c2c65 100644
--- a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj
+++ b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj
@@ -106,6 +106,7 @@
+
@@ -154,7 +155,7 @@
-
+