Exemplo n.º 1
0
        internal static void LoadEnvironment_NameValue()
        {
            _environmentSetting.Setting_NameValue = new NameValueSetting();

            XMLReader _reader = new XMLReader();

            _reader.LoadFile(PathUtility.GetApplicationPath(CommonCode.ConfigName.EnvironmentNameValue));

            _environmentSetting.Setting_NameValue.NameValues = new Dictionary <string, string>();

            var _nameValueItems = _reader.FindNodes("Item/add");

            if (_nameValueItems != null)
            {
                foreach (XmlNode item in _nameValueItems)
                {
                    var _key = item.Attributes["key"].Value;

                    if (_environmentSetting.Setting_NameValue.NameValues.ContainsKey(_key))
                    {
                        throw new ArgumentException("Environment_NameValue.config exist repetitive key:the key is [" + _key + "]");
                    }
                    _environmentSetting.Setting_NameValue.NameValues.Add(_key, item.Attributes["value"].Value);
                }
            }
        }