BSky.Lifetime.Services.ConfigService.RefreshConfig C# (CSharp) Метод

RefreshConfig() публичный Метод

public RefreshConfig ( ) : void
Результат void
        public void RefreshConfig()//refresh configuration with new values.
        {
            string vals;
            _success = true;
            try
            {
                Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                foreach (string key in _appSettings.Keys)
                {
                    vals = _appSettings.Get(key);
                    if (vals.Trim().Length == 0)//load deafaults if user left the config field blank
                    {
                        if (_DefaultSettings.ContainsKey(key))
                            vals = _DefaultSettings[key];
                        else
                        {
                            vals = "";
                            _success = false;
                            _message = "Key not found : " + key;
                        }
                    }
                    configuration.AppSettings.Settings[key].Value = vals;
                }
                configuration.Save();//saving back to file
                ConfigurationManager.RefreshSection("appSettings");
            }
            catch (Exception ex)
            {
                logService.WriteToLogLevel(ex.ToString(), LogLevelEnum.Error);
            }
        }