Esempio n. 1
0
        private bool ApplyEventLogPosition(EventLogPosition position)
        {
            Reset();

            if (position == null)
            {
                return(false);
            }

            if (position.CurrentFileReferences != _logFilePath)
            {
                throw new Exception("Invalid data file with references");
            }

            int indexOfFileData = Array.IndexOf(_logFilesWithData, position.CurrentFileData);

            if (indexOfFileData < 0)
            {
                throw new Exception("Invalid data file");
            }

            _indexCurrentFile       = indexOfFileData;
            _currentFileEventNumber = position.EventNumber;

            return(true);
        }
        public override void SetCurrentPosition(EventLogPosition newPosition)
        {
            Reset();

            if (newPosition.CurrentFileReferences != _logFilePath)
            {
                throw new Exception("Invalid data file with references");
            }

            int indexOfFileData = Array.IndexOf(_logFilesWithData, newPosition.CurrentFileData);

            if (indexOfFileData < 0)
            {
                throw new Exception("Invalid data file");
            }
            _indexCurrentFile = indexOfFileData;

            _currentFileEventNumber = newPosition.EventNumber;

            InitializeStream(_defaultBeginLineForLGF, _indexCurrentFile);
            long beginReadPosition = _stream.GetPosition();

            long newStreamPosition = (long)newPosition.StreamPosition;

            if (newStreamPosition < beginReadPosition)
            {
                newStreamPosition = beginReadPosition;
            }

            if (newPosition.StreamPosition != null)
            {
                SetCurrentFileStreamPosition(newStreamPosition);
            }
        }
Esempio n. 3
0
        public override void SetCurrentPosition(EventLogPosition newPosition)
        {
            if (newPosition.CurrentFileReferences != _logFilePath)
            {
                throw new Exception("Invalid data file with references");
            }

            if (newPosition.CurrentFileData != _logFilePath)
            {
                throw new Exception("Invalid data file with references");
            }

            GoToEvent(newPosition.EventNumber);
        }
Esempio n. 4
0
        public override void SetCurrentPosition(EventLogPosition newPosition)
        {
            if (ApplyEventLogPosition(newPosition) == false)
            {
                return;
            }

            InitializeStream(DefaultBeginLineForLgf, _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);
            }
        }
 public virtual void SetCurrentPosition(EventLogPosition newPosition)
 {
     throw new NotImplementedException();
 }