Пример #1
0
        /// <summary>
        /// 从配置设置构建Xml
        /// </summary>
        /// <param name="xmlDoc"></param>
        /// <param name="root"></param>
        /// <returns></returns>
        private SettingNode BuildXmlFromTreeNode(IJsonTreeNode root)
        {
            //创建对象
            SettingNode xml = new SettingNode(root.JsonNodeName);

            //写属性
            xml.SetAttribute(DbEntityAttributeName, root.DbName);
            xml.SetAttribute(DbTableMultiRelated, root.MultiRelated.ToString());
            xml.SetAttribute(DbDisplayName, root.DisplayName);
            xml.SetAttribute(BuildJsonFile, root.BuildSingleFile.ToString());
            xml.SetAttribute(NodeSelectable, root.Selectable.ToString());
            xml.SetAttribute(DbCustomizedSql, root.Sql.CustomizeSQLString);
            xml.SetAttribute(DbCustomizedSqlParameters, root.Sql.Params.ToString());
            xml.SetAttribute(IsVirtual, root.IsSelectionParameter.ToString());

            //先写实节点
            foreach (String key in root.ChildNodes.Keys)
            {
                if (root.ChildNodes[key].IsDBColumn)
                {
                    xml.AppendChild(BuildXmlFromTreeNode(root.ChildNodes[key]));
                }
            }
            //虚结点做右子节点
            foreach (String key in root.ChildNodes.Keys)
            {
                if (!root.ChildNodes[key].IsDBColumn)
                {
                    xml.AppendChild(BuildXmlFromTreeNode(root.ChildNodes[key]));
                }
            }
            return(xml);
        }
Пример #2
0
        /// <summary>
        /// Set the setting
        /// </summary>
        /// <param name="key">key to save value to</param>
        /// <param name="value">value (or multiple values sperated by a comma ',') to set setting to</param>
        /// <param name="description">Write a description (optional)</param>
        /// <remarks>If the setting does not exist, it will create a new one</remarks>
        public static void SetSetting(string key, int value, string description = null)
        {
            key = key.ToLower();
            var pair = GetNode(key);

            if (pair == null)
            {
                pair = new SettingNode(key, value.ToString(CultureInfo.InvariantCulture), description);
                Values.Add(pair);
                if (OnSettingChanged != null)
                {
                    OnSettingChanged(null, new SettingsChangedEventArgs(key, null, pair.Value));
                }
                return;
            }
            if (OnSettingChanging != null)
            {
                OnSettingChanging(null, new SettingsChangedEventArgs(key, pair.Value, value.ToString(CultureInfo.InvariantCulture)));
            }

            pair.Description = description;
            pair.Value       = string.Join(",", value.ToString(CultureInfo.InvariantCulture));

            if (OnSettingChanged != null)
            {
                OnSettingChanged(null, new SettingsChangedEventArgs(key, pair.Value, value.ToString(CultureInfo.InvariantCulture)));
            }
        }
