Пример #1
0
 private void RegisterScriptCSPlugin(PluginConfiguration pluginConfiguration)
 {
     kernel.Bind<IPlugin>().To<ScriptCS>().OnActivation((activatedPlugin) =>
     {
         ((dynamic)activatedPlugin).Initialise(pluginConfiguration.Parameters);
         ((dynamic)activatedPlugin).AddParameter("ScriptName", pluginConfiguration.Name);
     });
 }
Пример #2
0
 public void RegisterPlugin(Type[] knownTypes, PluginConfiguration pluginConfiguration, IEnumerable<PluginConfiguration> pluginsConfiguration)
 {
     var plugin = knownTypes.GetType(pluginConfiguration.Name);
     kernel.Bind<IPlugin>().To(plugin).OnActivation((activatedPlugin)=>{
         ((dynamic)activatedPlugin).Initialise(pluginConfiguration.Parameters);
     });
     foreach (var pluginConfig in pluginsConfiguration)
     {
         var openGenericPluginType = typeof(IDependsOnPlugin<>);
         var closedGenericPluginType = openGenericPluginType.MakeGenericType(plugin);
         kernel.Bind(closedGenericPluginType).To(knownTypes.First(x => x.Name == pluginConfig.Name)).OnActivation((activatedPlugin) =>
         {
             ((dynamic)activatedPlugin).Initialise(pluginConfig.Parameters);
         });
     }
 }
Пример #3
0
 public PluginConfiguration()
 {
     DependentPlugins = new PluginConfiguration[] { };
 }