ShadowKnightMK4 / OdinSearch

Search thru local computer files and feed matching output to a class that consumes it.
MIT License
1 stars 0 forks source link

Feature add: Fullname and FileName can accept RegEx strings instead of just wildcard. #27

Closed ShadowKnightMK4 closed 4 weeks ago

ShadowKnightMK4 commented 1 month ago

Add RegEx option to the class library OdinSearch.

This Involves the following: ReservedUnused=8 -> is now RegexMode (may be renamed) - same value.

Add code to skip converting the normal wildcard way to be using this mode instead. The output will still be a regex class BUT we need to play a little defensive i.e. ensure a timeout and catch exceptions if the user provides invalid reg.

ShadowKnightMK4 commented 1 month ago

While it seems trivial enough. Ensuring invalid regex doesn't just silently fail isn't. I need to design a way or settle on a way to let the worker threads communicate this.

ShadowKnightMK4 commented 4 weeks ago

Closed. It's finished for now.

We've added a few new things thru.

OdinSearch.Search() now has another routine that lets the caller get notification if a worker thread crashes via a delegate callback.

There is a new internal class WorkerThreadExceptionCounter that tracks when the threads trigger fatal exceptions. (Currently only expect this when passing bad Regex and the Debug safety is off but there's a try catch there in the main part of the worker thread to log if something happens. If something is logged, that's when the delegate is called if set.

Note: While the internal class is not 100% finalized, it should be noted that it could change between releases. There's a reason it's set to be internal. It does pass the unit test built - one that feeds invalid regex with safeties off and on, and testing for expected results on the WorkerThreadCrashed and GetWorkerThreadException().

There's a public facing API to access this stuff.

OdinSearch.GetWorkerThreadException() returns a read only dictionary to expose this.

there's also a bool property that will test if an exception was logged, WorkerThreadCrashed