Fandro 2 (Winforms)

Back in 2014, I mentioned briefly that I had started on the .Net version of Fandro (see: http://www.hoogervorst.ca/arthur/?p=2743):

No timelines as of yet, though, but technically, the main algorithm was finished a couple of days ago. Time permitting, I expect at least something out by the end of the month

When I rekindled the project, a few months ago (using a private git service before pushing it to github (see: https://github.com/hooverdirt/fandro2), I remembered I got stuck on a very specific piece of code that kept causing grief and hard errors during the threaded search and the actual call to the BMH routine:

int[] bad_shift = new int[255];

When I picked up the code (February 2023), it clearly made more sense that the bad shift array should actually include the full character set – like so:

 int[] bad_shift = new int[char.MaxValue + 1];

After that change – it was a matter of refactoring the BMH routine into three classes:

  1. BaseFileFinder
  2. FoldersWordFinder
  3. FileSetWordFinder

That’s right: from the get-go the idea is to allow users to select which folders to include in the search and which files to target. While thinking how to present this to the user, I decided to write my own control: this is the FileTextSelectionBox control in the libfandro2 project (/lib/controls/Folders).

The biggest problem was how to simulate Fandro’s FileConditions grid – the grid where users can select file specific conditions filters that are going to be applied to the search algorithm. I ended creating my own ControlGrid (descended from TableLayoutPanel) – each row in this grid is represented by a SelectableDataRow control which in turn (depending on a user’s file search condition) can host a custom NumericUpDown control, a ComboBox, a Datepicker or a TextBox.

There are a few ideas I had in mind: obviously, I’ve started separating out the Winforms specific code from the BMH classes. Possibly some multi-platform coding as most of the BMH code is not tied to a specific OS. Additionally, I’ve been thinking of allowing the BMH code to ‘drill down’ on files – however, I haven’t had time to think this totally over.

Happy with the result so far – and particularly happy with the custom controls: I hammered these out in a few weeks – generally coding 2 hours or less a night.

This entry was posted in Programming and tagged , , . Bookmark the permalink.