Remove plugins from setting that are not loaded anymore

This commit is contained in:
Stone_Red
2023-11-22 16:40:11 +01:00
parent 4d8eef700f
commit 11c9026fbf
2 changed files with 11 additions and 0 deletions
+11
View File
@@ -557,8 +557,10 @@ namespace DesktopMagic
bool showWindow = true;
// Load plugins
foreach (string pluginName in pluginNames)
{
// Add plugin to layout if it doesn't exist
if (!Settings.CurrentLayout.Plugins.TryGetValue(pluginName, out PluginSettings? pluginSettings))
{
Settings.CurrentLayout.Plugins.Add(pluginName, new PluginSettings());
@@ -577,6 +579,15 @@ namespace DesktopMagic
}
}
// Remove plugins that are not loaded anymore
foreach (string pluginName in Settings.CurrentLayout.Plugins.Keys)
{
if (!pluginNames.Contains(pluginName))
{
Settings.CurrentLayout.Plugins.Remove(pluginName);
}
}
Settings.CurrentLayout.UpdatePlugins();
if (!showWindow && minimize)