Remove setting after uninstalling plugin

This commit is contained in:
弘韬 张 2021-02-12 23:47:21 +08:00
parent 52875dab0c
commit 9df7201037
2 changed files with 9 additions and 0 deletions

View file

@ -18,6 +18,7 @@
<ItemGroup>
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
<ProjectReference Include="..\..\Flow.Launcher.Core\Flow.Launcher.Core.csproj" />
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
</ItemGroup>

View file

@ -1,8 +1,10 @@
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Http;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.Storage;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin.PluginsManager.Models;
using Flow.Launcher.Plugin.PluginsManager.ViewModels;
using Flow.Launcher.Plugin.SharedCommands;
using System;
using System.Collections.Generic;
@ -400,6 +402,12 @@ namespace Flow.Launcher.Plugin.PluginsManager
private void Uninstall(PluginMetadata plugin)
{
Core.Plugin.PluginManager.Settings.Plugins.Remove(plugin.ID);
Core.Plugin.PluginManager.AllPlugins.RemoveAll(p => p.Metadata.ID == plugin.ID);
// Marked for deletion. Will be deleted on next start up
using var _ = File.CreateText(Path.Combine(plugin.PluginDirectory, "NeedDelete.txt"));
}