Commit graph

54 commits

Author SHA1 Message Date
Jack251970
2adbc334a2 Improve semaphore lock handling and code robustness
Added `lockAcquired` flags in `PluginsManifest.cs` and `Main.cs`
to ensure semaphore locks are only released if successfully
acquired, preventing potential runtime errors. Updated `finally`
blocks to conditionally release locks based on these flags.

Removed redundant cancellation check in `EverythingAPI.cs` to
simplify code, assuming cancellation is handled elsewhere. These
changes enhance reliability and maintainability of the codebase.
2025-11-07 15:30:07 +08:00
Jack251970
88fd1e56d0 Handle OperationCanceledException gracefully
Added a `catch` block for `OperationCanceledException` in
`PluginsManifest.cs` to ignore canceled operations. Updated
`EverythingAPI.cs` to use cancellation tokens with `_semaphore.WaitAsync`
and handle cancellations by exiting the method cleanly with `yield break`.
2025-11-06 20:47:54 +08:00
Jack251970
49f89e33b5 Make locking operations cancelable with tokens
Updated `_semaphore.WaitAsync` in `EverythingAPI.cs` to accept a `CancellationToken` and handle `OperationCanceledException` gracefully, returning `false` instead of propagating the exception.

Refactored locking mechanisms in `Main.cs` to use `CancellationToken` for `_win32sLock` and `_uwpsLock`. Added `try-catch` blocks to handle `OperationCanceledException` and ensure proper lock release. Methods now return `emptyResults` when operations are canceled.
2025-11-06 20:46:29 +08:00
Jack251970
d0a47c84b9 Clarify CancellationToken handling in comments
Updated comments to explain the rationale for not directly passing
CancellationToken to methods and instead checking
IsCancellationRequested within locks. This prevents unexpected
OperationCanceledException. Changes made in EverythingAPI.cs
(IsEverythingRunningAsync) and Main.cs (Win32 and UWP program
preparation). No functional changes to the code.
2025-11-06 15:39:19 +08:00
Jack251970
bfaff5cca5 Improve semaphore usage and logging clarity
Added comments in `EverythingAPI.cs` and `Main.cs` to explain
why `CancellationToken` is not directly passed to semaphore
locks, preventing unexpected `OperationCanceledException`.

Updated debug log messages in `Main.cs` for better clarity,
including changing "Start handling programs" to "Start querying
programs". Removed redundant log messages to improve logging
consistency.
2025-11-06 15:32:08 +08:00
Jack251970
30d7f67d42 Refactor token cancellation check for readability
Simplified the `if` statement that checks for token cancellation
by condensing it into a single line. This improves code readability
and eliminates unnecessary line breaks.
2025-11-06 15:30:32 +08:00
Jack251970
3d8fd1d352 Improve cancellation, locking, and logging mechanisms
Enhanced cancellation handling by adding `token.IsCancellationRequested` checks to improve responsiveness. Refactored locking mechanisms for `_win32sLock` and `_uwpsLock` using `try-finally` blocks to ensure proper acquisition and release, improving thread safety and preventing deadlocks.

Reorganized Win32 and UWP program querying logic for better modularity and readability. Replaced shared collection access with local variables to improve clarity and maintain thread safety. Simplified empty result handling by directly returning `emptyResults` when canceled.

Removed redundant debug log statements to reduce verbosity and updated remaining logs for clarity. Suppressed unused result warnings by replacing direct calls to `EverythingApiDllImport.Everything_GetMajorVersion()` with null-coalescing assignments.
2025-11-06 15:28:13 +08:00
Jack251970
db0c86d50c Remove CancellationToken from semaphore WaitAsync calls
Removed the `CancellationToken` parameter from `WaitAsync` calls
on semaphores in `EverythingAPI.cs` and `Main.cs`. This change
eliminates cancellation support for semaphore waits, likely due
to a design decision prioritizing simplicity or avoiding issues
with cancellation handling.

In `EverythingAPI.cs`, `WaitAsync(token)` was replaced with
`WaitAsync()` in two methods. Similarly, in `Main.cs`, the
`WaitAsync` calls for `_win32sLock` and `_uwpsLock` were updated
to remove the `token` parameter.