Пример #3
0
        private Control BuildSettingControl(SettingNode setting)
        {
            Control control = null;

            string editorName = setting.Editor;

            if (string.IsNullOrEmpty(editorName))
            {
                var settingType = GetSettingValue <object>(setting.Name).GetType();
                editorName = DefaultEditors.ContainsKey(settingType) ? DefaultEditors[settingType] : null;
            }

            if (editorName == null)
            {
                throw new DynamicSettingsException($"Setting `{setting.Name}` has undefined editor. Make sure you have specified `editor` attribute in settings layout.");
            }

            if (EditorBuilders.ContainsKey(editorName))
            {
                control = EditorBuilders[editorName].Invoke(setting);
            }
            else
            {
                throw new DynamicSettingsException($"Setting `{setting.Name}` has unknown editor `{editorName}`. Make sure you have added the editor builder function with key `{editorName}` to `EditorBuilders` dictionary.");
            }

            control.Name = setting.Name;

            editors.Add(control);
            return(control);
        }
    public void Function(string SchemeName)
    {
        Settings oSettings = new Settings();

        oSettings.SetStringSetting("USER.ModalDialogs.PathsScheme.LastUsed", SchemeName, 0);

        SettingNode Sn = new SettingNode("USER.ModalDialogs.PathsScheme." + SchemeName + ".Data");

        System.Collections.Specialized.StringCollection Sc = new System.Collections.Specialized.StringCollection();
        Sn.GetListOfSettings(ref Sc, false);
        foreach (string s in Sc)
        {
            string sValue = oSettings.GetStringSetting("USER.ModalDialogs.PathsScheme." + SchemeName + ".Data." + s, 0);
            switch (s)
            {
            case "ExternalDocuments":
            case "Scheme":
            case "Scripts":
            case "XML":
                oSettings.SetStringSetting("USER.SYSTEM.Pathnames." + s, sValue, 0);
                break;

            default:
                oSettings.SetStringSetting("USER.TrDMProject.Masterdata.Pathnames." + s, sValue, 0);
                break;
            }
        }
    }
    public void Function(string SchemeName)
    {
        Settings oSettings = new Settings();
        oSettings.SetStringSetting("USER.ModalDialogs.PathsScheme.LastUsed", SchemeName, 0);

        SettingNode Sn = new SettingNode("USER.ModalDialogs.PathsScheme." + SchemeName + ".Data");
        System.Collections.Specialized.StringCollection Sc = new System.Collections.Specialized.StringCollection();
        Sn.GetListOfSettings(ref Sc, false);
        foreach (string s in Sc)
        {
            string sValue = oSettings.GetStringSetting("USER.ModalDialogs.PathsScheme." + SchemeName + ".Data." + s, 0);
            switch (s)
            {
                case "ExternalDocuments":
                case "Scheme":
                case "Scripts":
                case "XML":
                    oSettings.SetStringSetting("USER.SYSTEM.Pathnames." + s, sValue, 0);
                    break;

                default:
                    oSettings.SetStringSetting("USER.TrDMProject.Masterdata.Pathnames." + s, sValue, 0);
                    break;
            }
        }
    }
Пример #6
0
        /// <summary>
        /// 从Xml设置文件建立数据库配置项
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        private TreeNode BuildTreeNode(SettingNode node, IJsonTreeNode parent)
        {
            //创建对象
            var t = new TreeNode(
                node.Name,
                node.Attributes[DbEntityAttributeName],
                node.Attributes[DbDisplayName],
                parent,
                Boolean.Parse(node.Attributes[DbTableMultiRelated]),
                Boolean.Parse(node.Attributes[BuildJsonFile]),
                Boolean.Parse(node.Attributes[NodeSelectable]),
                Boolean.Parse(node.Attributes[IsVirtual])
                );
            //读子节点
            Dictionary <String, IJsonTreeNode> childs = new Dictionary <string, IJsonTreeNode>();

            foreach (SettingNode n in node.ChildNodes)
            {
                TreeNode tn = BuildTreeNode(n, t);
                t.ChildNodes.Add(tn.JsonNodeName, tn);
            }
            //读属性
            t.Sql = new CustomizedSqlDescriber(
                node.Attributes[DbCustomizedSql] != String.Empty,
                node.Attributes[DbCustomizedSql],
                node.Attributes[DbCustomizedSqlParameters],
                t);

            return(t);
        }
Пример #7
0
 public void Init(SettingNode node)
 {
     connName = node.TryGetValue("connectionName");
     if (String.IsNullOrEmpty(connName))
     {
         throw new MissConfigurationException(node, "connectionName");
     }
 }
Пример #8
0
        public override void Save(string path, SettingNode settingNode)
        {
            JObject j = new JObject();

            SaveJson(j, settingNode);
            using (StreamWriter sr = new StreamWriter(new FileStream(path, FileMode.Create, FileAccess.Write), Encoding.UTF8))
            {
                sr.Write(j.ToString());
            }
        }
