Example #1
0
        protected override void run()
        {
            var config = new CodeGeneratorConfig();

            config.Configure(_preferences);

            var cliConfig = new CLIConfig();

            cliConfig.Configure(_preferences);

            fabl.Debug(_preferences.ToString());

            Type[] types = null;
            Dictionary <string, string> defaultProperties = null;

            try {
                types             = CodeGeneratorUtil.LoadTypesFromPlugins(_preferences);
                defaultProperties = CodeGeneratorUtil.GetDefaultProperties(types, config);
            } catch (Exception ex) {
                printKeyStatus(config.defaultProperties.Keys.ToArray(), cliConfig, _preferences);
                throw ex;
            }

            var requiredKeys = config.defaultProperties
                               .Merge(cliConfig.defaultProperties)
                               .Merge(defaultProperties).Keys.ToArray();

            printKeyStatus(requiredKeys, cliConfig, _preferences);
            printPluginStatus(types, config);
            printCollisions(config);
        }
Example #2
0
        void drawConfigurables()
        {
            var defaultProperties = CodeGeneratorUtil.GetDefaultProperties(_types, _codeGeneratorConfig);

            _preferences.AddProperties(defaultProperties, false);

            foreach (var kv in defaultProperties.OrderBy(kv => kv.Key))
            {
                _preferences[kv.Key] = EditorGUILayout.TextField(kv.Key.ShortTypeName().ToSpacedCamelCase(), _preferences[kv.Key]);
            }
        }
Example #3
0
        public override void Initialize(Preferences preferences)
        {
            _preferences         = preferences;
            _codeGeneratorConfig = new CodeGeneratorConfig();
            preferences.AddProperties(_codeGeneratorConfig.defaultProperties, false);
            _codeGeneratorConfig.Configure(preferences);

            _types = CodeGeneratorUtil.LoadTypesFromPlugins(preferences);

            setTypesAndNames <ICodeGeneratorDataProvider>(_types, out _availableDataProviderTypes, out _availableDataProviderNames);
            setTypesAndNames <ICodeGenerator>(_types, out _availableGeneratorTypes, out _availableGeneratorNames);
            setTypesAndNames <ICodeGenFilePostProcessor>(_types, out _availablePostProcessorTypes, out _availablePostProcessorNames);

            _preferences.AddProperties(CodeGeneratorUtil.GetDefaultProperties(_types, _codeGeneratorConfig), false);
        }
Example #4
0
        static bool fix(HashSet <string> askedRemoveKeys, HashSet <string> askedAddKeys, Type[] types, CodeGeneratorConfig config, CLIConfig cliConfig, Preferences preferences)
        {
            var changed = fixPlugins(askedRemoveKeys, askedAddKeys, types, config, preferences);

            changed |= fixCollisions(askedAddKeys, config, preferences);

            forceAddKeys(CodeGeneratorUtil.GetDefaultProperties(types, config), preferences);

            var requiredKeys = config.defaultProperties
                               .Merge(cliConfig.defaultProperties)
                               .Merge(CodeGeneratorUtil.GetDefaultProperties(types, config)).Keys.ToArray();

            removeUnusedKeys(askedRemoveKeys, requiredKeys, cliConfig, preferences);

            return(changed);
        }