Beispiel #1
0
        public static string PrettyPrintDump(string rawDump)
        {
            StringBuilder stringBuilder = new StringBuilder();
            int           num           = 0;

            for (int i = 0; i < rawDump.Length; i++)
            {
                char c = rawDump[i];
                if (c == DefaultObjectDumpFormatter.TOKEN_INDENT_OPEN)
                {
                    num++;
                    stringBuilder.Append(DefaultObjectDumpFormatter.NEW_LINE + DefaultObjectDumpFormatter.GetFormatTabs(num));
                }
                else
                {
                    if (c == DefaultObjectDumpFormatter.TOKEN_INDENT_CLOSE)
                    {
                        num--;
                        if (num < 0)
                        {
                            throw new AWError("DumpFormatter: the indentPos is negative. TOKENS ARE NOT BALANCED!");
                        }
                        stringBuilder.Append(DefaultObjectDumpFormatter.NEW_LINE + DefaultObjectDumpFormatter.GetFormatTabs(num));
                    }
                    else
                    {
                        if (c == DefaultObjectDumpFormatter.TOKEN_DIVIDER)
                        {
                            stringBuilder.Append(DefaultObjectDumpFormatter.NEW_LINE + DefaultObjectDumpFormatter.GetFormatTabs(num));
                        }
                        else
                        {
                            stringBuilder.Append(c);
                        }
                    }
                }
            }
            if (num != 0)
            {
                throw new AWError("DumpFormatter: the indentPos is not == 0. TOKENS ARE NOT BALANCED!");
            }
            return(stringBuilder.ToString());
        }
Beispiel #2
0
 public static string HexDump(ByteArray ba)
 {
     return(DefaultObjectDumpFormatter.HexDump(ba, DefaultObjectDumpFormatter.HEX_BYTES_PER_LINE));
 }
Beispiel #3
0
 private static string GetFormatTabs(int howMany)
 {
     return(DefaultObjectDumpFormatter.StrFill(DefaultObjectDumpFormatter.TAB, howMany));
 }