mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Delete settings if corrupt
This commit is contained in:
parent
d4d384fff4
commit
0946b00075
1 changed files with 12 additions and 2 deletions
|
@ -11,6 +11,7 @@ using System.Threading;
|
|||
using System.Windows.Forms;
|
||||
using PKHeX.Core;
|
||||
using PKHeX.Core.Properties;
|
||||
using System.Configuration;
|
||||
|
||||
namespace PKHeX.WinForms
|
||||
{
|
||||
|
@ -161,9 +162,18 @@ namespace PKHeX.WinForms
|
|||
ConfigUtil.checkConfig();
|
||||
loadConfig(out BAKprompt, out showChangelog, out languageID);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ConfigurationErrorsException e)
|
||||
{
|
||||
WinFormsUtil.Error("Failed to access settings:" + Environment.NewLine + e.Message, "Please delete corrupt user.config file.");
|
||||
// Delete the settings if they exist
|
||||
var settingsFilename = (e.InnerException as ConfigurationErrorsException)?.Filename;
|
||||
if (File.Exists(settingsFilename))
|
||||
{
|
||||
File.Delete(settingsFilename);
|
||||
}
|
||||
else
|
||||
{
|
||||
WinFormsUtil.Error("Unable to load settings.", e);
|
||||
}
|
||||
}
|
||||
CB_MainLanguage.SelectedIndex = languageID;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue