1.1 --- a/Utilities/Configuration.cs Fri Feb 12 08:17:51 2010 +0000
1.2 +++ b/Utilities/Configuration.cs Fri Feb 12 22:46:31 2010 +0000
1.3 @@ -37,6 +37,7 @@
1.4
1.5 using System;
1.6 using System.Collections.Generic;
1.7 +using System.Drawing;
1.8 using System.IO;
1.9
1.10 namespace OpenHardwareMonitor.Utilities {
1.11 @@ -133,5 +134,25 @@
1.12 return value;
1.13 }
1.14 }
1.15 +
1.16 + public static void Set(string name, Color color) {
1.17 + instance[name] = color.ToArgb().ToString("X8");
1.18 + }
1.19 +
1.20 + public static Color Get(string name, Color value) {
1.21 + System.Configuration.KeyValueConfigurationElement element =
1.22 + instance.config.AppSettings.Settings[name];
1.23 + if (element == null)
1.24 + return value;
1.25 + else {
1.26 + int parsedValue;
1.27 + if (int.TryParse(element.Value,
1.28 + System.Globalization.NumberStyles.HexNumber,
1.29 + System.Globalization.CultureInfo.InvariantCulture, out parsedValue))
1.30 + return Color.FromArgb(parsedValue);
1.31 + else
1.32 + return value;
1.33 + }
1.34 + }
1.35 }
1.36 }