From 93af07931681588e68312907e7c1ab0427938b4a Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 12 Aug 2025 17:49:22 +0800 Subject: [PATCH] Improve code quality --- Flow.Launcher.Core/Plugin/PluginManager.cs | 74 +++++++++++----------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index 122542d23..2823ad132 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -485,6 +485,43 @@ namespace Flow.Launcher.Core.Plugin #endregion + #region Get Plugin List + + public static List GetAllLoadedPlugins() + { + return [.. _allLoadedPlugins]; + } + + public static List GetAllInitializedPlugins(bool includeFailed) + { + if (includeFailed) + { + return [.. _allInitializedPlugins.Values]; + } + else + { + return [.. _allInitializedPlugins.Values + .Where(p => !_initFailedPlugins.ContainsKey(p.Metadata.ID))]; + } + } + + public static List GetGlobalPlugins() + { + return [.. _globalPlugins.Values]; + } + + public static Dictionary GetNonGlobalPlugins() + { + return _nonGlobalPlugins.ToDictionary(); + } + + public static List GetTranslationPlugins() + { + return [.. _translationPlugins.Where(p => !PluginModified(p.Metadata.ID))]; + } + + #endregion + #region Update Metadata & Get Plugin public static void UpdatePluginMetadata(IReadOnlyList results, PluginMetadata metadata, Query query) @@ -517,43 +554,6 @@ namespace Flow.Launcher.Core.Plugin #endregion - #region Get Plugin List - - public static List GetAllLoadedPlugins() - { - return [.. _allLoadedPlugins]; - } - - public static List GetAllInitializedPlugins(bool containFailed) - { - if (containFailed) - { - return [.. _allInitializedPlugins.Values]; - } - else - { - return [.. _allInitializedPlugins.Values - .Where(p => !_initFailedPlugins.ContainsKey(p.Metadata.ID))]; - } - } - - public static List GetGlobalPlugins() - { - return [.. _globalPlugins.Values]; - } - - public static Dictionary GetNonGlobalPlugins() - { - return _nonGlobalPlugins.ToDictionary(); - } - - public static List GetTranslationPlugins() - { - return [.. _translationPlugins.Where(p => !PluginModified(p.Metadata.ID))]; - } - - #endregion - #region Get Context Menus public static List GetContextMenusForPlugin(Result result)