Ejemplo n.º 1
0
        public static string DumpObject(object obj, int MaxLevel)
        {
            StringBuilder sb;

            sb = new StringBuilder(10000);
            if (obj == null)
            {
                return("Nothing");
            }
            else
            {
                Dumper.PrivDump(sb, obj, "[ObjectToDump]", 0, MaxLevel);
                return(sb.ToString());
            }
        }
Ejemplo n.º 2
0
        protected static void PrivDump(StringBuilder sb, object obj, string objName, int level, int MaxLevel)
        {
            if (obj == null)
            {
                return;
            }
            if (MaxLevel >= 0 && level >= MaxLevel)
            {
                return;
            }

            string padstr;

            padstr = "";
            for (int i = 0; i < level; i++)
            {
                if (i < level - 1)
                {
                    padstr += "|";
                }
                else
                {
                    padstr += "+";
                }
            }
            string str;

            string[] strarr;
            Type     t;

            t         = obj.GetType();
            strarr    = new String[7];
            strarr[0] = padstr;
            strarr[1] = objName;
            strarr[2] = " AS ";
            strarr[3] = t.FullName;
            strarr[4] = " = ";
            strarr[5] = obj.ToString();
            strarr[6] = "\r\n";
            sb.Append(String.Concat(strarr));
            if (obj.GetType().BaseType == typeof(ValueType))
            {
                return;
            }
            Dumper.DumpType(padstr, sb, obj, level, t, MaxLevel);
            Type bt;

            bt = t.BaseType;
            if (bt != null)
            {
                while (!(bt == typeof(Object)))
                {
                    str = bt.FullName;
                    sb.Append(padstr + "(" + str + ")\r\n");
                    Dumper.DumpType(padstr, sb, obj, level, bt, MaxLevel);
                    bt = bt.BaseType;
                    if (bt != null)
                    {
                        continue;
                    }
                    break;
                }
                while (bt != typeof(Object))
                {
                    ;
                }
            }
        }
Ejemplo n.º 3
0
 public static string DumpObject(object obj)
 {
     return(Dumper.DumpObject(obj, -1));
 }