Note: This change may impact the ability to gracefully handle
cancellation during semaphore waits.
2025-11-04 14:25:55 +08:00
Jack251970
78e5bf2a60 Use Flow.Launcher.Localization to improve code quality 2025-09-21 11:50:51 +08:00
VictoriousRaptor
30f7ae0d67 Use Localization for Explorer plugin 2025-07-16 21:28:17 +08:00
VictoriousRaptor
e116668ef9 Rename file 2025-07-15 23:57:21 +08:00
Jack251970
7d5001de18 Catch exception when installing Everything 2025-06-05 18:16:13 +08:00
Jack251970
57cbe10ef0 Fix parameter bug 2024-12-01 20:13:13 +08:00
Jack251970
534a1117aa Use public api to call ShowMsgBox functions & remove useless Core project import 2024-11-27 12:21:34 +08:00
Jack251970
897fd7aaba Replace Flow.Launcher.Core.MessageBoxType & MessageBoxImage with System.Windows.MessageBoxButton & MessageBoxImage
Remove useless warning file
2024-11-26 21:31:13 +08:00
Jack251970
b30cc4fc38 Replace System.Windows.MessageBox with MessageBoxEx 2024-11-25 10:38:43 +08:00
Ishmaeel
2e078d7d0e Pass MaxResult setting to EverythingApi 2024-08-03 17:16:30 +10:00
Lasith Manujitha
c79b512191 feat: Everything Run Count option
Added an option in Explorer > Everything Settings to enable/disable Run Count for file/folder.
2024-07-15 12:22:12 +05:30
Vic
00e6e5b30d Remove unused using 2023-04-25 21:02:34 +08:00
TheBestPessimist
8051a03481 Cosmetic 2023-04-03 16:00:26 +03:00
TheBestPessimist
1ed1c99931 Revert "add scoring based on index and small optimization"
This reverts commit 02b321c4a3.
2023-03-15 20:53:14 +02:00
Hongtao
02b321c4a3 add scoring based on index and small optimization 2023-03-14 16:42:09 -05:00
TheBestPessimist
48ed1fec15 more todo 2023-03-14 09:21:11 +02:00
TheBestPessimist
2be108d740 formatting 2023-03-08 14:29:46 +02:00
TheBestPessimist
4289d10af6 Remove SortOption.RunCountAsc because it doesn't make sense 2023-03-08 14:29:46 +02:00
TheBestPessimist
fa971c6b81 Ask Everything for RunCount only if sorting by it 2023-03-08 14:29:46 +02:00
TheBestPessimist
9bc6a4e072 Waiting on a semaphore must be outside of try 2023-03-08 14:29:46 +02:00
TheBestPessimist
84b63e5f54 Use Request Flags when retrieving results from Everything, to be able to retrieve RunCount as well 2023-03-08 14:29:46 +02:00
TheBestPessimist
ac3c955539 Async is hard.
Not sure exactly why the previous version was not working, but i _assume_ it's because I was in a deadlock on that semaphore.
2023-03-08 14:29:46 +02:00
TheBestPessimist
94b841d341 Should be working 2023-03-08 14:29:46 +02:00
TheBestPessimist
f96bf4c592 cleanup 2023-03-08 14:29:46 +02:00
Hongtao Zhang
083527e603
add option for everything search in full path (default true) 2023-02-11 10:35:26 -06:00
TheBestPessimist
18d1bb5668 Cleanup unused properties 2023-01-26 09:19:42 +02:00
TheBestPessimist
1b9a879d48 Use EverythingSearchOption flag to set up FullPathSearch instead of hardcoding it 2023-01-26 08:58:41 +02:00
TheBestPessimist
2b6c92c48c question to the FL developers 2023-01-26 08:50:42 +02:00
TheBestPessimist
1482637cf1 Everything.MatchPath = true 2023-01-26 08:50:42 +02:00
Vic
51f5d8a410 Add new constructor for EngineNotAvailableException 2023-01-19 16:21:23 +08:00
Jeremy
74ea629c55 search window hides when prompted to install, remove threading 2022-12-05 08:46:19 +11:00
Hongtao Zhang
af07c3835a
cleanup code 2022-12-04 11:39:53 -06:00
Hongtao Zhang
e9d8579bbd
fix concurrency issue (really potentially) 2022-12-03 13:50:30 -06:00
Hongtao Zhang
4a0ee9b4fc
fix concurrency issue (potentially) 2022-12-03 13:44:43 -06:00
Hongtao Zhang
22bc292aa9
Add try catch to encounter dllnotfound issue and move warning string to resource 2022-11-28 21:38:27 -06:00
Hongtao Zhang
9267938018
Append Result for everything error and windows index error 2022-11-25 13:25:12 -06:00
Hongtao Zhang
e41691d10f
Fix everything sdk issue & a null reference issue 2022-11-04 01:06:56 -05:00
Hongtao Zhang
569cc19001
Fix setting issue and everything sdk issue 2022-11-04 00:58:07 -05:00
Hongtao Zhang
2c3df3f4db
Change signature back to string to accommodate async method.
Port open Windows Context Menu feature
2022-09-24 14:23:59 -05:00
Hongtao Zhang
8b1c125bdf
Custom Exception & Some Refactor
- Try use ReadOnlySpan<char> instead of String for applicable API
- Use Customized Exception to return error result
2022-09-21 19:18:20 -05:00
Hongtao Zhang
000c45bfa8
Refactor Explorer Code to fit the new architecture
1. Rename some method in QueryConstructor.cs by removing prefix and suffix
2. Split the logic of checking '>' to outer SearchManager.cs
3. Use IAsyncEnumerable for potential future improvement.
2022-09-10 10:45:41 -05:00
Hongtao Zhang
6423143c5c
Implement Everything AutoInstall 2022-08-16 21:32:49 -04:00
Hongtao Zhang
a3622d472e
Code Refactor with IAsyncEnumerable instead of Task<IEnumerable> 2022-08-16 18:45:36 -04:00