public bool ParseLog() { if (_parsed) { throw new Exception("ParseLog already called"); } var index = 0x200; //data starts at offset 512 decimal while (index < FileBytes.Length) { var sig = Encoding.GetEncoding(1252).GetString(FileBytes, index, 4); if (sig != "HvLE") { //things arent always HvLE as logs get reused, so check to see if we have another valid header at our current offset break; } var size = BitConverter.ToInt32(FileBytes, index + 4); var buff = new byte[size]; Buffer.BlockCopy(FileBytes, index, buff, 0, size); var tle = new TransactionLogEntry(buff); TransactionLogEntries.Add(tle); index += size; } _parsed = true; return(true); }
public void ParseLog() { if (_parsed) { return; } MaximumSequenceNumber = int.MinValue; var index = 0x200; //data starts at offset 500 decimal while (index < FileBytes.Length) { var sig = Encodings.Encoding1252.GetString(FileBytes, index, 4); if (sig != "HvLE") { //things arent always HvLE as logs get reused, so check to see if we have another valid header at our current offset break; } var size = BitConverter.ToInt32(FileBytes, index + 4); var buff = new byte[size]; Buffer.BlockCopy(FileBytes, index, buff, 0, size); var tle = new TransactionLogEntry(buff); TransactionLogEntries.Add(tle); if (tle.SequenceNumber > MaximumSequenceNumber) { MaximumSequenceNumber = tle.SequenceNumber; } index += size; } _parsed = true; }