Port StringMatcher.FuzzySearch to IPublicAPI

This commit is contained in:
弘韬 张 2020-12-05 16:55:06 +08:00
parent 2608d961d0
commit b67f5de4c5
2 changed files with 9 additions and 0 deletions

View file

@ -88,5 +88,7 @@ namespace Flow.Launcher.Plugin
/// if you want to hook something like Ctrl+R, you should use this event
/// </summary>
event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;
public (List<int> MatchedData, int Score, bool Success) MatchString(string query, string stringToCompare);
}
}

View file

@ -132,6 +132,12 @@ namespace Flow.Launcher
public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;
public (List<int> 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
}
}