diff options
author | sr55 <[email protected]> | 2011-04-03 17:49:44 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-04-03 17:49:44 +0000 |
commit | a6fbb52b6c9f4b639101e6e4d37e670ca2840c84 (patch) | |
tree | 5bf6b9a4d945365ba07dd07ba77fd05019d0e086 /win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs | |
parent | 80ebbf6f36a9084dd19e04e1cbfbd9ec93bfb6b6 (diff) |
WinGui:
- Move all user settings for the Services library into the services library.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3899 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs')
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs b/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs new file mode 100644 index 000000000..87d77324f --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs @@ -0,0 +1,95 @@ +/* UserSettingService.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Services
+{
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ /// <summary>
+ /// The User Setting Serivce
+ /// </summary>
+ public class UserSettingService : IUserSettingService
+ {
+ /// <summary>
+ /// Set the specified user setting.
+ /// </summary>
+ /// <param name="name">
+ /// Name of the property
+ /// </param>
+ /// <param name="value">
+ /// The value to store.
+ /// </param>
+ public void SetUserSetting(string name, object value)
+ {
+ Properties.Settings.Default[name] = value;
+ Properties.Settings.Default.Save();
+ }
+
+ /// <summary>
+ /// Get an Integer type user setting
+ /// </summary>
+ /// <param name="name">
+ /// The setting name
+ /// </param>
+ /// <returns>
+ /// The settings value
+ /// </returns>
+ public int GetUserSettingInt(string name)
+ {
+ int value;
+ int.TryParse(Properties.Settings.Default[name].ToString(), out value);
+
+ return value;
+ }
+
+ /// <summary>
+ /// Get an String type user setting
+ /// </summary>
+ /// <param name="name">
+ /// The setting name
+ /// </param>
+ /// <returns>
+ /// The settings value
+ /// </returns>
+ public string GetUserSettingString(string name)
+ {
+ return Properties.Settings.Default[name].ToString();
+ }
+
+ /// <summary>
+ /// Get an Boolean type user setting
+ /// </summary>
+ /// <param name="name">
+ /// The setting name
+ /// </param>
+ /// <returns>
+ /// The settings value
+ /// </returns>
+ public bool GetUserSettingBoolean(string name)
+ {
+ bool value;
+ bool.TryParse(Properties.Settings.Default[name].ToString(), out value);
+
+ return value;
+ }
+
+ /// <summary>
+ /// Get an Double type user setting
+ /// </summary>
+ /// <param name="name">
+ /// The setting name
+ /// </param>
+ /// <returns>
+ /// The settings value
+ /// </returns>
+ public double GetUserSettingDouble(string name)
+ {
+ double value;
+ double.TryParse(Properties.Settings.Default[name].ToString(), out value);
+
+ return value;
+ }
+ }
+}
|