Use Token.throwifCancellationRequested

This commit is contained in:
弘韬 张 2021-01-21 19:39:18 +08:00
parent 5389763f58
commit 1a758c3919
2 changed files with 4 additions and 7 deletions

View file

@ -76,8 +76,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo
fileList.Add(resultManager.CreateFileResult(fileSystemInfo.FullName, query, true, false));
}
if (token.IsCancellationRequested)
return null;
token.ThrowIfCancellationRequested();
}
}
catch (Exception e)

View file

@ -77,8 +77,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
results.Add(resultManager.CreateOpenCurrentFolderResult(locationPath, useIndexSearch));
if (token.IsCancellationRequested)
return null;
token.ThrowIfCancellationRequested();
var directoryResult = await TopLevelDirectorySearchBehaviourAsync(WindowsIndexTopLevelFolderSearchAsync,
DirectoryInfoClassSearch,
@ -87,11 +86,10 @@ namespace Flow.Launcher.Plugin.Explorer.Search
locationPath,
token).ConfigureAwait(false);
if (token.IsCancellationRequested)
return null;
token.ThrowIfCancellationRequested();
results.AddRange(directoryResult);
return results;
}