internal SystemLogRecord(BinaryReader reader, byte version, long logPosition) : base(LogRecordType.System, version, logPosition) { if (version != SystemRecordVersion) { throw new ArgumentException(string.Format( "SystemRecord version {0} is incorrect. Supported version: {1}.", version, SystemRecordVersion)); } TimeStamp = new DateTime(reader.ReadInt64()); SystemRecordType = (SystemRecordType)reader.ReadByte(); if (SystemRecordType == SystemRecordType.Invalid) { throw new ArgumentException(string.Format("Invalid SystemRecordType {0} at LogPosition {1}.", SystemRecordType, LogPosition)); } SystemRecordSerialization = (SystemRecordSerialization)reader.ReadByte(); if (SystemRecordSerialization == SystemRecordSerialization.Invalid) { throw new ArgumentException(string.Format("Invalid SystemRecordSerialization {0} at LogPosition {1}.", SystemRecordSerialization, LogPosition)); } Reserved = reader.ReadInt64(); var dataCount = reader.ReadInt32(); Data = dataCount == 0 ? NoData : reader.ReadBytes(dataCount); }
public SystemLogRecord(long logPosition, DateTime timeStamp, SystemRecordType systemRecordType, SystemRecordSerialization systemRecordSerialization, byte[] data) : base(LogRecordType.System, SystemRecordVersion, logPosition) { TimeStamp = timeStamp; SystemRecordType = systemRecordType; SystemRecordSerialization = systemRecordSerialization; Reserved = 0; Data = data ?? NoData; }