PKHeX/PKHeX.WinForms/Util/ConfigUtil.cs
Kurt c9e721fc5b Update settings load
bad settings files cause exceptions, silently delete them
move language init out of loadconfig (want it to happen regardless of
config errors, so load config value instead)
2017-01-09 19:15:46 -08:00

24 lines
639 B
C#

using System.Configuration;
using System.IO;
namespace PKHeX.WinForms
{
public static class ConfigUtil
{
public static bool checkConfig()
{
try
{
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
return true;
}
catch (ConfigurationErrorsException e)
{
string path = (e.InnerException as ConfigurationErrorsException)?.Filename;
if (path != null)
File.Delete(path);
return false;
}
}
}
}