Example #1
0
        public BA2DX10FileEntryBuilder(BA2DX10EntryState state, Stream src)
        {
            _state = state;

            var header_size = DDS.HeaderSizeForFormat((DXGI_FORMAT)state.PixelFormat) + 4;

            new BinaryReader(src).ReadBytes((int)header_size);

            _chunks = _state.Chunks.Select(ch => new ChunkBuilder(state, ch, src)).ToList();
        }
Example #2
0
        public static async Task <BA2DX10FileEntryBuilder> Create(BA2DX10EntryState state, Stream src, DiskSlabAllocator slab)
        {
            var builder = new BA2DX10FileEntryBuilder {
                _state = state
            };

            var headerSize = DDS.HeaderSizeForFormat((DXGI_FORMAT)state.PixelFormat) + 4;

            new BinaryReader(src).ReadBytes((int)headerSize);

            // This can't be parallel because it all runs off the same base IO stream.
            builder._chunks = new List <ChunkBuilder>();

            foreach (var chunk in state.Chunks)
            {
                builder._chunks.Add(await ChunkBuilder.Create(state, chunk, src, slab));
            }

            return(builder);
        }