Esempio n. 1
0
        public OutputTransformer(IEnumerable<string> proxies, IPluginScanner scanner)
        {
            var types = scanner.Scan().ToList();

            var instances = types.Select(GetProxyFromType).ToArray();

            foreach (var proxy in proxies)
            {
                if (instances.All(x => !MatchesProxy(x, proxy)))
                {
                    Console.Error.WriteLine("Error: Could not find a proxy named " + proxy);
                    Environment.Exit(ExitCodes.ProxyNotFound);
                }

                this.extensions.Add(instances.First(x => MatchesProxy(x, proxy)));
            }
        }
Esempio n. 2
0
        public OutputTransformer(IEnumerable <string> proxies, IPluginScanner scanner)
        {
            var types = scanner.Scan().ToList();

            var instances = types.Select(GetProxyFromType).ToArray();

            foreach (var proxy in proxies)
            {
                if (instances.All(x => !MatchesProxy(x, proxy)))
                {
                    Console.Error.WriteLine("Error: Could not find a proxy named " + proxy);
                    Environment.Exit(ExitCodes.ProxyNotFound);
                }

                this.extensions.Add(instances.First(x => MatchesProxy(x, proxy)));
            }
        }
Esempio n. 3
0
 public Package(IWindowManager windowManager, IPluginScanner pluginScanner, ITaskManager taskManager)
 {
     this.windowManager = windowManager;
     this.pluginScanner = pluginScanner;
     this.taskManager = taskManager;
 }
Esempio n. 4
0
 public Package(IWindowManager windowManager, IPluginScanner pluginScanner, ITaskManager taskManager)
 {
     this.windowManager = windowManager;
     this.pluginScanner = pluginScanner;
     this.taskManager   = taskManager;
 }
 /// <summary>
 /// It is important to understand that Autofac will provide a new instance of <see cref="ContainerBuilder"/>
 /// for each module registration, and this is why we need to create a fresh instance of ContainerBuilderPluginRegistration
 /// for each module, instead of reusing a single one during the initialization of DI container.
 /// </summary>
 public ContainerBuilderPluginRegistration(ContainerBuilder builder, ILogProvider logProvider, IPluginScanner pluginScanner)
 {
     _builder       = builder;
     _logger        = logProvider.GetLogger("Plugins");
     _pluginScanner = pluginScanner;
 }
        /// <summary>
        /// Initializes a dependency injection container with specified <see cref="IConfiguration"/>.
        /// Registers <see cref="IConfiguration"/> instance to newly created container.
        /// </summary>
        /// <remarks>
        /// <see cref="ILogProvider"/> is not registered to container and is meant to be used during the lifetime of registration and container building process.
        /// <see cref="LegacyUtilities"/> will also be initialized with the given configuration.
        /// </remarks>
        public static ContainerBuilder Create(IConfiguration configuration, ILogProvider logProvider, IPluginScanner pluginScanner)
        {
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterInstance(configuration).ExternallyOwned();

            // make properties accessible to modules which are provided with new/unique instance of ContainerBuilder
            containerBuilder.Properties.Add(nameof(IPluginScanner), pluginScanner);
            containerBuilder.Properties.Add(nameof(ILogProvider), logProvider);
            containerBuilder.Properties.Add(nameof(IConfiguration), configuration);

            // this is a patch/mock to provide backward compatibility for all usages of old static classes
            LegacyUtilities.Initialize(configuration);

            return(containerBuilder);
        }
Esempio n. 7
0
 public PluginsManager(IList <Plugin> hierarchyPlugins, IList <Plugin> functionalPlugins, IPluginScanner pluginScanner)
 {
     HierarchyPlugins  = hierarchyPlugins;
     SerializerPlugins = functionalPlugins;
     PluginScanner     = pluginScanner;
 }