Пример #9
0
 //=====================================================================
 /// <summary>
 /// </summary>
 //=====================================================================
 public SettingViewModel()
 {
     Nodes = new SettingNode()
     {
         new SettingNode("環境設定", VM_GENERAL)
         {
             Children = new SettingNode {
                 new SettingNode("全般", VM_GENERAL),
                 new SettingNode("タブ設定", VM_TAB),
                 new SettingNode("エディタ設定", VM_EDITCOMMON)
                 {
                     Children = new SettingNode {
                         new SettingNode("共通設定", VM_EDITCOMMON)
                         {
                             Children = new SettingNode {
                                 new SettingNode("編集", ""),
                                 new SettingNode("ファイル制御", "")
                             }
                         },
                         new SettingNode("タイプ別設定", "")
                     }
                 },
                 new SettingNode("端末設定", ""),
                 new SettingNode("FTP設定", "")
                 {
                     Children = new SettingNode {
                         new SettingNode("接続", "")
                         {
                             Children = new SettingNode {
                                 new SettingNode("FTP", "")
                                 {
                                     Children = new SettingNode {
                                         new SettingNode("アクティブモード", ""),
                                         new SettingNode("パッシブモード", ""),
                                         new SettingNode("FTPプロキシ", "")
                                     }
                                 },
                                 new SettingNode("SFTP", ""),
                                 new SettingNode("汎用プロキシ", "")
                             }
                         },
                         new SettingNode("転送", "")
                         {
                             Children = new SettingNode {
                                 new SettingNode("ファイル転送", "")
                             }
                         }
                     }
                 }
             }
         }
     };
 }
Пример #10
0
        IShardSessionFactory CreateShardSessionFactory(SettingNode node, string path)
        {
            var factoryTypeString = node.TryGetValue(path);

            if (String.IsNullOrEmpty(factoryTypeString))
            {
                return(null);
            }

            Type factoryType = Type.GetType(factoryTypeString);

            return(CreateShardSessionFactory(factoryType));
        }
Пример #11
0
        public T GetSetting <T>(String key, T defaultValue)
        {
            XAttribute attr = SettingNode.Attribute(key);

            if (attr == null)
            {
                return(defaultValue);
            }
            else
            {
                return(ConvertHelper.ParseValue <T>(attr.Value, defaultValue));
            }
        }
Пример #12
0
 private void SaveINI(StringBuilder s, SettingNode settingNode)
 {
     foreach (SettingNode t in settingNode)
     {
         if (t.Children.Count != 0)
         {
             s.AppendLine("[" + t.Key + "]");
             foreach (SettingNode t2 in t)
             {
                 s.AppendLine(t2.Key + "=" + t2.Value);
             }
         }
     }
 }
Пример #13
0
 private void LoadJson(JObject j, SettingNode settingNode)
 {
     foreach (KeyValuePair <string, JToken> t in j)
     {
         if (t.Value.HasValues)
         {
             LoadJson(t.Value as JObject, settingNode[t.Key]);
         }
         else
         {
             settingNode[t.Key] = t.Value.ToString();
         }
     }
 }
Пример #14
0
        /// <summary>
        /// Loads all the settings into the memory, if no properties file is found nothing will happen
        /// </summary>
        public static void LoadSettings()
        {
            if (!File.Exists(FileUtils.PropertiesPath + "gui.properties"))
            {
                return;
            }
            string[] text = File.ReadAllLines(FileUtils.PropertiesPath + "gui.properties");
            Values.Clear();
            for (int i = 0; i < text.Count(); i++)
            {
                string      read = text[i];
                SettingNode pair;

                if (String.IsNullOrWhiteSpace(read))
                {
                    Values.Add(new SettingNode(null, read, null));
                    continue;
                }

                if (read[0] == '#' && ((i + 1 < text.Length) ? text[i + 1][0] == '#' || String.IsNullOrWhiteSpace(text[i + 1]) : true))
                {
                    Values.Add(new SettingNode(null, read, null));
                    continue;
                }

                if (read[0] == '#' && (i + 1 < text.Length) ? text[i + 1][0] != '#' && !String.IsNullOrWhiteSpace(text[i + 1]) : false)
                {
                    i++;
                    var split = text[i].Split('=');
                    pair = new SettingNode(split[0].Trim().ToLower(),
                                           String.Join("=", split, 1, split.Length - 1).Trim(),
                                           read.Substring(1));
                }
                else
                {
                    if (read[0] != '#')
                    {
                        var split = text[i].Split('=');
                        pair = new SettingNode(split[0].Trim().ToLower(),
                                               String.Join("=", split, 1, split.Length - 1).Trim(),
                                               null);
                    }
                    else
                    {
                        pair = new SettingNode(null, read, null);
                    }
                }
                Values.Add(pair);
            }
        }
Пример #15
0
        public void SetSetting <T>(String key, T value)
        {
            XAttribute attr     = SettingNode.Attribute(key);
            String     strValue = value.ToString();

            if (attr == null)
            {
                SettingNode.SetAttributeValue(key, strValue);
            }
            else
            {
                attr.Value = strValue;
            }
        }
