From b67f5de4c57f5a7ce3a2bdb1d9cd283a8665e411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Sat, 5 Dec 2020 16:55:06 +0800 Subject: [PATCH] Port StringMatcher.FuzzySearch to IPublicAPI --- Flow.Launcher.Plugin/IPublicAPI.cs | 2 ++ Flow.Launcher/PublicAPIInstance.cs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/Flow.Launcher.Plugin/IPublicAPI.cs b/Flow.Launcher.Plugin/IPublicAPI.cs index 681973905..b6f3f0680 100644 --- a/Flow.Launcher.Plugin/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/IPublicAPI.cs @@ -88,5 +88,7 @@ namespace Flow.Launcher.Plugin /// if you want to hook something like Ctrl+R, you should use this event /// event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent; + + public (List MatchedData, int Score, bool Success) MatchString(string query, string stringToCompare); } } diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 0cc5a0e5d..5d1ea7f24 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -132,6 +132,12 @@ namespace Flow.Launcher public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent; + public (List MatchedData, int Score, bool Success) MatchString(string query, string stringToCompare) + { + var result = StringMatcher.FuzzySearch(query, stringToCompare); + return (result.MatchData, result.Score, result.Success); + } + #endregion #region Private Methods @@ -144,6 +150,7 @@ namespace Flow.Launcher } return true; } + #endregion } }