Ejemplo n.º 1
0
 public PluginStepOptionsBuilder(PluginTypeOptionsBuilder pluginTypeOptionsBuilder,
                                 PluginStepRegistration pluginStepRegistration)
 {
     PluginTypeOptions      = pluginTypeOptionsBuilder;
     PluginStepRegistration = pluginStepRegistration;
     Rank(1);
 }
        public PluginTypeOptionsBuilder HasPlugin <T>() where T : IPlugin
        {
            //var assy = PluginAssemblyRegistration.Assembly;
            //var types = assy.GetTypes().Where(i => i.IsClass && typeof(IPlugin).IsAssignableFrom(i));
            var typeReg = new PluginTypeRegistration(PluginAssemblyRegistration, typeof(T));

            PluginAssemblyRegistration.PluginTypeRegistrations.Add(typeReg);
            var builder = new PluginTypeOptionsBuilder(this, typeReg);

            return(builder);
        }
        public PluginAssemblyOptionsBuilder DiscoverPluginTypes(Action <PluginTypeOptionsBuilder, Type> configurePluginTypeCallback)
        {
            var assy  = PluginAssemblyRegistration.Assembly;
            var types = assy.GetTypes().Where(i => i.IsClass && typeof(IPlugin).IsAssignableFrom(i));

            foreach (var type in types)
            {
                var typeReg = new PluginTypeRegistration(PluginAssemblyRegistration, type);
                this.PluginAssemblyRegistration.PluginTypeRegistrations.Add(typeReg);
                if (configurePluginTypeCallback != null)
                {
                    var builder = new PluginTypeOptionsBuilder(this, typeReg);
                    configurePluginTypeCallback(builder, typeReg.Type);
                }
            }

            return(this);

            //  return true;
        }