Changed the plugin initialization so it throws an exception if unable to load config file, rather than creating a new config file.

This commit is contained in:
Brett Hewitson 2021-12-09 17:10:07 +10:00
parent d373bf0866
commit 6c50f8be6f
6 changed files with 79 additions and 71 deletions

View file

@ -25,7 +25,7 @@ namespace ServerManagerTool.Plugin.Discord.Windows
InitializeComponent();
WindowUtils.UpdateResourceDictionary(this, plugin.LanguageCode);
this.Plugin = plugin ?? new DiscordPlugin();
this.Plugin = plugin;
this.OriginalProfile = profile;
this.Profile = profile.Clone();
this.Profile.CommitChanges();
@ -77,7 +77,10 @@ namespace ServerManagerTool.Plugin.Discord.Windows
if (this.Profile.HasAnyChanges)
{
if (MessageBox.Show(ResourceUtils.GetResourceString(this.Resources, "ConfigProfileWindow_CloseLabel"), ResourceUtils.GetResourceString(this.Resources, "ConfigProfileWindow_CloseTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
{
e.Cancel = true;
return;
}
}
}