Пример #16
0
        public void LoadSettingsFromText(string value)
        {
            XElement doc = XElement.Parse(value);

            if (doc != null)
            {
                SettingNode.ReplaceWith(doc);
                SaveSettings();
                if (OnSettingsChanged != null)
                {
                    OnSettingsChanged(this, null);
                }
            }
        }
Пример #17
0
 private void SaveJson(JObject j, SettingNode settingNode)
 {
     foreach (SettingNode t in settingNode)
     {
         if (t.Children.Count != 0)
         {
             j.Add(t.Key, new JObject());
             SaveJson(j[t.Key] as JObject, t);
         }
         else
         {
             j.Add(t.Key, t.Value);
         }
     }
 }
Пример #18
0
 public void LoadSettings()
 {
     if (File.Exists(TaskSettingsFile))
     {
         _settingNode.Root.ReplaceWith(XDocument.Load(TaskSettingsFile).Root);
     }
     else
     {
         SettingNode.ReplaceWith(DefaultSettings);
     }
     if (OnSettingsChanged != null)
     {
         OnSettingsChanged(this, null);
     }
 }
Пример #19
0
        protected override void Load()
        {
            SettingNode root = LoadSettingXML(SettingFile);

            ActiveUser       = root.Attributes[Xml_ActiveUserNodeName];
            exportworkFolder = root.Attributes[Xml_ExportFolder];
            SimpleMode       = Boolean.Parse(root.Attributes[Xml_SimpleMode]);

            SettingNode window = root.SelectSingleNode(Xml_WindowSettingRoot);

            WindowLeft   = Double.Parse(window.Attributes[Xml_WindowLocX]);
            WindowTop    = Double.Parse(window.Attributes[Xml_WindowLocY]);
            WindowWidth  = Double.Parse(window.Attributes[Xml_WindowWidth]);
            WindowHeight = Double.Parse(window.Attributes[Xml_WindowHeight]);
            AppName      = window.Attributes[Xml_APPName];
        }
Пример #20
0
 public override void Load(string path, SettingNode settingNode)
 {
     try
     {
         string data;
         settingNode.Clear();
         using (StreamReader sr = new StreamReader(new FileStream(path, FileMode.OpenOrCreate, FileAccess.Read), Encoding.UTF8))
         {
             data = sr.ReadToEnd();
         }
         LoadINI(data, settingNode);
     }
     catch (SettingException e)
     {
         throw new SettingException(Resources.ERR_LOAD, e);
     }
 }
Пример #21
0
        IShardStrategy CreateShardStrategy(SettingNode node, string path)
        {
            var type = node.TryGetValue(path);

            if (String.IsNullOrEmpty(type))
            {
                return(null);
            }

            IShardStrategy strategy = (IShardStrategy)FastActivator.Create(type);

            if (strategy != null && strategy is AbstractShardStrategy)
            {
                ((AbstractShardStrategy)strategy).Init(node.Attributes);
            }

            return(strategy);
        }
Пример #22
0
 public override void Load(string path, SettingNode settingNode)
 {
     try
     {
         string data;
         settingNode.Clear();
         using (StreamReader sr = new StreamReader(new FileStream(path, FileMode.OpenOrCreate, FileAccess.Read), Encoding.UTF8))
         {
             data = sr.ReadToEnd();
         }
         JObject j = data == "" ? new JObject() : JObject.Parse(data);
         LoadJson(j, settingNode);
     }
     catch (Exception e)
     {
         throw new SettingException(Resources.ERR_LOAD, e);
     }
 }
Пример #23
0
 private void LoadINI(string s, SettingNode settingNode)
 {
     string[] s1 = s.Trim().Split('[');
     foreach (string s1p in s1)
     {
         string[] s1p1 = s1p.Trim().Split(']');
         s1p1 = s1p1.Where(sa => !string.IsNullOrEmpty(sa)).ToArray();
         if (s1p1.Length > 1)
         {
             string[] s1p1c = s1p1[1].Trim().Split('\n');
             s1p1c = s1p1c.Where(sa => !string.IsNullOrEmpty(sa)).ToArray();
             foreach (string s1p1cp in s1p1c)
             {
                 string[] s1p1cps = s1p1cp.Trim().Split('=');
                 s1p1cps = s1p1cps.Where(sa => !string.IsNullOrEmpty(sa)).ToArray();
                 settingNode[s1p1[0]][s1p1cps[0]] = s1p1cps[1];
             }
         }
     }
 }
