예제 #1
0
        /// <summary>
        /// Apply changed settings
        /// </summary>
        public void ApplyChanges(ClassRepo repo)
        {
            string newCrlf = string.Empty;              // Default

            if (radio1.Checked)
            {
                newCrlf = "true";
            }
            if (radio2.Checked)
            {
                newCrlf = "input";
            }
            if (radio3.Checked)
            {
                newCrlf = "false";
            }
            if (radio4.Checked)
            {
                newCrlf = string.Empty;                 // This value will remove the setting
            }
            if (newCrlf != crlf)
            {
                ClassConfig.SetLocal(repo, "core.autocrlf", newCrlf);
            }
        }
예제 #2
0
        protected override void ProcessInternal(INamedTypeSymbol symbol, PolicyConfig policyConfig, IViolationReporter violationReporter)
        {
            ClassConfig config = policyConfig.StructConfig;

            if (!AnyVisibilityMatches(symbol.DeclaredAccessibility, config.VisibilitiesToCheck))
            {
                return;
            }

            IDocumentationComment classDocumentation = symbol.GetDocumentationComment();

            if (config.SampleDocumentationRequired && string.IsNullOrWhiteSpace(classDocumentation.ExampleText))
            {
                violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingSampleDocumentation, symbol));
            }

            if (config.SummaryDocumentationRequired && string.IsNullOrWhiteSpace(classDocumentation.SummaryText))
            {
                violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingSummaryDocumentation, symbol));
            }

            if (!symbol.TypeParameters.IsEmpty && config.GenericParameterDocumentationRequired)
            {
                foreach (ITypeParameterSymbol typeParameter in symbol.TypeParameters)
                {
                    if (string.IsNullOrWhiteSpace(classDocumentation.GetTypeParameterText(typeParameter.Name)))
                    {
                        violationReporter.Report(ViolationFromSymbol(string.Format(ViolationMessage.MissingTypeParameter, typeParameter.Name), symbol));
                    }
                }
            }

            ProcessChildren(symbol, policyConfig, violationReporter);
        }
예제 #3
0
 public ClassRuntime(ClassSystem owner, ClassConfig config)
 {
     this.owner       = owner;
     this.Name        = config.Name;
     this.assetName   = config.name;
     this.Description = config.Description;
 }
예제 #4
0
 private void Set(ClassConfig classConfig, FactoryAttribute attribute)
 {
     if (attribute is ClassConfigAttribute cca)
     {
         cca.SetConfigValue(classConfig);
     }
 }
예제 #5
0
        /// <summary>
        /// Initialize pertinent settings
        /// </summary>
        public void Init(ClassRepo repo)
        {
            textBoxUserName.Text  = ClassConfig.GetLocal(repo, "user.name");
            textBoxUserEmail.Text = ClassConfig.GetLocal(repo, "user.email");

            // Add the dirty (modified) value changed helper
            textBoxUserName.TextChanged  += ControlDirtyHelper.ControlDirty;
            textBoxUserEmail.TextChanged += ControlDirtyHelper.ControlDirty;
        }
예제 #6
0
        void IPolicyConfigControl.WriteToConfig(PolicyConfig config)
        {
            ClassConfig controlConfig = GetConfig(config);

            controlConfig.VisibilitiesToCheck = Visibilities.GetVisibilites();
            controlConfig.GenericParameterDocumentationRequired = GenericParametersOptionCheckBox.Checked;
            controlConfig.SampleDocumentationRequired           = SampleDocumentationTagCheckBox.Checked;
            controlConfig.SummaryDocumentationRequired          = SummaryDocumentationTagCheckBox.Checked;
        }
예제 #7
0
        void IPolicyConfigControl.ReadFromConfig(PolicyConfig config)
        {
            ClassConfig controlConfig = GetConfig(config);

            Visibilities.Bind(controlConfig.VisibilitiesToCheck);
            GenericParametersOptionCheckBox.Checked = controlConfig.GenericParameterDocumentationRequired;
            SampleDocumentationTagCheckBox.Checked  = controlConfig.SampleDocumentationRequired;
            SummaryDocumentationTagCheckBox.Checked = controlConfig.SummaryDocumentationRequired;
        }
