示例#1
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PyPackedRow " + RawData.Length + " bytes]");
     if (Descriptor != null)
     {
         printer.indentLevel++;
         if (Descriptor.Columns != null)
         {
             foreach (var column in Descriptor.Columns)
             {
                 int   index = Descriptor.Columns.FindIndex(x => x.Name == column.Name);
                 PyRep value = values[index];
                 printer.addLine("[\"" + column.Name + "\" => " + " [" + column.Type + "] " + value + "]");
             }
         }
         else
         {
             printer.addLine("[Columns parsing failed!]");
         }
         printer.indentLevel--;
     }
     else
     {
         if (DescriptorObj != null)
         {
             printer.addItem(DescriptorObj);
         }
         else
         {
             printer.indentLevel++;
             printer.addLine("Error.. Obj missing.");
             printer.indentLevel--;
         }
     }
 }
示例#2
0
 public override void dump(PrettyPrinter printer)
 {
     if (RawData != null)
     {
         printer.addLine("[PySubStream " + RawData.Length + " bytes]");
     }
     else
     {
         printer.addLine("[PySubStream]");
     }
     printer.addItem(Data);
 }
示例#3
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PyPacket typeID=" + packetType + "  userID=" + userID + "  name='" + typeString + "']");
     printer.indentLevel++;
     printer.addLine("Source:");
     printer.addItem(source);
     printer.addLine("Destination:");
     printer.addItem(dest);
     printer.addLine("Payload:");
     printer.addItem(payload);
     printer.addLine("Named Payload:");
     printer.addItem(namedPayload);
     printer.indentLevel--;
 }
示例#4
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PyTuple " + Items.Count + " items]" + PrettyPrinter.PrintRawData(this));
     foreach (var item in Items)
     {
         if (item != null)
         {
             printer.addItem(item);
         }
         else
         {
             printer.addLine("<nullptr>");
         }
     }
 }
示例#5
0
        public override void dump(PrettyPrinter printer)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("[PyAddress " + addrType.ToString());
            string sep = ": ";

            if (addrType != PyAddressType.Broadcast)
            {
                if (callID > 0)
                {
                    builder.Append(sep + "callID=" + callID);
                    sep = ", ";
                }
                if (service != null && service.Length > 0)
                {
                    builder.Append(sep + "service='" + service + "'");
                    sep = ", ";
                }
            }
            switch (addrType)
            {
            case PyAddressType.Node:
            case PyAddressType.Client:
                builder.Append(sep + "nodeID=" + addrID);
                break;

            case PyAddressType.Broadcast:
                builder.Append(sep + "broadcastType='" + broadcastType + "', idType='" + service + "'");
                break;
            }
            builder.Append("]");
            printer.addLine(builder.ToString());
        }
示例#6
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PyList " + Items.Count + " items]" + PrettyPrinter.PrintRawData(this));
     foreach (var item in Items)
     {
         printer.addItem(item);
     }
 }
示例#7
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PyDict " + Dictionary.Count + " kvp]" + PrettyPrinter.PrintRawData(this));
     printer.indentLevel++;
     foreach (var kvp in Dictionary)
     {
         printer.addLine("Key:");
         printer.addItem(kvp.Key);
         if (kvp.Value == null)
         {
             printer.addLine("Value: <nullptr>");
         }
         else
         {
             printer.addLine("Value:");
             printer.addItem(kvp.Value);
         }
     }
     printer.indentLevel--;
 }
示例#8
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PyBuffer " + Data.Length + " bytes]" + PrettyPrinter.PrintRawData(this));
     if (Data != null && (Data[0] == Unmarshal.HeaderByte || Data[0] == Unmarshal.ZlibMarker || Data[0] == 0x63))
     {
         byte[] d = Data;
         if (d[0] == Unmarshal.ZlibMarker)
         {
             d = Zlib.Decompress(d);
         }
         if (d != null && (d[0] == Unmarshal.PythonMarker || d[0] == 0x63) && printer.decompilePython && d.Length > 60)
         {
             // We have a python file.
             Bytecode code = new Bytecode();
             if (code.load(d, d[0] == 0x63))
             {
                 Python.PrettyPrinter pp = new Python.PrettyPrinter();
                 pp.indentLevel = printer.indentLevel + 1;
                 pp.indent      = printer.indent;
                 code.dump(pp);
                 printer.addLine(pp.dump);
             }
         }
         else if (d != null && d[0] == Unmarshal.HeaderByte)
         {
             Unmarshal un  = new Unmarshal();
             PyRep     rep = un.Process(d);
             if (rep != null)
             {
                 if (Data[0] == Unmarshal.ZlibMarker)
                 {
                     printer.addLine("<compressed-data>");
                 }
                 printer.addItem(rep);
             }
         }
     }
 }