Пример #24
0
        public override void Update()
        {
            SettingNode root = new SettingNode(Xml_SettingRootName);

            root.SetAttribute(Xml_ActiveUserNodeName, ActiveUser);
            root.SetAttribute(Xml_ExportFolder, exportworkFolder);
            root.SetAttribute(Xml_SimpleMode, SimpleMode.ToString());

            SettingNode window = new SettingNode(Xml_WindowSettingRoot);

            window.SetAttribute(Xml_WindowLocX, WindowLeft.ToString());
            window.SetAttribute(Xml_WindowLocY, WindowTop.ToString());
            window.SetAttribute(Xml_WindowWidth, WindowWidth.ToString());
            window.SetAttribute(Xml_WindowHeight, WindowHeight.ToString());
            window.SetAttribute(Xml_APPName, AppName);

            root.AppendChild(window);

            SaveSettingXML(SettingFile, root);
        }
Пример #25
0
        private SettingVMBase getOrCreateViewModel(SettingNode sn)
        {
            SettingVMBase viewModel = null;

            if (sn == null || string.IsNullOrEmpty(sn.NameOfViewModel))
            {
                return(viewModel);
            }

            if (!_ucViewModels.TryGetValue(sn.NameOfViewModel, out viewModel))
            {
                Type   t = Type.GetType(sn.NameOfViewModel);
                object obj;

                obj       = Activator.CreateInstance(t);
                viewModel = obj as SettingVMBase;
                _ucViewModels[sn.NameOfViewModel] = viewModel;
            }
            return(viewModel);
        }
Пример #26
0
        protected override void Load()
        {
            //获取XML跟元素
            SettingNode root = LoadSettingXML(SettingFolder, SettingFile);

            //读数据库属性
            DBConnectArgs = root.Attributes[DbBaseTableConnectString];


            X readEntities = (out JsonEntityDetial entityDetial, ref SettingNode ro) =>
            {
                entityDetial = new JsonEntityDetial()
                {
                    roots = new List <IJsonTreeNode>()
                };
                //遍历每个Root实体
                foreach (SettingNode n in ro.ChildNodes)
                {
                    entityDetial.roots.Add(BuildTreeNode(n, null));
                }
                //读Root数据库信息
                entityDetial.DbConnectStr = ro.Attributes[DbBaseTableConnectString];
            };

            SettingNode node = root.SelectSingleNode(ExportRootNodeName);

            readEntities(out exportEntities, ref node);
            node = root.SelectSingleNode(ImportRootNodeName);
            readEntities(out importEntities, ref node);

            //读User节点
            node = root.SelectSingleNode(UserNodeName);
            //读User属性
            userRoot = new UserInfo()
            {
                DbConnectStr = node.Attributes[DbBaseTableConnectString],
                TableName    = node.Attributes[UserTableName],
                UserName     = node.Attributes[UserNameAttrition],
                Password     = node.Attributes[PasswordAttrition]
            };
        }
Пример #27
0
        public override void Update()
        {
            SettingNode root = new SettingNode(RootNodeName);

            root.SetAttribute(DbBaseTableConnectString, DBConnectArgs);

            SettingNode exportTree = new SettingNode(ExportRootNodeName);

            exportTree.SetAttribute(DbBaseTableConnectString, exportEntities.DbConnectStr);

            SettingNode importTree = new SettingNode(ImportRootNodeName);

            importTree.SetAttribute(DbBaseTableConnectString, importEntities.DbConnectStr);

            SettingNode userTable = new SettingNode(UserNodeName);

            userTable.SetAttribute(DbBaseTableConnectString, userRoot.DbConnectStr);
            userTable.SetAttribute(UserNameAttrition, userRoot.UserName);
            userTable.SetAttribute(PasswordAttrition, userRoot.Password);
            userTable.SetAttribute(UserTableName, userRoot.TableName);


            foreach (IJsonTreeNode n in exportEntities.roots)
            {
                exportTree.AppendChild(BuildXmlFromTreeNode(n));
            }

            foreach (IJsonTreeNode n in importEntities.roots)
            {
                importTree.AppendChild(BuildXmlFromTreeNode(n));
            }

            root.AppendChild(exportTree);
            root.AppendChild(importTree);
            root.AppendChild(userTable);

            SaveSettingXML(SettingFolder, SettingFile, root);
        }