예제 #8
0
        /// <summary>
        /// Initialize pertinent settings
        /// </summary>
        /// <param name="options">All git global settings</param>
        public void Init(string[] options)
        {
            textBoxUserName.Text  = ClassConfig.GetGlobal("user.name");
            textBoxUserEmail.Text = ClassConfig.GetGlobal("user.email");

            // Add the dirty (modified) value changed helper
            textBoxUserName.TextChanged  += ControlDirtyHelper.ControlDirty;
            textBoxUserEmail.TextChanged += ControlDirtyHelper.ControlDirty;
        }
예제 #9
0
        public void ApplyAttibuteSetting(ClassConfig classConfig)
        {
            foreach (var attr in classConfig.Attributes)
            {
                Set(classConfig, attr);
            }

            classConfig.FilterRuleAttributes = classConfig.FilterRuleAttributes.OrderBy(f => f.Index).ToList();
            classConfig.ConfigLength         = classConfig.FilterRuleAttributes.Count();
        }
예제 #10
0
        /// <summary>
        /// Apply changed settings
        /// </summary>
        public void ApplyChanges()
        {
            if (textBoxUserName.Tag != null)
            {
                ClassConfig.SetGlobal("user.name", textBoxUserName.Text.Trim());
                textBoxUserName.Tag = null;
            }

            if (textBoxUserEmail.Tag != null)
            {
                ClassConfig.SetGlobal("user.email", textBoxUserEmail.Text.Trim());
                textBoxUserEmail.Tag = null;
            }
        }
예제 #11
0
 /// <summary>
 /// Initialize pertinent settings
 /// </summary>
 /// <param name="options">All git global settings</param>
 public void Init(string[] options)
 {
     // Initialize the line endings radio buttons
     crlf = ClassConfig.GetGlobal("core.autocrlf");
     if (crlf == "true")
     {
         radio1.Checked = true;
     }
     if (crlf == "input")
     {
         radio2.Checked = true;
     }
     if (crlf == "false")
     {
         radio3.Checked = true;
     }
 }
예제 #12
0
 /// <summary>
 /// Initialize pertinent settings
 /// </summary>
 public void Init(ClassRepo repo)
 {
     // Initialize the line endings radio buttons
     crlf = ClassConfig.GetLocal(repo, "core.autocrlf");
     if (crlf == "true")
     {
         radio1.Checked = true;
     }
     if (crlf == "input")
     {
         radio2.Checked = true;
     }
     if (crlf == "false")
     {
         radio3.Checked = true;
     }
 }
예제 #13
0
        /// <summary>
        /// Apply changed settings
        /// </summary>
        public void ApplyChanges(ClassRepo repo)
        {
            if (textBoxUserName.Tag != null)
            {
                // Change the repo config and our internal variable so we dont need to reload
                ClassConfig.SetLocal(repo, "user.name", textBoxUserName.Text.Trim());
                repo.UserName       = textBoxUserName.Text;
                textBoxUserName.Tag = null;
            }

            if (textBoxUserEmail.Tag != null)
            {
                // Change the repo config and our internal variable so we dont need to reload
                ClassConfig.SetLocal(repo, "user.email", textBoxUserEmail.Text.Trim());
                repo.UserEmail       = textBoxUserEmail.Text;
                textBoxUserEmail.Tag = null;
            }
        }
예제 #14
0
        public static void ReloadConfig(CommandArgs args)
        {
            TSPlayer tSPlayer = args.Player;

            HubConfig.config = HubConfig.Read(HubConfig.configPath);
            if (!File.Exists(HubConfig.configPath))
            {
                HubConfig.config.Write(HubConfig.configPath);
            }

            ClassConfig.config = ClassConfig.Read(ClassConfig.configPath);
            if (!File.Exists(ClassConfig.configPath))
            {
                ClassConfig.config.Write(ClassConfig.configPath);
            }

            tSPlayer.SendSuccessMessage("The config was successfully reloaded.");
        }
