Beispiel #1
0
        public AssetsFile(AssetsFileReader reader)
        {
            this.reader = reader;
            readerPar   = reader.BaseStream;

            header = new AssetsFileHeader();
            header.Read(0, reader);

            typeTree = new TypeTree();
            typeTree.Read(reader.Position, reader, header.format, reader.bigEndian);

            AssetCount = reader.ReadUInt32();
            reader.Align();
            AssetTablePos = Convert.ToUInt32(reader.BaseStream.Position);

            reader.BaseStream.Position += AssetFileInfo.GetSize(header.format) * AssetCount;
            if (header.format > 0x0B)
            {
                preloadTable = new PreloadList();
                preloadTable.Read(reader.Position, reader, header.format, reader.bigEndian);
            }

            dependencies = new AssetsFileDependencyList();
            dependencies.Read(reader.Position, reader, header.format, reader.bigEndian);
        }
Beispiel #2
0
        public AssetsFile(AssetsFileReader reader)
        {
            this.reader = reader;
            readerPar   = reader.BaseStream;

            header = new AssetsFileHeader();
            header.Read(reader);

            typeTree = new TypeTree();
            typeTree.Read(reader, header.format);

            assetCount = reader.ReadUInt32();
            reader.Align();
            assetTablePos = (uint)reader.BaseStream.Position;

            int assetInfoSize = AssetFileInfo.GetSize(header.format);

            if (0x0F <= header.format && header.format <= 0x10)
            {
                //for these two versions, the asset info is not aligned
                //for the last entry, so we have to do some weird stuff
                reader.BaseStream.Position += ((assetInfoSize + 3) >> 2 << 2) * (assetCount - 1) + assetInfoSize;
            }
            else
            {
                reader.BaseStream.Position += AssetFileInfo.GetSize(header.format) * assetCount;
            }
            if (header.format > 0x0B)
            {
                preloadTable = new PreloadList();
                preloadTable.Read(reader);
            }

            dependencies = new AssetsFileDependencyList();
            dependencies.Read(reader);
        }