Skip to content

Commit

Permalink
Add additional exception handling to new user settings file
Browse files Browse the repository at this point in the history
  • Loading branch information
hbivnm committed Mar 3, 2023
1 parent 20497fa commit 9300254
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions VenomCrosshairs/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,19 @@ private void initVC()
catch (Exception ex)
{
MessageBox.Show($"Something went wrong reading the user setting file.\n\nFor developer: Exception: {ex.Message}", "Venom Crosshairs - Failed to read user settings!", MessageBoxButtons.OK, MessageBoxIcon.Error);
File.Delete(PATH_VC_RESOURCES_VC_USERSETTINGS_CFG_FILE);
gUserSettings = new VCUserSettings
{
IsDarkMode = false,
UserExplosionEffectIndex = 0,
UserTF2Path = ""
};
File.WriteAllText(PATH_VC_RESOURCES_VC_USERSETTINGS_CFG_FILE, JsonConvert.SerializeObject(gUserSettings));

cbExplosionEffect.SelectedIndex = 0;
textBoxTF2Path.Text = "";
gIsDarkMode = false;
setDarkModeTheme(gIsDarkMode);
}
}
else
Expand All @@ -525,6 +538,10 @@ private void initVC()
UserTF2Path = ""
};
File.WriteAllText(PATH_VC_RESOURCES_VC_USERSETTINGS_CFG_FILE, JsonConvert.SerializeObject(gUserSettings));
cbExplosionEffect.SelectedIndex = 0;
textBoxTF2Path.Text = "";
gIsDarkMode = false;
setDarkModeTheme(gIsDarkMode);
}

// Look for old configs from previous versions
Expand Down

0 comments on commit 9300254

Please sign in to comment.