private static Task <MS2Archive> LoadMS2F(MS2CryptoMode cryptoMode, BinaryReader br, string name, MemoryMappedFile dataMemoryMappedFile) { return(Task.Run(async() => { uint unk = br.ReadUInt32(); // TODO: unknown/unused? uint dataCompressedSize = br.ReadUInt32() | br.ReadUInt32(); uint dataEncodedSize = br.ReadUInt32() | br.ReadUInt32(); uint size = br.ReadUInt32() | br.ReadUInt32(); uint compressedSize = br.ReadUInt32() | br.ReadUInt32(); uint encodedSize = br.ReadUInt32() | br.ReadUInt32(); uint fileCount = br.ReadUInt32() | br.ReadUInt32(); uint dataSize = br.ReadUInt32() | br.ReadUInt32(); if (unk != 0) { Logger.Debug($"Archive header unk is \"{unk}\"."); } var header = new MS2SizeHeader(encodedSize, compressedSize, size); var data = new MS2SizeHeader(dataEncodedSize, dataCompressedSize, dataSize); Logger.Verbose($"There are {fileCount} files in the archive."); List <MS2File> files = await LoadFiles(cryptoMode, header, data, fileCount, br, dataMemoryMappedFile).ConfigureAwait(false); var archive = new MS2Archive(cryptoMode, header, data, name, dataMemoryMappedFile, files); return archive; })); }
private static Task <MS2Archive> LoadNS2F(MS2CryptoMode cryptoMode, BinaryReader br, string name, MemoryMappedFile dataMemoryMappedFile) { return(Task.Run(async() => { uint fileCount = br.ReadUInt32(); uint dataCompressedSize = br.ReadUInt32() | br.ReadUInt32(); uint dataEncodedSize = br.ReadUInt32() | br.ReadUInt32(); uint size = br.ReadUInt32() | br.ReadUInt32(); uint compressedSize = br.ReadUInt32() | br.ReadUInt32(); uint encodedSize = br.ReadUInt32() | br.ReadUInt32(); uint dataSize = br.ReadUInt32() | br.ReadUInt32(); var header = new MS2SizeHeader(encodedSize, compressedSize, size); var data = new MS2SizeHeader(dataEncodedSize, dataCompressedSize, dataSize); List <MS2File> files = await LoadFiles(cryptoMode, header, data, fileCount, br, dataMemoryMappedFile).ConfigureAwait(false); var archive = new MS2Archive(cryptoMode, header, data, name, dataMemoryMappedFile, files); return archive; })); }