Example #1
0
        public static ObjectData Read(DataReader reader, ObjectInfo info, int dataOffset)
        {
            ObjectData od = new ObjectData();

            od.ObjectID = info.ObjectID;
            od.TypeID = info.TypeID;
            od.ClassID = info.ClassID;
            od.ScriptTypeIndex = info.ScriptTypeIndex;
            od.IsStripped = info.IsStripped;

            reader.JumpTo(dataOffset + info.ByteStart);
            od.Bytes = reader.ReadBytes(info.ByteSize);

            return od;
        }
Example #2
0
        public static ObjectInfo Read(DataReader reader, bool unity5Formatting)
        {
            ObjectInfo oi = new ObjectInfo();

            if (unity5Formatting) {
                oi.ObjectID = reader.ReadInt64();
            } else {
                oi.ObjectID = reader.ReadInt32();
            }

            oi.ByteStart = reader.ReadInt32();
            oi.ByteSize = reader.ReadInt32();
            oi.TypeID = reader.ReadInt32();
            oi.ClassID = reader.ReadInt16();

            if (unity5Formatting) {
                oi.ScriptTypeIndex = reader.ReadInt16();
                oi.IsStripped = reader.ReadBoolean() ? (short)1 : (short)0;
            } else {
                oi.IsStripped = reader.ReadInt16();
            }

            return oi;
        }