# HG changeset patch # User moel.mich # Date 1279472913 0 # Node ID 0b5cc38501e100f0d4ec0100798c994c6376e526 # Parent 3e2ab626531ccea1b738c6aa3ab9ecc0339d9c75 Delete the config file if it can not be parsed, and restart with a new one. diff -r 3e2ab626531c -r 0b5cc38501e1 Utilities/Config.cs --- a/Utilities/Config.cs Sun Jul 18 12:38:01 2010 +0000 +++ b/Utilities/Config.cs Sun Jul 18 17:08:33 2010 +0000 @@ -58,6 +58,18 @@ config = System.Configuration.ConfigurationManager. OpenMappedExeConfiguration(fileMap, System.Configuration.ConfigurationUserLevel.None); + try { + // try to load the settings + System.Configuration.KeyValueConfigurationCollection collection = + config.AppSettings.Settings; + } catch { + // if an exception is thrown, start with a new config file + if (File.Exists(fileName)) + File.Delete(fileName); + config = System.Configuration.ConfigurationManager. + OpenMappedExeConfiguration(fileMap, + System.Configuration.ConfigurationUserLevel.None); + } } private void SaveConfig() {