public static CodeGenerator CodeGeneratorFromPreferences(Preferences preferences)
        {
            var config = new CodeGeneratorConfig();

            config.Configure(preferences);

            var types = LoadTypesFromPlugins(preferences);

            var dataProviders  = GetEnabledInstances <ICodeGeneratorDataProvider>(types, config.dataProviders);
            var codeGenerators = GetEnabledInstances <ICodeGenerator>(types, config.codeGenerators);
            var postProcessors = GetEnabledInstances <ICodeGenFilePostProcessor>(types, config.postProcessors);

            configure(dataProviders, preferences);
            configure(codeGenerators, preferences);
            configure(postProcessors, preferences);

            return(new CodeGenerator(dataProviders, codeGenerators, postProcessors));
        }
        public static CodeGenerator CodeGeneratorFromPreferences(Preferences preferences)
        {
            ICodeGenerationPlugin[] instances           = CodeGeneratorUtil.LoadFromPlugins(preferences);
            CodeGeneratorConfig     codeGeneratorConfig = preferences.CreateAndConfigure <CodeGeneratorConfig>();

            IPreProcessor[]  enabledInstancesOf  = CodeGeneratorUtil.GetEnabledInstancesOf <IPreProcessor>(instances, codeGeneratorConfig.preProcessors);
            IDataProvider[]  enabledInstancesOf2 = CodeGeneratorUtil.GetEnabledInstancesOf <IDataProvider>(instances, codeGeneratorConfig.dataProviders);
            ICodeGenerator[] enabledInstancesOf3 = CodeGeneratorUtil.GetEnabledInstancesOf <ICodeGenerator>(instances, codeGeneratorConfig.codeGenerators);
            IPostProcessor[] enabledInstancesOf4 = CodeGeneratorUtil.GetEnabledInstancesOf <IPostProcessor>(instances, codeGeneratorConfig.postProcessors);
            CodeGeneratorUtil.configure(enabledInstancesOf, preferences);
            CodeGeneratorUtil.configure(enabledInstancesOf2, preferences);
            CodeGeneratorUtil.configure(enabledInstancesOf3, preferences);
            CodeGeneratorUtil.configure(enabledInstancesOf4, preferences);
            bool trackHooks = true;

            if (preferences.HasKey("Jenny.TrackHooks"))
            {
                trackHooks = (preferences["Jenny.TrackHooks"] == "true");
            }
            return(new CodeGenerator(enabledInstancesOf, enabledInstancesOf2, enabledInstancesOf3, enabledInstancesOf4, trackHooks));
        }
 public static Dictionary <string, string> GetDefaultProperties(ICodeGenerationPlugin[] instances, CodeGeneratorConfig config)
 {
     return(new Dictionary <string, string>().Merge((from instance in CodeGeneratorUtil.GetEnabledInstancesOf <IPreProcessor>(instances, config.preProcessors).OfType <IConfigurable>().Concat(CodeGeneratorUtil.GetEnabledInstancesOf <IDataProvider>(instances, config.dataProviders).OfType <IConfigurable>())
                                                     .Concat(CodeGeneratorUtil.GetEnabledInstancesOf <ICodeGenerator>(instances, config.codeGenerators).OfType <IConfigurable>())
                                                     .Concat(CodeGeneratorUtil.GetEnabledInstancesOf <IPostProcessor>(instances, config.postProcessors).OfType <IConfigurable>())
                                                     select instance.defaultProperties).ToArray()));
 }