예제 #15
0
        /// <summary>
        /// Apply changed settings
        /// </summary>
        public void ApplyChanges()
        {
            if (textBoxAliases.Tag != null)
            {
                // Remove all aliases and then rebuild them
                if (ClassGit.Run("config --remove-section alias").Success() == false)
                {
                    App.PrintLogMessage("ClassAliases: Error removing section aliases", MessageType.Error);
                }

                foreach (string[] def in
                         textBoxAliases.Lines.Select(s => s.Trim().Split('=')).Where(def => def.Length == 2))
                {
                    ClassConfig.SetGlobal("alias." + def[0].Trim(), def[1].Trim());
                }

                textBoxAliases.Tag = null;
            }
        }
예제 #16
0
        /// <summary>
        /// Initialize pertinent settings
        /// </summary>
        /// <param name="options">All git global settings</param>
        public void Init(string[] options)
        {
            string value = ClassConfig.GetGlobal("core.ignorecase");

            checkBoxIgnoreCase.Checked      = (value.ToLower() == "true") ? true : false;
            checkBoxShowDotGit.Checked      = Properties.Settings.Default.ShowDotGitFolders;
            checkBoxDeepScan.Checked        = Properties.Settings.Default.RepoDeepScan;
            checkBoxRefreshOnChange.Checked = Properties.Settings.Default.RefreshOnChange;
            checkBoxReaddOnChange.Checked   = Properties.Settings.Default.ReaddOnChange;
            checkBoxScanTabs.Checked        = Properties.Settings.Default.WarnOnTabs;
            textBoxScanExt.Text             = Properties.Settings.Default.WarnOnTabsExt;

            // Add the dirty (modified) value changed helper
            checkBoxIgnoreCase.CheckStateChanged      += ControlDirtyHelper.ControlDirty;
            checkBoxRefreshOnChange.CheckStateChanged += ControlDirtyHelper.ControlDirty;
            checkBoxReaddOnChange.CheckStateChanged   += ControlDirtyHelper.ControlDirty;
            checkBoxScanTabs.CheckStateChanged        += ControlDirtyHelper.ControlDirty;
            textBoxScanExt.TextChanged += ControlDirtyHelper.ControlDirty;
        }
예제 #17
0
        /// <summary>
        /// 根据元数据以及过滤数据规则配置查找出匹配的子类
        /// </summary>
        /// <param name="metaData">元数据</param>
        /// <param name="filters">过滤数据</param>
        /// <param name="factoryConfig">容器配置</param>
        /// <returns></returns>
        private ClassConfig GetMatchSubType(MetaData metaData, object[] filters, FactoryConfig factoryConfig)
        {
            ClassConfig defaultConfig = null;

            foreach (var config in metaData.Configs)
            {
                if (config.Value.IsMatch(filters, factoryConfig))
                {
                    return(config.Value);
                }

                if (config.Value.IsDefault)
                {
                    defaultConfig = config.Value;
                }
            }

            //没有匹配的情况下如果有默认的就用默认的
            return(defaultConfig);
        }
예제 #18
0
        public override void Initialize()
        {
            AddCommands();

            AddHooks();

            SetSSCDefaults();

            // Config
            HubConfig.config = HubConfig.Read(HubConfig.configPath);
            if (!File.Exists(HubConfig.configPath))
            {
                HubConfig.config.Write(HubConfig.configPath);
            }

            ClassConfig.config = ClassConfig.Read(ClassConfig.configPath);
            if (!File.Exists(ClassConfig.configPath))
            {
                ClassConfig.config.Write(ClassConfig.configPath);
            }
        }
