private bool ApplyEventLogPosition(TechJournalPosition position) { Reset(); if (position == null) { return(false); } int indexOfFileData = Array.IndexOf(_logFilesWithData, position.CurrentFileData); if (indexOfFileData < 0) { throw new Exception("Invalid data file"); } _indexCurrentFile = indexOfFileData; _currentFileEventNumber = position.EventNumber; return(true); }
public void SetCurrentPosition(TechJournalPosition newPosition) { if (ApplyEventLogPosition(newPosition) == false) { return; } InitializeStream(0, _indexCurrentFile); long beginReadPosition = _stream.GetPosition(); long newStreamPosition = Math.Max(beginReadPosition, newPosition.StreamPosition ?? 0); long sourceStreamPosition = newStreamPosition; string currentFilePath = _logFilesWithData[_indexCurrentFile]; FixEventPosition(currentFilePath, ref newStreamPosition, sourceStreamPosition); if (newPosition.StreamPosition != null) { SetCurrentFileStreamPosition(newStreamPosition); } }