From a9748acd22c3d5da098a3a6d8938d60962459348 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 12 Apr 2025 21:11:22 +0800 Subject: [PATCH] Code quality --- .../Search/WindowsIndex/WindowsIndexSearchManager.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs index c3a7d9e91..3d69a1ee6 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs @@ -82,14 +82,17 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex return HandledEngineNotAvailableExceptionAsync(); } } + public IAsyncEnumerable SearchAsync(string search, CancellationToken token) { return WindowsIndexFilesAndFoldersSearchAsync(search, token: token); } + public IAsyncEnumerable ContentSearchAsync(string plainSearch, string contentSearch, CancellationToken token) { return WindowsIndexFileContentSearchAsync(contentSearch, token); } + public IAsyncEnumerable EnumerateAsync(string path, string search, bool recursive, CancellationToken token) { return WindowsIndexTopLevelFolderSearchAsync(search, path, recursive, token); @@ -100,19 +103,17 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex if (!Settings.WarnWindowsSearchServiceOff) return AsyncEnumerable.Empty(); - var api = Main.Context.API; - throw new EngineNotAvailableException( "Windows Index", - api.GetTranslation("plugin_explorer_windowsSearchServiceFix"), - api.GetTranslation("plugin_explorer_windowsSearchServiceNotRunning"), + Main.Context.API.GetTranslation("plugin_explorer_windowsSearchServiceFix"), + Main.Context.API.GetTranslation("plugin_explorer_windowsSearchServiceNotRunning"), Constants.WindowsIndexErrorImagePath, c => { Settings.WarnWindowsSearchServiceOff = false; // Clears the warning message so user is not mistaken that it has not worked - api.ChangeQuery(string.Empty); + Main.Context.API.ChangeQuery(string.Empty); return ValueTask.FromResult(false); });