예제 #19
0
        /// <summary>
        /// Apply changed settings
        /// </summary>
        public void ApplyChanges()
        {
            if (checkBoxIgnoreCase.Tag != null)
            {
                ClassConfig.SetGlobal("core.ignorecase", checkBoxIgnoreCase.Checked.ToString());
                checkBoxIgnoreCase.Tag = null;
            }

            Properties.Settings.Default.ShowDotGitFolders = checkBoxShowDotGit.Checked;
            Properties.Settings.Default.RepoDeepScan      = checkBoxDeepScan.Checked;
            Properties.Settings.Default.RefreshOnChange   = checkBoxRefreshOnChange.Checked;
            Properties.Settings.Default.ReaddOnChange     = checkBoxReaddOnChange.Checked;
            Properties.Settings.Default.WarnOnTabs        = checkBoxScanTabs.Checked;
            Properties.Settings.Default.WarnOnTabsExt     = textBoxScanExt.Text;

            // If the auto-refresh settings were changed, run the commits refresh to (de)arm the code
            if (checkBoxRefreshOnChange.Tag != null || checkBoxReaddOnChange.Tag != null)
            {
                App.MainForm.SelectiveRefresh(FormMain.SelectveRefreshFlags.Commits);
                checkBoxRefreshOnChange.Tag = checkBoxReaddOnChange.Tag = null;
            }
        }
예제 #20
0
        /// <summary>
        /// Apply changed settings
        /// </summary>
        public void ApplyChanges()
        {
            string newCrlf = "true";    // default

            if (radio1.Checked)
            {
                newCrlf = "true";
            }
            if (radio2.Checked)
            {
                newCrlf = "input";
            }
            if (radio3.Checked)
            {
                newCrlf = "false";
            }

            if (newCrlf != crlf)
            {
                ClassConfig.SetGlobal("core.autocrlf", newCrlf);
            }
        }
예제 #21
0
        /// <summary>
        /// Apply changed settings
        /// </summary>
        public void ApplyChanges()
        {
            // Default core.autocrlf setting is "true" on Windows and "false" on Linux
            string newCrlf = ClassUtils.IsMono() ? "false" : "true";

            if (radio1.Checked)
            {
                newCrlf = "true";
            }
            if (radio2.Checked)
            {
                newCrlf = "input";
            }
            if (radio3.Checked)
            {
                newCrlf = "false";
            }

            if (newCrlf != crlf)
            {
                ClassConfig.SetGlobal("core.autocrlf", newCrlf);
            }
        }
예제 #22
0
        /// <summary>
        /// 根据子类ConstructorAttribute的设置矫正构造函数的设置
        /// </summary>
        /// <param name="config">子类类型配置</param>
        /// <param name="constructorArgs">构造函数参数</param>
        /// <returns>矫正后的结果</returns>
        protected object[] GetAjustConstructorArgs(ClassConfig config, object[] constructorArgs)
        {
            if (config.ConstructorArgsDefine == false)
            {
                return(constructorArgs);
            }

            var argsIndex = config.ConstructorArgsIndex;

            if (argsIndex == null || argsIndex.Length == 0)
            {
                return(null);
            }

            var len   = argsIndex.Length;
            var cArgs = new object[len];

            for (var i = 0; i < len; i++)
            {
                cArgs[i] = constructorArgs[i];
            }

            return(cArgs);
        }
예제 #23
0
 public override void SetConfigValue(ClassConfig classConfig)
 {
     classConfig.CompentMode = CompentMode;
 }
예제 #24
0
 public abstract void SetConfigValue(ClassConfig classConfig);
예제 #25
0
 public override void SetConfigValue(ClassConfig classConfig)
 {
     classConfig.ScopeName = Scope;
 }
