Exemplo n.º 1
0
 public void OneTimeSetUp()
 {
     _scheduler        = new ManualTaskScheduler();
     _logSourceFactory = new SimplePluginLogSourceFactory(_scheduler);
     _filesystem       = new InMemoryFilesystem();
     _actionCenter     = new Mock <IActionCenter>();
 }
Exemplo n.º 2
0
 public CustomDataSource(ILogSourceFactoryEx logSourceFactory,
                         ITaskScheduler taskScheduler,
                         DataSource settings,
                         TimeSpan maximumWaitTime)
     : base(taskScheduler, settings, maximumWaitTime)
 {
     _originalLogFile =
         logSourceFactory.CreateCustom(settings.CustomDataSourceId, settings.CustomDataSourceConfiguration,
                                       out _pluginDescription);
     _unfilteredLogFile = new LogSourceProxy(TaskScheduler, MaximumWaitTime);
     OnSingleLineChanged();
     OnUnfilteredLogFileChanged();
 }
Exemplo n.º 3
0
        public DataSources(ILogSourceFactoryEx logSourceFactory,
                           ITaskScheduler taskScheduler,
                           IFilesystem filesystem,
                           IDataSourcesSettings settings,
                           IBookmarks bookmarks)
        {
            _logSourceFactory = logSourceFactory ?? throw new ArgumentNullException(nameof(logSourceFactory));
            _taskScheduler    = taskScheduler;
            _filesystem       = filesystem ?? throw new ArgumentNullException(nameof(filesystem));
            _maximumWaitTime  = TimeSpan.FromMilliseconds(100);
            _syncRoot         = new object();
            _settings         = settings ?? throw new ArgumentNullException(nameof(settings));
            _bookmarks        = new BookmarkCollection(bookmarks, _maximumWaitTime);
            _dataSources      = new List <IDataSource>();
            _dataSourceIds    = new HashSet <DataSourceId>();
            foreach (DataSource dataSource in settings)
            {
                AddDataSource(dataSource);
            }

            foreach (IDataSource dataSource in _dataSources)
            {
                DataSourceId parentId = dataSource.Settings.ParentId;
                if (parentId != DataSourceId.Empty)
                {
                    var parent = _dataSources.FirstOrDefault(x => x.Id == parentId) as MergedDataSource;
                    if (parent != null)
                    {
                        parent.Add(dataSource);
                    }
                    else
                    {
                        Log.WarnFormat("DataSource '{0} ({1})' is assigned a parent '{2}' but we don't know that one",
                                       dataSource.FullFileName,
                                       dataSource.Id,
                                       parentId);
                        // We don't want the rest of the application having to deal with this.
                        // Therefore we'll simply remove the parent link and treat this data
                        // source as any other ungrouped one.
                        dataSource.Settings.ParentId = DataSourceId.Empty;
                    }
                }
            }
        }