Ejemplo n.º 1
0
        public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
        {
            if (op == MarshalOpcode.ObjectEx2)
                IsType2 = true;

            Dictionary = new Dictionary<PyObject, PyObject>();
            List = new List<PyObject>();
            Header = context.ReadObject(source);

            while (source.BaseStream.Position < source.BaseStream.Length)
            {
                var b = source.ReadByte();
                if (b == PackedTerminator)
                    break;
                source.BaseStream.Seek(-1, SeekOrigin.Current);
                List.Add(context.ReadObject(source));
            }

            while (source.BaseStream.Position < source.BaseStream.Length)
            {
                var b = source.ReadByte();
                if (b == PackedTerminator)
                    break;
                source.BaseStream.Seek(-1, SeekOrigin.Current);
                var key = context.ReadObject(source);
                var value = context.ReadObject(source);
                Dictionary.Add(key, value);
            }
        }
Ejemplo n.º 2
0
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     uint len = source.ReadSizeEx();
     RawData = source.ReadBytes((int) len);
     DataUnmarshal = new Unmarshal();
     Data = DataUnmarshal.Process(RawData);
 }
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     if (op == MarshalOpcode.RealZero)
         Value = 0.0d;
     else
         Value = source.ReadDouble();
 }
        public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
        {
            var nameObject = context.ReadObject(source);
            if (nameObject.Type != PyObjectType.String)
                throw new DataException("Expected PyString");
            Name = (nameObject as PyString).Value;

            Arguments = context.ReadObject(source);
        }
Ejemplo n.º 5
0
        public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
        {
            context.NeedObjectEx = true;
            Header = context.ReadObject(source);
            context.NeedObjectEx = false;
            RawData = LoadZeroCompressed(source);

            if (!ParseRowData(context, source))
                 throw new InvalidDataException("Could not fully unpack PackedRow, stream integrity is broken");
        }
Ejemplo n.º 6
0
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     var entries = source.ReadSizeEx();
     Dictionary = new Dictionary<PyObject, PyObject>((int)entries);
     for (uint i = 0; i < entries; i++)
     {
         var value = context.ReadObject(source);
         var key = context.ReadObject(source);
         Dictionary.Add(key, value);
     }
 }
        public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
        {
            switch (op)
            {
                case MarshalOpcode.BoolTrue:
                    Value = true;
                    break;

                case MarshalOpcode.BoolFalse:
                    Value = false;
                    break;
            }
        }
Ejemplo n.º 8
0
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     if (op == MarshalOpcode.IntegerOne)
         Value = 1;
     else if (op == MarshalOpcode.IntegerZero)
         Value = 0;
     else if (op == MarshalOpcode.IntegerMinusOne)
         Value = -1;
     else if (op == MarshalOpcode.IntegerByte)
         Value = source.ReadByte();
     else if (op == MarshalOpcode.IntegerSignedShort)
         Value = source.ReadInt16();
     else if (op == MarshalOpcode.IntegerLong)
         Value = source.ReadInt32();
 }
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     if (op == MarshalOpcode.StringEmpty)
         Update(new byte[0]);
     else if (op == MarshalOpcode.StringChar)
         Update(new[]{source.ReadByte()});
     else if (op == MarshalOpcode.WStringUTF8)
         UpdateUTF8(source.ReadBytes((int)source.ReadSizeEx()));
     else if (op == MarshalOpcode.WStringUCS2Char)
         Update(new[]{source.ReadByte(), source.ReadByte()}, true);
     else if (op == MarshalOpcode.WStringEmpty)
         Update(new byte[0]);
     else if (op == MarshalOpcode.WStringUCS2)
         Update(source.ReadBytes((int)source.ReadSizeEx()), true);
     else if (op == MarshalOpcode.StringShort)
         Update(source.ReadBytes(source.ReadByte()));
     else if (op == MarshalOpcode.StringLong)
         Update(source.ReadBytes((int)source.ReadSizeEx()));
     else if (op == MarshalOpcode.StringTable)
     {
         byte index = source.ReadByte();
         Update(StringTable.Entries[index-1]);
     }
 }
Ejemplo n.º 10
0
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     Definition = context.ReadObject(source);
 }
Ejemplo n.º 11
0
        public override void Decode(Unmarshal context, MarshalOpcode op)
        {
            var len = context.reader.ReadSizeEx();

            Raw = context.reader.ReadBytes((int)len);
        }
Ejemplo n.º 12
0
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     byte len = source.ReadByte();
     RawToken = source.ReadBytes(len);
     Token = Encoding.ASCII.GetString(RawToken);
 }
Ejemplo n.º 13
0
 public static void WriteOpcode(this BinaryWriter w, MarshalOpcode op)
 {
     w.Write((byte)op);
 }
Ejemplo n.º 14
0
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
 }
Ejemplo n.º 15
0
        public override void Decode(Unmarshal context, MarshalOpcode op)
        {
            var size = context.reader.ReadSizeEx();

            Data = context.reader.ReadBytes((int)size);
        }
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     Checksum = source.ReadUInt32();
     Data     = context.ReadObject(source);
 }
Ejemplo n.º 17
0
 public override void Decode(Unmarshal context, MarshalOpcode op)
 {
     Value = context.reader.ReadInt64();
 }
Ejemplo n.º 18
0
        public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
        {
            var len = source.ReadSizeEx();

            Raw = source.ReadBytes((int)len);
        }
Ejemplo n.º 19
0
        public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
        {
            var size = source.ReadSizeEx();

            Data = source.ReadBytes((int)size);
        }
Ejemplo n.º 20
0
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
 }
 private void WriteOpcode(MarshalOpcode op)
 {
     _writer.Write((byte)op);
 }
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 23
0
 public MarshalAs(MarshalOpcode opcode)
 {
     Opcode = opcode;
 }
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     Checksum = source.ReadUInt32();
     Data = context.ReadObject(source);
 }
Ejemplo n.º 25
0
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     Value = source.ReadInt64();
 }
Ejemplo n.º 26
0
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     Definition = context.ReadObject(source);
 }
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     var size = source.ReadSizeEx();
     Data = source.ReadBytes((int)size);
 }
Ejemplo n.º 28
0
 public override void Decode(Unmarshal context, MarshalOpcode op)
 {
 }
Ejemplo n.º 29
0
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 30
0
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     Value = source.ReadInt64();
 }
Ejemplo n.º 31
0
 public abstract void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source);
 public MarshalAs(MarshalOpcode opcode)
 {
     Opcode = opcode;
 }
Ejemplo n.º 33
0
 public override void Decode(Unmarshal context, MarshalOpcode op)
 {
     throw new InvalidOperationException("Function Not Implemented.");
 }
 public override void Decode(Unmarshal context, MarshalOpcode op, BinaryReader source)
 {
     var len = source.ReadSizeEx();
     Raw = source.ReadBytes((int) len);
 }
 public static void WriteOpcode(this BinaryWriter w, MarshalOpcode op)
 {
     w.Write((byte) op);
 }