Exemplo n.º 1
0
            private void Parse(BinaryReader r)
            {
                myPosition = (uint)r.BaseStream.Position;

                Util.GetOffset(r, out namePosition);

                name     = Util.GetString(r, namePosition);
                nameHash = r.ReadUInt32();
                if (Util.GetOffset(r, out structurePosition))
                {
                    structure = this.owner.structureList.GetFromPosition(structurePosition);
                    if (structure == null)
                    {
                        throw new InvalidDataException(string.Format("Invalid Structure Position: 0x{0:X8}", structurePosition));
                    }
                }
                else
                {
                    structure = null;
                }
                unknown0C = r.ReadUInt32();
                unknown10 = r.ReadUInt32();
                if (!Util.GetOffset(r, out fieldPosition))
                {
                    throw new InvalidDataException("Invalid Field Offset: 0x80000000");
                }
                fieldCount = r.ReadUInt32();
            }
Exemplo n.º 2
0
            private void Parse(BinaryReader r)
            {
                myPosition = (uint)r.BaseStream.Position;

                Util.GetOffset(r, out namePosition);

                name       = Util.GetString(r, namePosition);
                nameHash   = r.ReadUInt32();
                type       = r.ReadUInt32();
                dataOffset = r.ReadUInt32();
                Util.GetOffset(r, out unknown10Position);
            }
Exemplo n.º 3
0
            private void Parse(BinaryReader r)
            {
                myPosition = (uint)r.BaseStream.Position;

                Util.GetOffset(r, out namePosition);

                name      = Util.GetString(r, namePosition);
                nameHash  = r.ReadUInt32();
                unknown08 = r.ReadUInt32();
                size      = r.ReadUInt32();
                Util.GetOffset(r, out fieldTablePosition);
                fieldCount = r.ReadUInt32();
            }
Exemplo n.º 4
0
        public void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            uint magic = r.ReadUInt32();

            if (checking)
            {
                if (magic != FOURCC("DATA"))
                {
                    throw new InvalidDataException(String.Format("Expected magic tag 0x{0:X8}; read 0x{1:X8}; position 0x{2:X8}",
                                                                 FOURCC("DATA"), magic, s.Position));
                }
            }

            version = r.ReadUInt32();

            //dataTablePosition = r.ReadUInt32() + (uint)r.BaseStream.Position - 4;
            if (!Util.GetOffset(r, out dataTablePosition))
            {
                throw new InvalidDataException(String.Concat("Invalid Data Table Position: 0x", dataTablePosition.ToString("X8")));
            }

            int dataCount = r.ReadInt32();

            //structureTablePosition = r.ReadUInt32() + (uint)r.BaseStream.Position - 4;
            if (!Util.GetOffset(r, out structureTablePosition))
            {
                throw new InvalidDataException(String.Concat("Invalid Structure Table Position: 0x", structureTablePosition.ToString("X8")));
            }

            int structureCount = r.ReadInt32();

            // Structure table

            this.structureList = new StructureList(OnResourceChanged, structureTablePosition, structureCount, r);

            this.dataList = new DataList(OnResourceChanged, this, dataCount, r);

            s.Position   = 0;
            this.rawData = r.ReadBytes((int)s.Length);
        }