Exemple #1
0
 public static pyBin Load(BinaryReader read, PyCodeObjectType ty, int bytes)
 {
     try { return(new pyBin()
         {
             pyType = ty, raw_value = read.ReadBytes(bytes)
         }); }
     catch (EndOfStreamException) { return(null); }
 }
Exemple #2
0
        public static pyString Load(BinaryReader read, PyCodeObjectType type)
        {
            UInt32 length = 0;

            try { length = read.ReadUInt32(); }
            catch (EndOfStreamException) { return(null); }
            if (length < 0)
            {
                return(null);
            }
            pyString tmp_str = new pyString(type);

            if (length > 0)
            {
                try { tmp_str.raw_value = read.ReadBytes((int)length); }
                catch (EndOfStreamException) { return(null); }
            }
            return(tmp_str);
        }
Exemple #3
0
        public static pyShortStr Load(BinaryReader read, PyCodeObjectType type)
        {
            ushort length = 0;

            try { length = read.ReadUInt16(); }
            catch (EndOfStreamException) { return(null); }
            if (length < 0)
            {
                return(null);
            }
            pyShortStr tmp_str = new pyShortStr();

            tmp_str.__pytype = type;
            if (length > 0)
            {
                try { tmp_str.raw_value = read.ReadBytes((int)length); }
                catch (EndOfStreamException) { return(null); }
            }
            return(tmp_str);
        }
Exemple #4
0
        public static pyList Load(BinaryReader read, PyCodeObjectType type)
        {
            UInt32 size = 0;

            try { size = read.ReadUInt32(); }
            catch (EndOfStreamException) { return(null); }

            pyList tmp = new pyList()
            {
                pyType = type
            };

            for (int i = 0; i < size; i++)
            {
                var obj = pyObject.Load(read);
                if (obj == null)
                {
                    break;
                }
                tmp.Add(obj);
            }
            return(tmp);
        }
Exemple #5
0
 public pyString(PyCodeObjectType ty)
 {
     __pytype = ty;
 }