private void GoToEvent_Test(string eventLogPath)
        {
            string dataAfterGoEvent     = string.Empty;
            string dataAfterSetPosition = string.Empty;

            using (EventLogReader reader = EventLogReader.CreateReader(eventLogPath))
            {
                reader.GoToEvent(5);
                EventLogPosition eventPosition = reader.GetCurrentPosition();
                if (reader.Read())
                {
                    dataAfterGoEvent = reader.CurrentRow.Data;
                }

                reader.Reset();

                reader.SetCurrentPosition(eventPosition);
                if (reader.Read())
                {
                    dataAfterSetPosition = reader.CurrentRow.Data;
                }
            }

            Assert.Equal(dataAfterGoEvent, dataAfterSetPosition);
        }
        private void GetAndSetPosition_Test(string eventLogPath)
        {
            long countRecords           = 0;
            long countRecordsStepByStep = 0;
            long countRecordsStepByStepAfterSetPosition = 0;

            using (EventLogReader reader = EventLogReader.CreateReader(eventLogPath))
            {
                countRecords = reader.Count();

                while (reader.Read())
                {
                    countRecordsStepByStep += 1;
                }

                reader.Reset();
                EventLogPosition position = reader.GetCurrentPosition();
                while (reader.Read())
                {
                    ;
                }
                reader.SetCurrentPosition(position);
                while (reader.Read())
                {
                    countRecordsStepByStepAfterSetPosition += 1;
                }
            }

            Assert.NotEqual(0, countRecords);
            Assert.NotEqual(0, countRecordsStepByStep);
            Assert.NotEqual(0, countRecordsStepByStepAfterSetPosition);
            Assert.Equal(countRecords, countRecordsStepByStep);
            Assert.Equal(countRecords, countRecordsStepByStepAfterSetPosition);
        }
        private void SendDataCurrentPortion(EventLogReader reader)
        {
            RiseBeforeExportData(out var cancel);
            if (!cancel)
            {
                UpdateReferences(reader);
                _target.Save(_dataToSend);
                RiseAfterExportData(reader.GetCurrentPosition());
            }

            if (reader.CurrentFile != null)
            {
                _target.SaveLogPosition(
                    new FileInfo(reader.CurrentFile),
                    reader.GetCurrentPosition());
            }
            _dataToSend.Clear();
        }
        private void EventLogReader_AfterReadFile(EventLogReader sender, AfterReadFileEventArgs args)
        {
            FileInfo _lastEventLogDataFileInfo = new FileInfo(args.FileName);

            if (_dataToSend.Count >= 0)
            {
                SendDataCurrentPortion(sender);
            }

            EventLogPosition position = sender.GetCurrentPosition();

            _target.SaveLogPosition(_lastEventLogDataFileInfo, position);
        }