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