diff -r d92bacc2116e -r 47385d4fc990 Utilities/Configuration.cs --- a/Utilities/Configuration.cs Fri Feb 12 08:17:51 2010 +0000 +++ b/Utilities/Configuration.cs Fri Feb 12 22:46:31 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Drawing; using System.IO; namespace OpenHardwareMonitor.Utilities { @@ -133,5 +134,25 @@ return value; } } + + public static void Set(string name, Color color) { + instance[name] = color.ToArgb().ToString("X8"); + } + + public static Color Get(string name, Color value) { + System.Configuration.KeyValueConfigurationElement element = + instance.config.AppSettings.Settings[name]; + if (element == null) + return value; + else { + int parsedValue; + if (int.TryParse(element.Value, + System.Globalization.NumberStyles.HexNumber, + System.Globalization.CultureInfo.InvariantCulture, out parsedValue)) + return Color.FromArgb(parsedValue); + else + return value; + } + } } }