1.1 --- a/Utilities/PersistentSettings.cs Wed Sep 08 19:29:58 2010 +0000
1.2 +++ b/Utilities/PersistentSettings.cs Mon Sep 13 22:34:08 2010 +0000
1.3 @@ -35,10 +35,9 @@
1.4
1.5 */
1.6
1.7 -using System;
1.8 using System.Collections.Generic;
1.9 +using System.Globalization;
1.10 using System.Drawing;
1.11 -using System.Text;
1.12 using System.Xml;
1.13 using OpenHardwareMonitor.Hardware;
1.14
1.15 @@ -128,6 +127,24 @@
1.16 }
1.17 }
1.18
1.19 + public void SetValue(string name, float value) {
1.20 + settings[name] = value.ToString(CultureInfo.InvariantCulture);
1.21 + }
1.22 +
1.23 + public float GetValue(string name, float value) {
1.24 + string str;
1.25 + if (settings.TryGetValue(name, out str)) {
1.26 + float parsedValue;
1.27 + if (float.TryParse(str, NumberStyles.Float,
1.28 + CultureInfo.InvariantCulture, out parsedValue))
1.29 + return parsedValue;
1.30 + else
1.31 + return value;
1.32 + } else {
1.33 + return value;
1.34 + }
1.35 + }
1.36 +
1.37 public void SetValue(string name, bool value) {
1.38 settings[name] = value ? "true" : "false";
1.39 }
1.40 @@ -149,9 +166,8 @@
1.41 string str;
1.42 if (settings.TryGetValue(name, out str)) {
1.43 int parsedValue;
1.44 - if (int.TryParse(str,
1.45 - System.Globalization.NumberStyles.HexNumber,
1.46 - System.Globalization.CultureInfo.InvariantCulture, out parsedValue))
1.47 + if (int.TryParse(str, NumberStyles.HexNumber,
1.48 + CultureInfo.InvariantCulture, out parsedValue))
1.49 return Color.FromArgb(parsedValue);
1.50 else
1.51 return value;