internal override void Create(byte[] data) { Bref = new Bref(BitConverter.ToUInt64(data, 0), BitConverter.ToUInt64(data, 8)); Length = BitConverter.ToUInt16(data, 16); RefCount = BitConverter.ToUInt16(data, 18); }
private void VerifyHeader() { var buffer = new byte[UnicodeHeaderLength]; ReadBytes(buffer, 0, 28); Validate.Match(buffer.Segment(0, 4), MagicBytes, "Magic value invalid."); Validate.Match(buffer.Segment(8, 2), MagicClientBytes, "Magic client value invalid."); _fileVersion = BitConverter.ToUInt16(buffer, 10); Validate.Any(_fileVersion, SupportedVersions, "Found unsupported version."); ReadBytes(buffer, 28, (IsAnsi ? AnsiHeaderLength : UnicodeHeaderLength) - 28); var crcPartial = BitConverter.ToUInt32(buffer, 4); Validate.Match(crcPartial, Crc32.Calculate(buffer.Segment(8, 471)), "Partial CRC invalid."); var nbt = new Bref( BitConverter.ToUInt64(buffer, RootOffset + 36), BitConverter.ToUInt64(buffer, RootOffset + 44)); var bbt = new Bref( BitConverter.ToUInt64(buffer, RootOffset + 52), BitConverter.ToUInt64(buffer, RootOffset + 60)); _nbtReader = new BTreeReader<NbtEntry>(_input, (long)nbt.Ib); _bbtReader = new BTreeReader<BbtEntry>(_input, (long)bbt.Ib); _cryptMethod = (CryptMethod)buffer[CryptMethodOffset]; }