2017-01-09 19:15:46 -08:00
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.WinForms
|
|
|
|
|
{
|
|
|
|
|
public static class ConfigUtil
|
|
|
|
|
{
|
2017-06-17 18:37:19 -07:00
|
|
|
|
public static bool CheckConfig()
|
2017-01-09 19:15:46 -08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (ConfigurationErrorsException e)
|
|
|
|
|
{
|
|
|
|
|
string path = (e.InnerException as ConfigurationErrorsException)?.Filename;
|
2017-01-29 00:02:32 -08:00
|
|
|
|
if (path != null && File.Exists(path))
|
2017-01-09 19:15:46 -08:00
|
|
|
|
File.Delete(path);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|