Exemple #1
0
        internal void Unserialize(System.IO.BinaryReader reader)
        {
            type = (Type)reader.ReadByte();

            str   = "";
            bdata = new uint[0];
            badd  = new byte[0];
            if (type == Type.String)
            {
                str = ObjLua.ReadString(reader);
            }
            else if (type == Type.Number)
            {
                if (parent.Parent.NumberSize == 8)
                {
                    dval = reader.ReadDouble();
                }
                else if (parent.Parent.NumberSize == 4)
                {
                    dval = reader.ReadSingle();
                }
                else
                {
                    throw new Exception("Number Size " + parent.Parent.NumberSize.ToString() + " is not supported!");
                }
            }
            else if (type == Type.Empty)
            {
            }
            else
            {
                throw new Exception("Unknown Constant Type: 0x" + Helper.HexString((byte)type) + ", 0x" + Helper.HexString(reader.BaseStream.Position - 0x40));
            }
        }
Exemple #2
0
        internal void Unserialize(System.IO.BinaryReader reader)
        {
            contants.Clear();
            functions.Clear();
            codes.Clear();
            srcln.Clear();
            local.Clear();
            upval.Clear();

            name = ObjLua.ReadString(reader);

            linedef = reader.ReadUInt32();
            nups    = reader.ReadByte();
            argc    = reader.ReadByte();
            isinout = reader.ReadByte();
            stacksz = reader.ReadByte();

            uint linenfosz = reader.ReadUInt32();

            for (uint i = 0; i < linenfosz; i++)
            {
                ObjLuaSourceLine item = new ObjLuaSourceLine(this);
                item.Unserialize(reader);

                srcln.Add(item);
            }

            uint locvarsz = reader.ReadUInt32();

            for (uint i = 0; i < locvarsz; i++)
            {
                ObjLuaLocalVar item = new ObjLuaLocalVar(this);
                item.Unserialize(reader);

                local.Add(item);
            }

            uint upvalsz = reader.ReadUInt32();

            for (uint i = 0; i < upvalsz; i++)
            {
                ObjLuaUpValue item = new ObjLuaUpValue(this);
                item.Unserialize(reader);

                upval.Add(item);
            }

            uint constsz = reader.ReadUInt32();

            for (uint i = 0; i < constsz; i++)
            {
                ObjLuaConstant item = new ObjLuaConstant(this);
                item.Unserialize(reader);

                contants.Add(item);
            }

            uint fncsz = reader.ReadUInt32();

            for (uint i = 0; i < fncsz; i++)
            {
                ObjLuaFunction item = new ObjLuaFunction(this.parent);
                item.Unserialize(reader);

                functions.Add(item);
            }

            uint codesz = reader.ReadUInt32();

            for (uint i = 0; i < codesz; i++)
            {
                ObjLuaCode item = ObjLuaCode.Unserialize(reader, this);

                codes.Add(item);
            }
        }
Exemple #3
0
 internal void Unserialize(System.IO.BinaryReader reader)
 {
     name  = ObjLua.ReadString(reader);
     start = reader.ReadUInt32();
     end   = reader.ReadUInt32();
 }