Skip to content
This repository was archived by the owner on Jul 18, 2023. It is now read-only.

Commit ad74450

Browse files
committed
Stop Slow SortOption
1 parent ecbb415 commit ad74450

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Everything/EverythingAPI.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,18 @@ public List<SearchResult> Search(string keyWord, CancellationToken token, SortOp
123123
EverythingApiDllImport.Everything_SetSearchW(keyWord);
124124
EverythingApiDllImport.Everything_SetOffset(offset);
125125
EverythingApiDllImport.Everything_SetMax(maxCount);
126+
127+
if(!EverythingApiDllImport.Everything_IsFastSort(sortOption))
128+
{
129+
throw new InvalidOperationException("The Sort Option is not Fast Sort, it may take a long time to finish the query");
130+
}
126131
EverythingApiDllImport.Everything_SetSort(sortOption);
127132

128133
if (token.IsCancellationRequested)
129134
{
130135
return null;
131136
}
132-
137+
133138

134139
if (!EverythingApiDllImport.Everything_QueryW(true))
135140
{

Everything/EverythingApiDllImport.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ public sealed class EverythingApiDllImport
9595
[DllImport(Main.DLL)]
9696
public static extern void Everything_SetSort(SortOption dwSortType);
9797
[DllImport(Main.DLL)]
98+
public static extern bool Everything_IsFastSort(SortOption dwSortType);
99+
[DllImport(Main.DLL)]
98100
public static extern SortOption Everything_GetSort();
99101
[DllImport(Main.DLL)]
100102
public static extern uint Everything_GetResultListSort();

0 commit comments

Comments
 (0)