示例#9
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PyObjectEx " + (IsType2 ? "Type2" : "Normal") + "]" + PrettyPrinter.PrintRawData(this));
     printer.indentLevel++;
     printer.addLine("Header:");
     printer.addItem(Header);
     printer.addLine("List:");
     foreach (var item in List)
     {
         printer.addItem(item);
     }
     printer.addLine("Dictionary:");
     foreach (var kvp in Dictionary)
     {
         printer.indentLevel++;
         printer.addLine("Key:");
         printer.addItem(kvp.Key);
         printer.addLine("Value:");
         printer.addItem(kvp.Value);
         printer.indentLevel--;
     }
     printer.indentLevel--;
 }
示例#10
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PyObject Name: " + Name + "]" + PrettyPrinter.PrintRawData(this));
     printer.addItem(Arguments);
 }
示例#11
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PyInt " + Value + "]");
 }
示例#12
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PyToken " + Token + "]" + PrettyPrinter.PrintRawData(this));
 }
示例#13
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PyChecksumedStream Checksum: " + Checksum + "]");
     printer.addItem(Data);
 }
示例#14
0
        public override void dump(PrettyPrinter printer)
        {
            string name = "Unknown";

            if (opCode == MarshalOpcode.StringEmpty)
            {
                name = "PyStringEmpty";
            }
            else if (opCode == MarshalOpcode.StringChar)
            {
                name = "PyStringChar";
            }
            else if (opCode == MarshalOpcode.WStringUTF8)
            {
                name = "PyWStringUTF8";
            }
            else if (opCode == MarshalOpcode.WStringUCS2Char)
            {
                name = "PyWStringUCS2Char";
            }
            else if (opCode == MarshalOpcode.WStringEmpty)
            {
                name = "PyWStringEmpty";
            }
            else if (opCode == MarshalOpcode.WStringUCS2)
            {
                name = "PyWStringUCS2";
            }
            else if (opCode == MarshalOpcode.StringShort)
            {
                name = "PyString";
            }
            else if (opCode == MarshalOpcode.StringLong)
            {
                name = "PyString";
            }
            else if (opCode == MarshalOpcode.StringTable)
            {
                name = "PyStringTable[" + tableIndex.ToString() + "]";
            }

            bool printed = false;

            if (Raw.Length > 0 && (Raw[0] == (byte)Unmarshal.ZlibMarker || Raw[0] == (byte)Unmarshal.HeaderByte || Raw[0] == Unmarshal.PythonMarker || Raw[0] == 0x63))
            {
                // We have serialized python data, decode and display it.
                byte[] d = Raw;
                if (d[0] == Unmarshal.ZlibMarker)
                {
                    d = Zlib.Decompress(d);
                }
                if (d != null && (d[0] == Unmarshal.PythonMarker || d[0] == 0x63) && printer.decompilePython && d.Length > 60)
                {
                    // We have a python file.
                    Bytecode code = new Bytecode();
                    if (code.load(d, d[0] == 0x63))
                    {
                        printer.addLine("[" + name);
                        Python.PrettyPrinter pp = new Python.PrettyPrinter();
                        pp.indent      = printer.indent;
                        pp.indentLevel = printer.indentLevel + 1;
                        code.dump(pp);
                        printer.addLine(pp.dump);
                        printer.addLine("]");
                        printed = true;
                    }
                }
                else if (d != null && d[0] == Unmarshal.HeaderByte)
                {
                    Unmarshal un = new Unmarshal();
                    un.analizeInput = decodedAnalized;
                    PyRep obj = un.Process(d);
                    if (obj != null)
                    {
                        string sType = "<serialized>";
                        if (Raw[0] == Unmarshal.ZlibMarker)
                        {
                            sType = "<serialized-compressed>";
                        }
                        printer.addLine("[" + name + " " + sType);
                        printer.addItem(obj);
                        printer.addLine("]");
                        printed = true;
                    }
                }
            }
            if (!printed)
            {
                if (!PrettyPrinter.containsBinary(Raw))
                {
                    printer.addLine("[" + name + " \"" + Value + "\"]");
                }
                else
                {
                    printer.addLine("[" + name + " \"" + Value + "\"");
                    printer.indentLevel += 2;
                    printer.addLine("<binary len=" + Value.Length + "> hex=\"" + PrettyPrinter.ByteArrayToString(Raw) + "\"]");
                    printer.indentLevel -= 2;
                }
            }
        }
示例#15
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine(PrettyPrinter.PrintRawData(this));
 }
示例#16
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PyNone]");
 }
示例#17
0
 public override void dump(PrettyPrinter printer)
 {
     printer.addLine("[PySubStruct]");
     printer.addItem(Definition);
 }