View Single Post
  #1  
Old 08-04-2026, 13:39
BLACKFIRE69's Avatar
BLACKFIRE69 BLACKFIRE69 is offline
Registered User
 
Join Date: Mar 2019
Location: In the Hell
Posts: 688
Thanks: 481
Thanked 2,547 Times in 561 Posts
BLACKFIRE69 is on a distinguished road
Arrow WinFileScanner - Advanced File Search and Enumeration Library

WinFileScanner - Advanced File Search and Enumeration Library
============================================

Code:
> Overview:
WinFileScanner is a high-performance file system scanning library designed for 
complex pattern matching, exclusion filters, and recursive directory traversal. 
Written in Nim for maximum efficiency, it includes a comprehensive 'Text File 
Content Plugin' for advanced text analysis, encoding detection, and file 
comparison directly within your applications or Inno Setup installers.

> Specifications:
- Version       : v4.0
- Author        : BLACKFIRE69
- Language      : Nim (v2.2.8)
- Compatibility : Windows XP or later
- Thread Safety : Handle-based (Thread-safe per handle)
Code:
> Key Features:
- Multi-pattern file matching with wildcards.
- Regular expression pattern matching (v3.1+).
- Input validation with user-friendly error messages (v3.1+).
- Exclude pattern support for fine-grained scanning.
- Recursive directory scanning with high performance.
- CRC32 hash calculation (optional) for file verification.
- Hidden/system file filtering options.
- Multiple result and output format types (v3.2+).
- Directory enumeration and result persistence to file.
- Memory-efficient handle-based result storage.

> Text Analysis Plugin Features:
- Encoding detection (ANSI, UTF-8, UTF-8 BOM, UTF-16 LE/BE).
- Text statistics (lines, words, chars, comments, blanks).
- Text search (simple, regex, multi-pattern, contextual).
- Tokenization (words, lines, custom delimiters, frequency).
- Content splitting (delimiter, quote-aware, key-value, groups).
- File comparison (LCS-based diff).
- Save results directly to file.
Code:
> Builds: optimized for speed, not size.

1. WinFileScanner_clang.dll
    Size: 153 KB, Clang backend: v22.1.0

2. WinFileScanner_gcc.dll
    Size: 202 KB, GCC backend  : v15.2.0

3. WinFileScanner_msvc.dll
    Size: 213 KB, MSVC backend : v18.3.2
Code:
> Patterns: separated by pipe (|) character.

1. WILDCARDS (default):
    *.exe               - All .exe files
    *.exe|*.dll         - All .exe and .dll files
    game*.dll           - Files starting with "game" ending with .dll
    20??_cfg.ini        - ? matches single character (2023_cfg.ini, 2024_cfg.ini)
    images?\png\*       - Matches images1\png\*, images2\png\*, etc.

 2. FILE INCLUDES (@<file>):
    @masks.txt          - Load patterns from file (one per line)
    @"C:\my masks.txt"  - Quoted path for spaces
    @".\local.txt"      - Relative path

 3. REGULAR EXPRESSIONS ($"pattern"):
    $"^setup.*\.exe$"   - Files starting with "setup" ending with .exe
    $".*\d{4}.*"        - Files containing 4 consecutive digits
    $"^[^.]+$"          - Files without extension

4. COMBINED:
    *.dll|$"^setup.*\.exe$"|@C:\masks.txt
- Quick Start Examples -

Code:
[ File Search ]
---------------
{Code]
var
  FindHandle: Longint;
  i: Integer;
begin
  // Search for all .exe and .dll files recursively
  FindHandle := wfs_FindFilesEx(
    'C:\MyFolder',           // Search path
    '',                      // Destination path (empty = same as search path)
    '*.exe|*.dll',           // Include patterns
    '',                      // Exclude patterns
    frfFullPath,             // Result format: full paths
    ftSFV,                   // List output format: <File> <Hash>
    True,                    // Recursive
    False,                   // Include hidden files
    False,                   // Include system files
    False,                   // Don't enumerate directories
    True);                   // Calculate CRC32 hash

  if FindHandle > 0 then
  begin
    for i := 0 to wfs_FileCount(FindHandle) - 1 do
      Log(wfs_PickFile(FindHandle, i));
  end;

  wfs_FindFree(FindHandle);    // IMPORTANT: Always free the handle!
end;
Code:
[ Text Analysis Plugin ]
------------------------
{Code]
var
  hText, hSearch: Longint;
  i: Integer;
begin
  // Load a text file with "//" and "#" as comment prefixes
  hText := wfs_TextOpen('C:\src\main.pas', '//|#');

  if hText > 0 then
  begin
    Log('Lines: ' + IntToStr(wfs_TextStatTotalLines(hText)));
    Log('Words: ' + IntToStr(wfs_TextStatTotalWords(hText)));
    Log('Encoding: ' + wfs_TextGetEncodingStr(hText));

    // Search for a pattern
    hSearch := wfs_TextSearch(hText, 'function', False, True);
    Log('Functions found: ' + IntToStr(wfs_TextSearchCount(hSearch)));
    wfs_TextSearchFree(hSearch);

    wfs_TextFree(hText);  // Always free the handle!
  end;
end;

.
Attached Images
File Type: png 0a.png (50.6 KB, 43 views)
File Type: png 0b.png (47.2 KB, 43 views)
File Type: png 1.png (50.4 KB, 43 views)
File Type: png 2.png (51.3 KB, 43 views)
File Type: png 3.png (54.9 KB, 43 views)
File Type: png 4.png (49.8 KB, 43 views)
File Type: png 5.png (50.3 KB, 43 views)
File Type: png valid_text_file_extensions.png (3.9 KB, 43 views)
Attached Files
File Type: 7z WinFileScanner v4.0 + Examples.7z (221.2 KB, 3 views)
Reply With Quote
The Following 3 Users Say Thank You to BLACKFIRE69 For This Useful Post:
Ele (14-04-2026), Razor12911 (09-04-2026), ScOOt3r (09-04-2026)
Sponsored Links