/* UserSettingService.cs $ This file is part of the HandBrake source code. Homepage: . It may be used under the terms of the GNU General Public License. */ namespace HandBrake.ApplicationServices.Services { using HandBrake.ApplicationServices.Services.Interfaces; /// /// The User Setting Serivce /// public class UserSettingService : IUserSettingService { /// /// Set the specified user setting. /// /// /// Name of the property /// /// /// The value to store. /// public void SetUserSetting(string name, object value) { Properties.Settings.Default[name] = value; Properties.Settings.Default.Save(); } /// /// Get an Integer type user setting /// /// /// The setting name /// /// /// The settings value /// public int GetUserSettingInt(string name) { int value; int.TryParse(Properties.Settings.Default[name].ToString(), out value); return value; } /// /// Get an String type user setting /// /// /// The setting name /// /// /// The settings value /// public string GetUserSettingString(string name) { return Properties.Settings.Default[name].ToString(); } /// /// Get an Boolean type user setting /// /// /// The setting name /// /// /// The settings value /// public bool GetUserSettingBoolean(string name) { bool value; bool.TryParse(Properties.Settings.Default[name].ToString(), out value); return value; } /// /// Get an Double type user setting /// /// /// The setting name /// /// /// The settings value /// public double GetUserSettingDouble(string name) { double value; double.TryParse(Properties.Settings.Default[name].ToString(), out value); return value; } } }