public PluginCompilationEngine(
            [NotNull] IStrategiesSourceRepository pluginSourceRepository,
            [NotNull] ICodeEditorService codeEditor,
            [NotNull] IPluginCompiler pluginCompiler,
            [NotNull] IPluginLocator pluginLocator)
        {
            if (pluginSourceRepository == null)
            {
                throw new ArgumentNullException(nameof(pluginSourceRepository));
            }
            if (codeEditor == null)
            {
                throw new ArgumentNullException(nameof(codeEditor));
            }
            if (pluginCompiler == null)
            {
                throw new ArgumentNullException(nameof(pluginCompiler));
            }
            if (pluginLocator == null)
            {
                throw new ArgumentNullException(nameof(pluginLocator));
            }

            _pluginSourceRepository = pluginSourceRepository;
            _codeEditor = codeEditor;
            _pluginCompiler = pluginCompiler;
            _pluginLocator = pluginLocator;
        }
Example #2
0
        public PluginCompilationEngine(
            [NotNull] IStrategiesSourceRepository pluginSourceRepository,
            [NotNull] ICodeEditorService codeEditor,
            [NotNull] IPluginCompiler pluginCompiler,
            [NotNull] IPluginLocator pluginLocator)
        {
            if (pluginSourceRepository == null)
            {
                throw new ArgumentNullException(nameof(pluginSourceRepository));
            }
            if (codeEditor == null)
            {
                throw new ArgumentNullException(nameof(codeEditor));
            }
            if (pluginCompiler == null)
            {
                throw new ArgumentNullException(nameof(pluginCompiler));
            }
            if (pluginLocator == null)
            {
                throw new ArgumentNullException(nameof(pluginLocator));
            }

            _pluginSourceRepository = pluginSourceRepository;
            _codeEditor             = codeEditor;
            _pluginCompiler         = pluginCompiler;
            _pluginLocator          = pluginLocator;
        }
Example #3
0
        private void LoadPluginDll(PluginConfigItem configItem)
        {
            IPluginLocator    theLocator    = PluginLocatorFactory.GetLocator(configItem.QualifiedName.LoadProtocol);
            IList <PluginDll> expandingDlls = new List <PluginDll>();
            IList <PluginDll> _changedList  = new List <PluginDll>();

            for (int i = 0; i < configItem.PluginDlls.Count; i++)
            {
                PluginDll theDll = configItem.PluginDlls[i];
                if (theDll.NewVersion)
                {
                    bool loaded = theLocator.LoadDll(this._pluginContext.PluginContainer.Name, theDll, expandingDlls);

                    if (!loaded)
                    {
                        configItem.Status = PluginConfigItemStatus.LoadPluginDllFailure;
                        break;
                    }
                    else
                    {
                        theDll.NewVersion = false;
                        _changedList.Add(theDll);
                    }
                }
            }

            if (_changedList.Count > 0)
            {
                PluginLocatorBase.SavePluginDllVersion(_changedList);
            }
            foreach (PluginDll expandingDll in expandingDlls)
            {
                if (!PluginLocatorBase.IsInPluginDlls(expandingDll, configItem.PluginDlls))
                {
                    configItem.PluginDlls.Add(expandingDll);
                }
            }
        }
Example #4
0
 public static IServiceCollection AddPluginLocator(this IServiceCollection services, IPluginLocator locator)
 {
     services.AddSingleton <IPluginLocator>(locator);
     return(services);
 }
Example #5
0
 public PluginEngine(IPluginLocator locator)
 {
     PluginLocator = locator;
 }