WriteObject() private method

private WriteObject ( string prefix, object element ) : void
prefix string
element object
return void
 public static void Write(object element, int depth, TextWriter log)
 {
     ObjectDumper dumper = new ObjectDumper(depth);
     dumper.writer = log;
     dumper.WriteObject(null, element);
     log.WriteLine(new string('-', 20));
 }
 public static string Write(object o, int depth)
 {
     var sw = new StringWriter();
     sw.NewLine = "\r\n";
     ObjectDumper dumper = new ObjectDumper(sw, depth);
     dumper.WriteObject(null, o);
     return sw.ToString();
 }
示例#3
0
	public static string ToString(object o, int depth = 0)
	{
		using (var sw = new StringWriter())
		{
			ObjectDumper dumper = new ObjectDumper(depth, sw);
			dumper.WriteObject(null, o);
			return sw.ToString();
		}
	}
 public static void Write(object element, int depth, NLog.Logger log)
 {
     if (log.IsTraceEnabled)
     {
         ObjectDumper dumper = new ObjectDumper(depth);
         dumper.WriteObject(null, element);
         log.Trace(dumper.builder);
     }
 }
示例#5
0
 /// <summary>
 /// Dumps the object to a string. Added for convenience by Pete.
 /// </summary>
 public static string String(object element)
 {
     using (var w = new StringWriter())
     {
         var dumper = new ObjectDumper(0) { writer = w };
         dumper.WriteObject(null, element);
         return w.ToString();
     }
 }
示例#6
0
    public static string Write(object o, int depth)
    {
        var sw = new StringWriter {
            NewLine = "\r\n"
        };
        ObjectDumper dumper = new ObjectDumper(sw, depth);

        dumper.WriteObject(null, o);
        return(sw.ToString());
    }
示例#7
0
		/// <summary>
		/// Dumps values of the specified target.
		/// </summary>
		/// <param name="target">The target.</param>
		/// <param name="depth">The depth of the dump.</param>
		/// <returns>A string representing the object dump.</returns>
		public static string Dump(object target, int depth)
		{
			try
			{
				using (var dumper = new ObjectDumper(depth))
				{
					dumper.WriteObject(null, target);
					return dumper.ToString().TrimEnd(Environment.NewLine.ToCharArray());
				}
			}
			catch (Exception ex)
			{
				return string.Format("Dump failure: {0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace);
			}
		}
 public static string Dump(object element, int depth)
 {
     ObjectDumper dumper = new ObjectDumper(depth);
     dumper.WriteObject(null, element);
     return dumper.builder.ToString();
 }
示例#9
0
 /// <summary>
 /// Writes the specified element.
 /// </summary>
 /// <param name="prefix">The prefix to print.</param>
 /// <param name="element">The element to dump.</param>
 /// <param name="depth">The iteration level.</param>
 /// <param name="maxcount">The maximum count of dumps.</param>
 /// <param name="log">The output logger.</param>
 public static void Write(string prefix, object element, int depth, int maxcount, TextWriter log)
 {
     ObjectDumper dumper = new ObjectDumper(depth, maxcount);
     dumper.writer = log;
     // string prefix = null;
     if (element != null)
     {
         dumper.Write("[" + element.GetType().Name + "]" + log.NewLine);
         //prefix = "[" + element.GetType().Name + "]";
     }
     dumper.WriteObject(prefix, element);
 }
    public static void Write(object o, int depth)
    {
        ObjectDumper dumper = new ObjectDumper(depth);

        dumper.WriteObject(null, o);
    }
示例#11
0
 public static void Write(object o, int depth, TextWriter log)
 {
     var dumper = new ObjectDumper(depth) {_writer = log};
     dumper.WriteObject(null, o);
 }
示例#12
0
 public static void Write(object o, int depth)
 {
     ObjectDumper dumper = new ObjectDumper(depth);
     dumper.WriteObject(null, o);
 }
示例#13
0
	public static void WriteTo(object o, Stream stream, int depth = 0)
	{
		ObjectDumper dumper = new ObjectDumper(depth, new StreamWriter(stream));
		dumper.WriteObject(null, o);
	}
示例#14
0
	public static void Write(object o, int depth = 0)
	{
		ObjectDumper dumper = new ObjectDumper(depth, Console.Out);
		dumper.WriteObject(null, o);
	}
 public static void Write(object o, int depth)
 {
     Type t = typeof(string);
     ObjectDumper dumper = new ObjectDumper(depth);
     dumper.WriteObject(null, o);
 }
示例#16
0
		public static string Write(object o, int depth)
		{
			var dumper = new ObjectDumper(depth);
			dumper.WriteObject(null, o);
			return dumper._writer.ToString();
		}
示例#17
0
    public static void WriteTo(object o, Stream stream, int depth = 0)
    {
        ObjectDumper dumper = new ObjectDumper(depth, new StreamWriter(stream));

        dumper.WriteObject(null, o);
    }
示例#18
0
    public static void Write(object o, int depth = 0)
    {
        ObjectDumper dumper = new ObjectDumper(depth, Console.Out);

        dumper.WriteObject(null, o);
    }
示例#19
0
 internal static void Write(object o, int depth, TextWriter log)
 {
     ObjectDumper dumper = new ObjectDumper(depth);
     dumper.writer = log;
     dumper.WriteObject(null, o);
 }
示例#20
0
 public static void Write(object o, int depth, TextWriter outputStream = null)
 {
     ObjectDumper dumper = new ObjectDumper(depth, outputStream);
     dumper.WriteObject(null, o);
 }
 public static void Write(object element, int depth, TextWriter log)
 {
     ObjectDumper dumper = new ObjectDumper(depth);
     dumper.writer = log;
     dumper.WriteObject(null, element);
 }
 public static string GetObjectValue(object o)
 {
     ObjectDumper dumper = new ObjectDumper(1, false);
     dumper.WriteObject(null, o);
     return dumper.sb.ToString();
 }
示例#23
0
 public static void Write(object o, TextWriter writer, int depth)
 {
     ObjectDumper dumper = new ObjectDumper(writer, depth);
     dumper.WriteObject(null, o);
 }
示例#24
0
            public static void Write(StringBuilder sb, object o, int depth)
            {
                ObjectDumper dumper = new ObjectDumper(sb, depth);

                dumper.WriteObject(sb, null, o);
            }