Пример #28
0
        /// <summary>
        /// Set the setting
        /// </summary>
        /// <param name="key">key to save value to</param>
        /// <param name="description">Write a description (optional)</param>
        /// <param name="values">for each string in values, it will be seperated by a comma ','</param>
        /// <remarks>If the setting does not exist, it will create a new one</remarks>
        public static void SetSetting(string key, string description, params string[] values)
        {
            key = key.ToLower();
            var pair = GetNode(key);

            if (pair == null)
            {
                pair = new SettingNode(key, string.Join(",", values), description);
                Values.Add(pair);
                if (OnSettingChanged != null)
                {
                    OnSettingChanged(null, new SettingsChangedEventArgs(key, null, pair.Value));
                }
                return;
            }
            if (OnSettingChanged != null)
            {
                OnSettingChanged(null, new SettingsChangedEventArgs(key, pair.Value, string.Join(",", values)));
            }

            pair.Description = description ?? pair.Description;
            pair.Value       = string.Join(",", values);
        }
Пример #29
0
 public OnSettingLoadArgs(SettingNode setting)
 {
     this.setting = setting;
 }
Пример #30
0
 private void ExecuteSelChange(SettingNode sn)
 {
     CurrentViewModel = getOrCreateViewModel(sn);
 }
 /// <summary>
 /// 添加配置项的子项
 /// </summary>
 /// <param name="node"></param>
 public void AppendChild(SettingNode node)
 {
     ChildNodes.Add(node);
 }
        /// <summary>
        /// Set the setting
        /// </summary>
        /// <param name="key">key to save value to</param>
        /// <param name="description">Write a description (optional)</param>
        /// <param name="values">for each string in values, it will be seperated by a comma ','</param>
        /// <remarks>If the setting does not exist, it will create a new one</remarks>
        public void SetSetting(string key, string description = null, params string[] values)
        {
            key = key.ToLower();
            var pair = GetPair(key);
            if (pair == null) {
                pair = new SettingNode(key, string.Join(",", values), description);
                Values.Add(pair);
                return;
            }

            pair.Description = description;
            pair.Value = string.Join(",", values);
        }
        /// <summary>
        /// Loads all the settings into the memory, if no properties file is found it will return an empty list
        /// </summary>
        /// <returns>A list of setting nodes</returns>
        public List<SettingNode> LoadSettings()
        {
            if (!File.Exists(PropertiesPath))
                return new List<SettingNode>();
            var text = File.ReadAllLines(PropertiesPath);
            var Values = new List<SettingNode>();
            for (int i = 0; i < text.Count(); i++) {
                string read = text[i];
                SettingNode pair;

                if (String.IsNullOrWhiteSpace(read))
                    continue;

                if (read[0] == '#' && (i + 1 < text.Count()) ? text[i + 1][0] != '#' && !String.IsNullOrWhiteSpace(text[i + 1]) : false) {
                    i++;
                    var split = text[i].Split('=');
                    pair = new SettingNode(split[0].Trim().ToLower(),
                                           String.Join("=", split, 1, split.Length - 1).Trim(),
                                           read.Substring(1));
                }
                else {
                    if (read[0] != '#') {
                        var split = text[i].Split('=');
                        pair = new SettingNode(split[0].Trim().ToLower(),
                                               String.Join("=", split, 1, split.Length - 1).Trim(),
                                               null);
                    }
                    else pair = new SettingNode(null, read, null);
                }
                Values.Add(pair);
            }

            return Values;
        }
        /// <summary>
        /// Set the setting
        /// </summary>
        /// <param name="key">key to save value to</param>
        /// <param name="value">value to set setting to</param>
        /// <param name="description">Write a description (optional)</param>
        /// <remarks>If the setting does not exist, it will create a new one</remarks>
        public void SetSetting(string key, bool value, string description = null)
        {
            key = key.ToLower();
            var pair = GetPair(key);
            if (pair == null) {
                pair = new SettingNode(key, value.ToString(CultureInfo.InvariantCulture), description);
                Values.Add(pair);
                return;
            }

            pair.Description = description;
            pair.Value = string.Join(",", value.ToString(CultureInfo.InvariantCulture));
        }