Exemple #1
0
        internal void Serialize(System.IO.BinaryWriter writer)
        {
            writer.Write((byte)type);

            if (type == Type.String)
            {
                ObjLua.WriteString(str, writer);
            }
            else if (type == Type.Number)
            {
                if (parent.Parent.NumberSize == 8)
                {
                    writer.Write((double)dval);
                }
                else if (parent.Parent.NumberSize == 4)
                {
                    writer.Write((float)dval);
                }
                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(writer.BaseStream.Position - 0x40));
            }
        }
Exemple #2
0
        internal void Serialize(System.IO.BinaryWriter writer)
        {
            ObjLua.WriteString(name, writer);

            writer.Write(linedef);
            writer.Write(nups);
            writer.Write(argc);
            writer.Write(isinout);
            writer.Write(stacksz);

            writer.Write((uint)srcln.Count);
            foreach (ObjLuaSourceLine item in srcln)
            {
                item.Serialize(writer);
            }

            writer.Write((uint)local.Count);
            foreach (ObjLuaLocalVar item in local)
            {
                item.Serialize(writer);
            }

            writer.Write((uint)upval.Count);
            foreach (ObjLuaUpValue item in upval)
            {
                item.Serialize(writer);
            }

            writer.Write((uint)contants.Count);
            foreach (ObjLuaConstant item in contants)
            {
                item.Serialize(writer);
            }

            writer.Write((uint)functions.Count);
            foreach (ObjLuaFunction item in functions)
            {
                item.Serialize(writer);
            }

            writer.Write((uint)codes.Count);
            foreach (ObjLuaCode item in codes)
            {
                item.Serialize(writer);
            }
        }
Exemple #3
0
 internal void Serialize(System.IO.BinaryWriter writer)
 {
     ObjLua.WriteString(name, writer);
     writer.Write(start);
     writer.Write(end);
 }