public PropertyPresenterRegistry(IPluginLoader pluginSystem) { _plugins = pluginSystem.LoadAllOfType <IPropertyPresenterPlugin>(); _wellKnownDisplayNames = new Dictionary <IReadOnlyPropertyDescriptor, string> { { Core.Properties.LogEntryCount, "Count" }, { Core.Properties.TraceLogEntryCount, "Trace Count" }, { Core.Properties.DebugLogEntryCount, "Debug Count" }, { Core.Properties.InfoLogEntryCount, "Info Count" }, { Core.Properties.WarningLogEntryCount, "Warning Count" }, { Core.Properties.ErrorLogEntryCount, "Error Count" }, { Core.Properties.FatalLogEntryCount, "Fatal Count" }, { Core.Properties.OtherLogEntryCount, "Other Count" }, { Core.Properties.Name, "Name" }, { Core.Properties.StartTimestamp, "First Timestamp" }, { Core.Properties.EndTimestamp, "Last Timestamp" }, { Core.Properties.Duration, "Duration" }, { Core.Properties.LastModified, "Last Modified" }, { Core.Properties.Created, "Created" }, { Core.Properties.Size, "Size" }, { Core.Properties.PercentageProcessed, "Processed" }, { Core.Properties.Format, "Format" }, { TextProperties.AutoDetectedEncoding, "Auto Detected Encoding" }, { TextProperties.OverwrittenEncoding, "Overwritten Encoding" }, { TextProperties.Encoding, "Encoding" } }; _wellKnownPresenters = new Dictionary <IReadOnlyPropertyDescriptor, Func <string, IPropertyPresenter> > { { TextProperties.OverwrittenEncoding, displayName => new EncodingPropertyPresenter(displayName) } }; }
public WidgetsSidePanel(IPluginLoader pluginLoader) { _widgets = new List <WidgetFactoryViewModel>(); foreach (var plugin in pluginLoader.LoadAllOfType <IWidgetPlugin>()) { _widgets.Add(new WidgetFactoryViewModel(plugin)); } }
public IReadOnlyList <T> LoadAllOfType <T>() where T : class, IPlugin { if (!_loadedPlugins.TryGetValue(typeof(T), out var plugins)) { plugins = _pluginLoader.LoadAllOfType <T>()?.ToList() ?? new List <T>(); _loadedPlugins.Add(typeof(T), plugins); } return(plugins.OfType <T>().ToList()); }
public ILogEntryParser CreateParser(IServiceContainer services, ILogFileFormat format) { foreach (var plugin in _pluginLoader.LoadAllOfType <ILogEntryParserPlugin>()) { if (TryCreateParser(plugin, services, format, out var parser)) { return(parser); } } return(CreateDefaultParser(services)); }
public DataSourceAnalyserEngine(ITaskScheduler scheduler, ILogAnalyserEngine logAnalyserEngine, IPluginLoader pluginLoader = null) { _scheduler = scheduler ?? throw new ArgumentNullException(nameof(scheduler)); _logAnalyserEngine = logAnalyserEngine ?? throw new ArgumentNullException(nameof(logAnalyserEngine)); _syncRoot = new object(); _dataSourceAnalysers = new List <IDataSourceAnalyser>(); _factoriesById = new Dictionary <AnalyserPluginId, IDataSourceAnalyserPlugin>(); if (pluginLoader != null) { foreach (var plugin in pluginLoader.LoadAllOfType <IDataSourceAnalyserPlugin>()) { RegisterFactory(plugin); } } }
private static IReadOnlyDictionary <LogAnalyserFactoryId, IWidgetPlugin> LoadRelevantPlugins(IPluginLoader pluginLoader) { var plugins = pluginLoader.LoadAllOfType <IWidgetPlugin>(); var pluginsById = new Dictionary <LogAnalyserFactoryId, IWidgetPlugin>(plugins.Count); foreach (var plugin in plugins) { if (!pluginsById.TryGetValue(plugin.AnalyserId, out var existingPlugin)) { pluginsById.Add(plugin.AnalyserId, plugin); } else { Log.WarnFormat("Ignoring plugin {0} with id {1}, there already is another plugin registered with the same id: {2}", plugin.GetType(), plugin.AnalyserId, existingPlugin.GetType()); } } return(pluginsById); }