Ejemplo n.º 1
0
        private void SaveAllGeneral(bool savePort)
        {
            Section section = _configuration["General Settings"];

            for (int i = 0; i < ServerSetting.Length; i++)
            {
                ServerSettingType serverSettingType = (ServerSettingType)i;
                section[serverSettingType.ToString()].BoolValue = ServerSetting[i];
            }

            if (savePort)
            {
                //load port in too
                ServerListeningPort();
            }

            try
            {
                _configuration.SaveToFile(CFG_FILE_NAME);
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Unable to save Settings: " + ex.Message);
            }
        }
Ejemplo n.º 2
0
        public void WriteSetting(ServerSettingType settingType, bool setting)
        {
            ServerSetting[(int)settingType] = setting;
            try
            {
                var section = _configuration["General Settings"];
                section[settingType.ToString()].BoolValue = setting;

                SaveAllGeneral(true);
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Unable to save Settings: " + ex.Message);
            }
        }