Skip to content

Commit 2d69c9a

Browse files
committed
add cancel button to corrupted config dialog (to open settings folder) #99
1 parent 05eb61e commit 2d69c9a

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

UnityLauncherPro/MainWindow.xaml.cs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -747,14 +747,16 @@ void LoadSettings()
747747
{
748748
string filename = ((ConfigurationErrorsException)ex.InnerException).Filename;
749749

750-
if (MessageBox.Show("This may be due to a Windows crash/BSOD.\n" +
750+
var res = MessageBox.Show("This may be due to a Windows crash/BSOD.\n" +
751751
"Click 'Yes' to use automatic backup (if exists, otherwise settings are reset), then start application again.\n\n" +
752-
"Click 'No' to exit now (and delete user.config manually)\n\nCorrupted file: " + filename,
752+
"Click 'No' to reset config file (you'll need to setup settings again)\n\n" +
753+
"Click 'Cancel' to exit now (and delete user.config manually)\n\nCorrupted file: " + filename,
753754
appName + " - Corrupt user settings",
754-
MessageBoxButton.YesNo,
755-
MessageBoxImage.Error) == MessageBoxResult.Yes)
756-
{
755+
MessageBoxButton.YesNoCancel,
756+
MessageBoxImage.Error);
757757

758+
if (res == MessageBoxResult.Yes)
759+
{
758760
// try to use backup
759761
string backupFilename = filename + ".bak";
760762
if (File.Exists(backupFilename))
@@ -766,6 +768,15 @@ void LoadSettings()
766768
File.Delete(filename);
767769
}
768770
}
771+
else if (res == MessageBoxResult.No)
772+
{
773+
File.Delete(filename);
774+
}
775+
else if (res == MessageBoxResult.Cancel)
776+
{
777+
Tools.ExploreFolder(Path.GetDirectoryName(filename));
778+
}
779+
769780
// need to restart, otherwise settings not loaded
770781
Process.GetCurrentProcess().Kill();
771782
}

0 commit comments

Comments
 (0)