mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-18 08:23:12 +00:00
c9e721fc5b
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)
24 lines
639 B
C#
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;
|
|
}
|
|
}
|
|
}
|
|
}
|