PKHeX/PKHeX.WinForms/Util/ConfigUtil.cs
Kurt cce4707604
Enable nullable for winforms csproj (#3037)
Handle all warnings
obviously the usage of null! could potentially be avoided if the object init wasn't such garbage, but here we are with years of old junk and lack of abstraction in the GUI project
2020-10-18 11:02:39 -07:00

24 lines
657 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)
{
var path = (e.InnerException as ConfigurationErrorsException)?.Filename;
if (path != null && File.Exists(path))
File.Delete(path);
return false;
}
}
}
}