diff --git a/ICD.Common.Utils/PrettyPrint.cs b/ICD.Common.Utils/PrettyPrint.cs index 98d807f..61f728a 100644 --- a/ICD.Common.Utils/PrettyPrint.cs +++ b/ICD.Common.Utils/PrettyPrint.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ICD.Common.Properties; +using ICD.Common.Properties; +using ICD.Common.Utils.Json; namespace ICD.Common.Utils { @@ -13,72 +11,16 @@ namespace ICD.Common.Utils #region Methods [PublicAPI] - public static void PrintLine(IDictionary dictionary) + public static void PrintLine([CanBeNull] object value) { - if (dictionary == null) - throw new ArgumentNullException("dictionary"); - - IcdConsole.PrintLine(ToString(dictionary)); + string serial = ToString(value); + IcdConsole.PrintLine(serial); } [PublicAPI] - public static void PrintLine(IEnumerable sequence) + public static string ToString([CanBeNull] object value) { - if (sequence == null) - throw new ArgumentNullException("sequence"); - - IcdConsole.PrintLine(ToString(sequence)); - } - - [PublicAPI] - public static string ToString(IDictionary dictionary) - { - if (dictionary == null) - throw new ArgumentNullException("dictionary"); - - StringBuilder builder = new StringBuilder(); - builder.AppendLine("{"); - - foreach (KeyValuePair kvp in dictionary) - { - builder.Append('\t'); - builder.Append(ToString(kvp.Key)); - builder.Append(" : "); - builder.Append(ToString(kvp.Value)); - builder.Append(','); - builder.AppendLine(); - } - - builder.Append("}"); - return builder.ToString(); - } - - [PublicAPI] - public static string ToString(IEnumerable sequence) - { - if (sequence == null) - throw new ArgumentNullException("sequence"); - - StringBuilder builder = new StringBuilder(); - builder.AppendLine("["); - - foreach (T item in sequence) - { - builder.Append('\t'); - builder.Append(ToString(item)); - builder.Append(','); - builder.AppendLine(); - } - - builder.Append("]"); - return builder.ToString(); - } - - [PublicAPI] - public static string ToString(T value) - { -// ReSharper disable once CompareNonConstrainedGenericWithNull - return StringUtils.ToRepresentation(value == null ? null : value.ToString()); + return JsonUtils.Format(value); } #endregion