diff --git a/ICD.Common.Utils/Extensions/JsonWriterExtensions.cs b/ICD.Common.Utils/Extensions/JsonWriterExtensions.cs index c37e260..cfb6671 100644 --- a/ICD.Common.Utils/Extensions/JsonWriterExtensions.cs +++ b/ICD.Common.Utils/Extensions/JsonWriterExtensions.cs @@ -7,27 +7,6 @@ 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; - } - - string name = type.GetMinimalName(); - extends.WriteValue(name); - } - /// /// Serializes the given sequence of items to the writer. /// @@ -79,5 +58,101 @@ namespace ICD.Common.Utils.Extensions } writer.WriteEndArray(); } + + /// + /// 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; + } + + string name = type.GetMinimalName(); + extends.WriteValue(name); + } + + /// + /// Writes the property name and value to the writer. + /// + /// + /// + /// + public static void WriteProperty(this JsonWriter extends, string propertyName, object value) + { + if (extends == null) + throw new ArgumentNullException("extends"); + + extends.WritePropertyName(propertyName); + extends.WriteValue(value); + } + + /// + /// Writes the property name and value to the writer. + /// + /// + /// + /// + public static void WriteProperty(this JsonWriter extends, string propertyName, string value) + { + if (extends == null) + throw new ArgumentNullException("extends"); + + extends.WritePropertyName(propertyName); + extends.WriteValue(value); + } + + /// + /// Writes the property name and value to the writer. + /// + /// + /// + /// + public static void WriteProperty(this JsonWriter extends, string propertyName, DateTime value) + { + if (extends == null) + throw new ArgumentNullException("extends"); + + extends.WritePropertyName(propertyName); + extends.WriteValue(value); + } + + /// + /// Writes the property name and value to the writer. + /// + /// + /// + /// + public static void WriteProperty(this JsonWriter extends, string propertyName, bool value) + { + if (extends == null) + throw new ArgumentNullException("extends"); + + extends.WritePropertyName(propertyName); + extends.WriteValue(value); + } + + /// + /// Writes the property name and value to the writer. + /// + /// + /// + /// + public static void WriteProperty(this JsonWriter extends, string propertyName, int value) + { + if (extends == null) + throw new ArgumentNullException("extends"); + + extends.WritePropertyName(propertyName); + extends.WriteValue(value); + } } }