public HTFXRow(BitReader data, IHotfixEntry hotfixEntry) { Data = data; m_hotfixEntry = hotfixEntry; Id = hotfixEntry.RecordId; }
public static RowOp DefaultProcessor(IHotfixEntry row, bool shouldDelete) { if (row.IsValid & row.DataSize > 0) { return(RowOp.Add); } else if (shouldDelete) { return(RowOp.Delete); } else { return(RowOp.Ignore); } }
public HTFXReader(Stream stream) { using (var reader = new BinaryReader(stream, Encoding.UTF8)) { if (reader.BaseStream.Length < HeaderSize) { throw new InvalidDataException("Hotfix file is corrupted!"); } uint magic = reader.ReadUInt32(); if (magic != HTFXFmtSig) { throw new InvalidDataException("Hotfix file is corrupted!"); } Version = reader.ReadInt32(); BuildId = reader.ReadInt32(); // Extended header if (Version >= 5) { if (reader.BaseStream.Length < ExtendedHeaderSize) { throw new InvalidDataException("Hotfix file is corrupted!"); } reader.BaseStream.Position += 32; // sha hash } var readerFunc = GetReaderFunc(); long length = reader.BaseStream.Length; while (reader.BaseStream.Position < length) { magic = reader.ReadUInt32(); if (magic != HTFXFmtSig) { throw new InvalidDataException("Hotfix file is corrupted!"); } IHotfixEntry hotfixEntry = readerFunc.Invoke(reader); BitReader bitReader = new BitReader(reader.ReadBytes(hotfixEntry.DataSize)); HTFXRow rec = new HTFXRow(bitReader, hotfixEntry); _Records.Add(_Records.Count, rec); } } }