예제 #26
0
        public void Load(XDocument document)
        {
            XElement eConfiguration = document.Element("configuration");

            if (eConfiguration == null)
            {
                throw new ArgumentException("Invalid configuration element or not found.");
            }

            #region defination
            XElement eDefination = eConfiguration.Element("defination");
            if (eDefination == null)
            {
                throw new ArgumentException("Invalid defination element or not found.");
            }
            else
            {
                this.Defination = new DefinationConfig();

                #region connection
                XElement eConnection = eDefination.Element("connection");
                if (eConnection == null)
                {
                    throw new ArgumentException("Invalid connection element or not found.");
                }
                else
                {
                    this.Defination.Connection = new ConnectionConfig();
                    //// providerName
                    XAttribute aProviderName = eConnection.Attribute("providerName");
                    if (aProviderName == null)
                    {
                        throw new ArgumentException("Invalid providerName attribute or not found.");
                    }
                    else
                    {
                        this.Defination.Connection.ProviderName = aProviderName.Value;
                        if (this.Defination.Connection.ProviderName != "System.Data.SqlClient")
                        {
                            throw new ArgumentException("Only support System.Data.SqlClient sql provider");
                        }
                    }
                    //// connectionString
                    XAttribute aConnectionString = eConnection.Attribute("connectionString");
                    if (aConnectionString == null)
                    {
                        throw new ArgumentException("Invalid connectionString attribute or not found.");
                    }
                    else
                    {
                        this.Defination.Connection.ConnectionString = aConnectionString.Value;
                    }
                }
                #endregion connection

                #region storages
                XElement eStorages = eDefination.Element("storages");
                if (eStorages == null)
                {
                    throw new ArgumentException("Invalid storages element or not found.");
                }
                else
                {
                    this.Defination.Storages = new StoragesConfig();
                    foreach (var name in new string[] { "tables", "views" })
                    {
                        foreach (XElement element in eStorages.Elements(name))
                        {
                            if (element == null)
                            {
                            }
                            else
                            {
                                List <StorageConfig> storages = new List <StorageConfig>();
                                foreach (XElement eItem in element.Elements())
                                {
                                    if (!eItem.Name.LocalName.Equals(OperationAction.Add.ToString(), StringComparison.OrdinalIgnoreCase))
                                    {
                                        throw new ArgumentException("Invalid add element or not found.");
                                    }
                                    else
                                    {
                                        StorageConfig storage = new StorageConfig();
                                        // schema
                                        foreach (XAttribute aItem in eItem.Attributes())
                                        {
                                            switch (aItem.Name.LocalName)
                                            {
                                            case "schema":
                                                storage.Schema = aItem.Value;
                                                break;

                                            case "expression":
                                                storage.Expression = aItem.Value;
                                                break;

                                            default:
                                                throw new ArgumentException("Invalid attribute.");
                                            }
                                        }
                                        storages.Add(storage);
                                    }
                                }

                                switch (name)
                                {
                                case "tables":
                                    this.Defination.Storages.Tables = storages;
                                    break;

                                case "views":
                                    this.Defination.Storages.Views = storages;
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                    }
                }
                #endregion storages

                #region models
                XElement eModels = eDefination.Element("models");
                if (eModels == null)
                {
                }
                else
                {
                    this.Defination.Models = new List <ModelConfig>();
                    foreach (XElement eModel in eModels.Elements("model"))
                    {
                        ModelConfig model = new ModelConfig();
                        foreach (XAttribute aItem in eModel.Attributes())
                        {
                            switch (aItem.Name.LocalName)
                            {
                            case "action":
                                model.Action = (OperationAction)Enum.Parse(typeof(OperationAction), aItem.Value, true);
                                break;

                            case "schema":
                                model.Schema = aItem.Value;
                                break;

                            case "expression":
                                model.Expression = aItem.Value;
                                break;

                            case "description":
                                model.Description = aItem.Value;
                                break;

                            default:
                                throw new ArgumentException("Invalid attribute.");
                            }
                        }

                        XElement eColumns = eModel.Element("columns");
                        if (eColumns == null)
                        {
                        }
                        else
                        {
                            model.Columns = new List <ColumnConfig>();
                            foreach (XElement eColumn in eColumns.Elements("column"))
                            {
                                ColumnConfig column = new ColumnConfig();
                                column.Type = DbType.String;
                                foreach (XAttribute aItem in eColumn.Attributes())
                                {
                                    switch (aItem.Name.LocalName)
                                    {
                                    case "action":
                                        column.Action = (OperationAction)Enum.Parse(typeof(OperationAction), aItem.Value, true);
                                        break;

                                    case "name":
                                        column.Name = aItem.Value;
                                        break;

                                    case "type":
                                        column.Type = (DbType)Enum.Parse(typeof(DbType), aItem.Value, true);
                                        break;

                                    case "length":
                                        column.Length = Convert.ToInt32(aItem.Value);
                                        break;

                                    case "precision":
                                        column.Precision = Convert.ToInt32(aItem.Value);
                                        break;

                                    case "scale":
                                        column.Scale = Convert.ToInt32(aItem.Value);
                                        break;

                                    case "nullable":
                                        column.Nullable = Convert.ToBoolean(aItem.Value);
                                        break;

                                    case "collation":
                                        column.Collation = Convert.ToString(aItem.Value);
                                        break;

                                    case "defaultValue":
                                        column.DefaultValue = Convert.ToString(aItem.Value);
                                        break;

                                    case "description":
                                        column.Description = Convert.ToString(aItem.Value);
                                        break;

                                    default:
                                        throw new ArgumentException("Invalid attribute.");
                                    }
                                }
                                switch (column.Action)
                                {
                                case OperationAction.Add:
                                case OperationAction.Update:
                                case OperationAction.Remove:
                                    break;

                                default:
                                    throw new ArgumentException("Invalid action attribute.");
                                }
                                if (string.IsNullOrEmpty(column.Name))
                                {
                                    throw new ArgumentException("Invalid name attribute.");
                                }

                                model.Columns.Add(column);
                            }
                        }

                        this.Defination.Models.Add(model);
                    }
                }
                #endregion models
            }
            #endregion defination

            #region generation
            XElement eGeneration = eConfiguration.Element("generation");
            if (eGeneration == null)
            {
                throw new ArgumentException("Invalid generation element or not found.");
            }
            else
            {
                Func <XElement, List <string> > GetImports = (element) =>
                {
                    List <string> imports = new List <string>();
                    foreach (XElement eItem in element.Elements())
                    {
                        XAttribute aImport = eItem.Attribute("import");
                        if (aImport == null)
                        {
                            throw new ArgumentException("Invalid import attribute or not found.");
                        }
                        else
                        {
                            switch (eItem.Name.LocalName)
                            {
                            case "add":
                            {
                                imports.Add(aImport.Value);
                            }
                            break;

                            case "remove":
                            {
                                imports.Remove(aImport.Value);
                            }
                            break;
                            }
                        }
                    }
                    return(imports);
                };
                Func <XElement, ClassConfig> GetClassConfig = (element) =>
                {
                    ClassConfig @class = new ClassConfig();
                    foreach (XAttribute aItem in element.Attributes())
                    {
                        switch (aItem.Name.LocalName)
                        {
                        case "namespace":
                            @class.Namespace = aItem.Value;
                            break;

                        case "accessModifier":
                            @class.AccessModifier = (AccessModifier)Enum.Parse(typeof(AccessModifier), aItem.Value, true);
                            break;

                        case "name":
                            @class.Name = aItem.Value;
                            break;

                        case "base":
                            @class.Base = aItem.Value;
                            break;

                        case "useConventionalInterfaces":
                            @class.UseConventionalInterfaces = Convert.ToBoolean(aItem.Value);
                            break;
                        }
                    }
                    return(@class);
                };


                this.Generation = new GenerationConfig();
                XAttribute aEnable = eGeneration.Attribute("enable");
                if (aEnable == null)
                {
                    throw new ArgumentException("Invalid enable attribute or not found.");
                }
                else
                {
                    this.Generation.Enable = Convert.ToBoolean(aEnable.Value);
                }

                XAttribute aMode = eGeneration.Attribute("mode");
                if (aMode == null)
                {
                    throw new ArgumentException("Invalid mode attribute or not found.");
                }
                else
                {
                    this.Generation.Mode = (GenerateMode)Enum.Parse(typeof(GenerateMode), aMode.Value);
                }

                XElement eMain = eGeneration.Element("main");
                if (eMain == null)
                {
                    throw new ArgumentException("Invalid main element or not found.");
                }
                else
                {
                    this.Generation.Main = new MainGenerationConfig();
                    // Imports
                    XElement eImports = eMain.Element("imports");
                    if (eImports == null)
                    {
                    }
                    else
                    {
                        this.Generation.Main.Imports = new List <string>();
                        this.Generation.Main.Imports.AddRange(GetImports(eImports));
                    }
                    // class
                    XElement eClass = eMain.Element("class");
                    if (eClass == null)
                    {
                        throw new ArgumentException("Invalid class element or not found.");
                    }
                    else
                    {
                        this.Generation.Main.Class = GetClassConfig(eClass);
                    }
                }

                XElement eEntity = eGeneration.Element("entity");
                if (eEntity == null)
                {
                    throw new ArgumentException("Invalid entity element or not found.");
                }
                else
                {
                    this.Generation.Entity = new EntityGenerationConfig();
                    // Imports
                    XElement eImports = eEntity.Element("imports");
                    if (eImports == null)
                    {
                    }
                    else
                    {
                        this.Generation.Entity.Imports = new List <string>();
                        this.Generation.Entity.Imports.AddRange(GetImports(eImports));
                    }
                    // class
                    XElement eClass = eEntity.Element("class");
                    if (eClass == null)
                    {
                        throw new ArgumentException("Invalid class element or not found.");
                    }
                    else
                    {
                        this.Generation.Entity.Class = GetClassConfig(eClass);
                    }
                    // DefaultValues
                    XElement eDefaultValues = eEntity.Element("defaultValues");
                    if (eDefaultValues == null)
                    {
                    }
                    else
                    {
                        this.Generation.Entity.DefaultValues = new Dictionary <string, string>();
                        foreach (XElement eItem in eDefaultValues.Elements())
                        {
                            switch (eItem.Name.LocalName)
                            {
                            case "add":
                            {
                                string     type;
                                XAttribute aType = eItem.Attribute("type");
                                if (aType == null)
                                {
                                    throw new ArgumentException("Invalid type attribute or not found.");
                                }
                                else
                                {
                                    type = aType.Value;
                                }
                                string     value;
                                XAttribute aValue = eItem.Attribute("value");
                                if (aValue == null)
                                {
                                    throw new ArgumentException("Invalid value attribute or not found.");
                                }
                                else
                                {
                                    value = aValue.Value;
                                }

                                this.Generation.Entity.DefaultValues.Add(type, value);
                            }
                            break;

                            case "remove":
                            {
                                string     type;
                                XAttribute aType = eItem.Attribute("type");
                                if (aType == null)
                                {
                                    throw new ArgumentException("Invalid type attribute or not found.");
                                }
                                else
                                {
                                    type = aType.Value;
                                }

                                this.Generation.Entity.DefaultValues.Remove(type);
                            }
                            break;

                            default:
                                throw new ArgumentException("Invalid element under defaultValues.");
                            }
                        }
                    }
                }
            }
            #endregion generation
        }
예제 #27
0
 public override void SetConfigValue(ClassConfig classConfig)
 {
     classConfig.ConstructorArgsIndex  = this.ArgsIndex;
     classConfig.ConstructorArgsDefine = true;
 }
예제 #28
0
 /// <summary>
 /// Copy global user name and email address settings
 /// </summary>
 private void CopyGlobal(object sender, System.EventArgs e)
 {
     textBoxUserName.Text  = ClassConfig.GetGlobal("user.name");
     textBoxUserEmail.Text = ClassConfig.GetGlobal("user.email");
 }
 public override void SetConfigValue(ClassConfig classConfig)
 {
     classConfig.FilterRuleAttributes.Add(this);
 }
예제 #30
0
 /// <summary>
 /// Apply changed settings
 /// </summary>
 public void ApplyChanges()
 {
     userControlEditGitignore.SaveGitIgnore(excludesFile);
     ClassConfig.SetGlobal("core.excludesfile", excludesFile);
 }