Delete the config file if it can not be parsed, and restart with a new one.
1.1 --- a/Utilities/Config.cs Sun Jul 18 12:38:01 2010 +0000
1.2 +++ b/Utilities/Config.cs Sun Jul 18 17:08:33 2010 +0000
1.3 @@ -58,6 +58,18 @@
1.4 config = System.Configuration.ConfigurationManager.
1.5 OpenMappedExeConfiguration(fileMap,
1.6 System.Configuration.ConfigurationUserLevel.None);
1.7 + try {
1.8 + // try to load the settings
1.9 + System.Configuration.KeyValueConfigurationCollection collection =
1.10 + config.AppSettings.Settings;
1.11 + } catch {
1.12 + // if an exception is thrown, start with a new config file
1.13 + if (File.Exists(fileName))
1.14 + File.Delete(fileName);
1.15 + config = System.Configuration.ConfigurationManager.
1.16 + OpenMappedExeConfiguration(fileMap,
1.17 + System.Configuration.ConfigurationUserLevel.None);
1.18 + }
1.19 }
1.20
1.21 private void SaveConfig() {