mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-12 14:48:41 -05:00
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)
25 lines
639 B
C#
25 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;
|
|
}
|
|
}
|
|
}
|
|
}
|