protected async Task Initialize() { var headers = new ExeFsHeader[10]; var fileData = new byte[10][]; var hashes = new byte[10][]; await Task.WhenAll(Enumerable.Range(0, 10).Select(async i => { headers[i] = new ExeFsHeader(await ExeFsData.ReadArrayAsync(i * 16, 16).ConfigureAwait(false)); hashes[i] = await ExeFsData.ReadArrayAsync(0xC0 + ((9 - i) * 32), 32).ConfigureAwait(false); // Hashes are stored in reverse order from headers if (headers[i].FileSize > 0) { fileData[i] = await ExeFsData.GetReadOnlyDataReference(headers[i].Offset + 0x200, headers[i].FileSize).ReadArrayAsync().ConfigureAwait(false); } })).ConfigureAwait(false); for (int i = 0; i < headers.Length; i++) { var header = headers[i]; var data = fileData[i]; var hash = hashes[i]; if (header.FileSize > 0) { Files.Add(header.Filename, new ExeFsEntry { RawData = data, Hash = hash }); } } }
public IReadOnlyBinaryDataAccessor GetDataReference(ExeFsHeader header) { return(ExeFsData.GetReadOnlyDataReference(header.Offset + 0x200, header.FileSize)); }