예제 #1
0
        /// <summary>
        /// Retrieves the setting value from this instance's current values.
        /// </summary>
        /// <param name="name">The name of the setting.</param>
        /// <returns>The value of the setting, or an empty string if the setting name is not found.</returns>
        public string GetValue(string name)
        {
            SettingValue settingValue = _values.FirstOrDefault(x => x.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));

            if (settingValue != null)
            {
                return(settingValue.Value);
            }

            return("");
        }
예제 #2
0
파일: Settings.cs 프로젝트: 35e8/roadkill
		/// <summary>
		/// Sets the setting value.
		/// </summary>
		/// <param name="name">The name of the setting.</param>
		/// <param name="value">The value of the setting.</param>
		/// <param name="formType">The UI type that should be used to represent the value (not currently implemented).</param>
		public void SetValue(string name, string value, SettingFormType formType = SettingFormType.Textbox)
		{
			SettingValue settingValue = _values.FirstOrDefault(x => !string.IsNullOrEmpty(x.Name) &&
																	x.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));

			if (settingValue == null)
			{
				settingValue = new SettingValue();
				settingValue.Name = name;
				_values.Add(settingValue);
			}
			
			settingValue.Value = value;
			settingValue.FormType = formType;
		}
예제 #3
0
        /// <summary>
        /// Sets the setting value.
        /// </summary>
        /// <param name="name">The name of the setting.</param>
        /// <param name="value">The value of the setting.</param>
        /// <param name="formType">The UI type that should be used to represent the value (not currently implemented).</param>
        public void SetValue(string name, string value, SettingFormType formType = SettingFormType.Textbox)
        {
            SettingValue settingValue = _values.FirstOrDefault(x => !string.IsNullOrEmpty(x.Name) &&
                                                               x.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));

            if (settingValue == null)
            {
                settingValue      = new SettingValue();
                settingValue.Name = name;
                _values.Add(settingValue);
            }

            settingValue.Value    = value;
            settingValue.FormType = formType;
        }
예제 #4
0
		/// <summary>
		/// Sets the setting value.
		/// </summary>
		/// <param name="name">The name of the setting.</param>
		/// <param name="value">The value of the setting.</param>
		/// <param name="formType">The UI type that should be used to represent the value (not currently implemented).</param>
		public void SetValue(string name, string value, SettingFormType formType = SettingFormType.Textbox)
		{
			SettingValue settingValue = _values.FirstOrDefault(x => !string.IsNullOrEmpty(x.Name) &&
																	x.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));

			if (settingValue == null)
			{
				settingValue = new SettingValue();
				settingValue.Name = name;
				_values.Add(settingValue);
			}
            
			// Set form type first, so that the validation happens
			// Though the after-the-fact validation will work even 
            // if done other way around.
			settingValue.FormType = formType;
            settingValue.Value = value;
		}
예제 #5
0
파일: Settings.cs 프로젝트: wei772/roadkill
        /// <summary>
        /// Sets the setting value.
        /// </summary>
        /// <param name="name">The name of the setting.</param>
        /// <param name="value">The value of the setting.</param>
        /// <param name="formType">The UI type that should be used to represent the value (not currently implemented).</param>
        public void SetValue(string name, string value, SettingFormType formType = SettingFormType.Textbox)
        {
            SettingValue settingValue = _values.FirstOrDefault(x => !string.IsNullOrEmpty(x.Name) &&
                                                               x.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));

            if (settingValue == null)
            {
                settingValue      = new SettingValue();
                settingValue.Name = name;
                _values.Add(settingValue);
            }

            // Set form type first, so that the validation happens
            // Though the after-the-fact validation will work even
            // if done other way around.
            settingValue.FormType = formType;
            settingValue.Value    = value;
        }