{"id":2862,"date":"2023-06-09T21:39:45","date_gmt":"2023-06-10T00:39:45","guid":{"rendered":"http:\/\/www.hoogervorst.ca\/arthur\/?p=2862"},"modified":"2023-06-10T07:43:26","modified_gmt":"2023-06-10T10:43:26","slug":"fandro-2-winforms","status":"publish","type":"post","link":"http:\/\/www.hoogervorst.ca\/arthur\/?p=2862","title":{"rendered":"Fandro 2 (Winforms)"},"content":{"rendered":"\n<p>Back in 2014, I mentioned briefly that I had started on the .Net version of Fandro (see: <a rel=\"noreferrer noopener\" href=\"http:\/\/www.hoogervorst.ca\/arthur\/?p=2743\" data-type=\"URL\" data-id=\"http:\/\/www.hoogervorst.ca\/arthur\/?p=2743\" target=\"_blank\">http:\/\/www.hoogervorst.ca\/arthur\/?p=2743<\/a>):<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>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<\/p>\n<\/blockquote>\n\n\n\n<p>When I rekindled the project, a few months ago (using a private git service before pushing it to github (see: <a href=\"https:\/\/github.com\/hooverdirt\/fandro2\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/hooverdirt\/fandro2<\/a>), 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:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int&#91;] bad_shift = new int&#91;255];<\/code><\/pre>\n\n\n\n<p>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 &#8211; like so:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> int&#91;] bad_shift = new int&#91;char.MaxValue + 1];<\/code><\/pre>\n\n\n\n<!--more-->\n\n\n\n<p>After that change &#8211; it was a matter of refactoring the BMH routine into three classes: <\/p>\n\n\n\n<ol>\n<li>BaseFileFinder<\/li>\n\n\n\n<li>FoldersWordFinder<\/li>\n\n\n\n<li>FileSetWordFinder<\/li>\n<\/ol>\n\n\n\n<p>That&#8217;s right: from the get-go the idea is to allow users to select which folders to include in the search <strong>and<\/strong> 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).<\/p>\n\n\n\n<p>The biggest problem was how to simulate Fandro&#8217;s FileConditions grid &#8211; 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) &#8211; each row in this grid is represented by a SelectableDataRow control which in turn (depending on a user&#8217;s file search condition) can host a custom NumericUpDown control, a ComboBox, a Datepicker or a TextBox.<\/p>\n\n\n\n<p>There are a few ideas I had in mind: obviously, I&#8217;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&#8217;ve been thinking of allowing the BMH code to &#8216;drill down&#8217; on files &#8211; however, I haven&#8217;t had time to think this totally over.<\/p>\n\n\n\n<p>Happy with the result so far &#8211; and particularly happy with the custom controls: I hammered these out in a few weeks &#8211; generally coding 2 hours or less a night.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"http:\/\/www.hoogervorst.ca\/arthur\/?p=2862\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[56,88,176],"_links":{"self":[{"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=\/wp\/v2\/posts\/2862"}],"collection":[{"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2862"}],"version-history":[{"count":5,"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=\/wp\/v2\/posts\/2862\/revisions"}],"predecessor-version":[{"id":2867,"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=\/wp\/v2\/posts\/2862\/revisions\/2867"}],"wp:attachment":[{"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2862"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}