public void Deserialize(Stream input) { var fileAlignment = input.ReadValueU32(Endian.Little); if (fileAlignment != 0x7FF00000 && fileAlignment != 0x0000F07F && fileAlignment != 0x62300000 && fileAlignment != 0x00003062) { throw new FormatException("unexpected file alignment (should have been 0x7FF00000)"); } this.Endianness = (fileAlignment == 0x7FF00000 || fileAlignment == 0x62300000) ? Endian.Little : Endian.Big; this.FileAlignment = this.Endianness == Endian.Little ? fileAlignment : fileAlignment.Swap(); this.BasePath = input.ReadString(64, true, Encoding.ASCII); var count = input.ReadValueU32(this.Endianness); var hashes = new uint[count]; for (uint i = 0; i < count; i++) { hashes[i] = input.ReadValueU32(this.Endianness); } this.Entries.Clear(); for (uint i = 0; i < count; i++) { var entry = new Big.Entry(); entry.NameHash = hashes[i]; entry.UncompressedSize = input.ReadValueU32(this.Endianness); entry.Offset = input.ReadValueU32(this.Endianness); entry.Locale = input.ReadValueU32(this.Endianness); entry.CompressedSize = input.ReadValueU32(this.Endianness); this.Entries.Add(entry); if (entry.CompressedSize != 0) { throw new NotSupportedException(); } } }
public void Deserialize(Stream input) { var count = input.ReadValueU32(this.Endianness); var hashes = new uint[count]; for (uint i = 0; i < count; i++) { hashes[i] = input.ReadValueU32(this.Endianness); } this.Entries.Clear(); for (uint i = 0; i < count; i++) { var entry = new Big.Entry(); entry.NameHash = hashes[i]; entry.UncompressedSize = input.ReadValueU32(this.Endianness); entry.Offset = input.ReadValueU32(this.Endianness); entry.Locale = input.ReadValueU32(this.Endianness); entry.CompressedSize = input.ReadValueU32(this.Endianness); this.Entries.Add(entry); } }
public void Deserialize(Stream input) { var fileAlignment = input.ReadValueU32(true); if (fileAlignment != 0x7FF00000 && fileAlignment != 0x0000F07F && fileAlignment != 0x62300000 && fileAlignment != 0x00003062) { throw new FormatException("unexpected file alignment (should have been 0x7FF00000)"); } this.LittleEndian = fileAlignment == 0x7FF00000 || fileAlignment == 0x62300000; this.FileAlignment = this.LittleEndian == true ? fileAlignment : fileAlignment.Swap(); this.BasePath = input.ReadString(64, true, Encoding.ASCII); var count = input.ReadValueU32(this.LittleEndian); var hashes = new uint[count]; for (uint i = 0; i < count; i++) { hashes[i] = input.ReadValueU32(this.LittleEndian); } this.Entries.Clear(); for (uint i = 0; i < count; i++) { var entry = new Big.Entry(); entry.NameHash = hashes[i]; entry.UncompressedSize = input.ReadValueU32(this.LittleEndian); entry.Offset = input.ReadValueU32(this.LittleEndian); entry.Locale = input.ReadValueU32(this.LittleEndian); entry.CompressedSize = input.ReadValueU32(this.LittleEndian); this.Entries.Add(entry); if (entry.CompressedSize != 0) { throw new NotSupportedException(); } } }