mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
remove async and task run
This commit is contained in:
parent
b138838805
commit
f4971e2e96
1 changed files with 19 additions and 29 deletions
|
|
@ -95,13 +95,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
|
||||||
return new List<Result>();
|
return new List<Result>();
|
||||||
|
|
||||||
var constructedQuery = constructQuery(searchString);
|
var constructedQuery = constructQuery(searchString);
|
||||||
return await RemoveResultsInExclusionList(
|
return RemoveResultsInExclusionList(
|
||||||
await ExecuteWindowsIndexSearchAsync(constructedQuery, connectionString, query, token).ConfigureAwait(false),
|
await ExecuteWindowsIndexSearchAsync(constructedQuery, connectionString, query, token).ConfigureAwait(false),
|
||||||
exclusionList,
|
exclusionList,
|
||||||
token).ConfigureAwait(false);
|
token);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async static Task<List<Result>> RemoveResultsInExclusionList(List<Result> results, List<AccessLink> exclusionList, CancellationToken token)
|
private static List<Result> RemoveResultsInExclusionList(List<Result> results, List<AccessLink> exclusionList, CancellationToken token)
|
||||||
{
|
{
|
||||||
var indexExclusionListCount = exclusionList.Count;
|
var indexExclusionListCount = exclusionList.Count;
|
||||||
|
|
||||||
|
|
@ -110,38 +110,28 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
|
||||||
|
|
||||||
var filteredResults = new List<Result>();
|
var filteredResults = new List<Result>();
|
||||||
|
|
||||||
try
|
for (var index = 0; index < results.Count; index++)
|
||||||
{
|
{
|
||||||
await Task.Run(() =>
|
token.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var excludeResult = false;
|
||||||
|
|
||||||
|
for (var i = 0; i < indexExclusionListCount; i++)
|
||||||
{
|
{
|
||||||
for (var index = 0; index < results.Count; index++)
|
token.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
if (results[index].SubTitle.StartsWith(exclusionList[i].Path, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
token.ThrowIfCancellationRequested();
|
excludeResult = true;
|
||||||
|
break;
|
||||||
var excludeResult = false;
|
|
||||||
|
|
||||||
for (var i = 0; i < indexExclusionListCount; i++)
|
|
||||||
{
|
|
||||||
token.ThrowIfCancellationRequested();
|
|
||||||
|
|
||||||
if (results[index].SubTitle.StartsWith(exclusionList[i].Path, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
excludeResult = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!excludeResult)
|
|
||||||
filteredResults.Add(results[index]);
|
|
||||||
}
|
}
|
||||||
}, token);
|
}
|
||||||
|
|
||||||
return filteredResults;
|
if (!excludeResult)
|
||||||
}
|
filteredResults.Add(results[index]);
|
||||||
catch (OperationCanceledException)
|
|
||||||
{
|
|
||||||
return new List<Result>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return filteredResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool PathIsIndexed(string path)
|
internal static bool PathIsIndexed(string path)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue