public void SetTarget(IEventLogOnTarget target)
 {
     _target = target;
     if (_target != null)
     {
         _portionSize = _target.GetPortionSize();
     }
 }
Пример #2
0
 public void SetTarget(IEventLogOnTarget target)
 {
     _target = target;
     if (_target != null)
     {
         _portionSize = _target.GetPortionSize();
         _reader.SetTimeZone(_target.GetTimeZone());
     }
 }
        public static void ExportToTargetStorage(EventLogExportSettings eventLogSettings, IEventLogOnTarget targetStorage)
        {
            if (!Directory.Exists(eventLogSettings.EventLogPath))
            {
                throw new Exception("Каталог данных журнала регистрации не обнаружен.");
            }

            using (EventLogExportMaster exporter = new EventLogExportMaster())
            {
                exporter.SetEventLogPath(eventLogSettings.EventLogPath);
                exporter.SetTarget(targetStorage);

                exporter.BeforeExportData  += BeforeExportData;
                exporter.AfterExportData   += AfterExportData;
                exporter.OnErrorExportData += OnErrorExportData;

                while (exporter.NewDataAvailable())
                {
                    exporter.SendData();
                }
            }
        }