# rejetto/hfs2 architecture

> Architecture diagram of the GitHub repository rejetto/hfs2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rejetto/hfs2
- Repository: https://github.com/rejetto/hfs2

## Overview

##### Project Type and Purpose
- The project includes a GUI (multiple .dfm and .pas files for dialogs and forms) that supports server configuration and administration, plus the core server engine that processes HTTP requests.
- External libraries such as ICS (networking), TRegExpr (regular expressions), JEDI Code Library, and Delphi Localizer are integrated, indicating reliance on established components for networking, parsing, and internationalization.

##### File Structure
- Top-level files like hfs.dpr (the Delphi project file) and hfs.pas (likely the main application module) suggest a single executable that incorporates both server functionality and a graphical administration user interface.
- There are many dialog and form files (e.g., diffDlg, filepropDlg, optionsDlg, etc.). These indicate that the application includes a rich set of administration or configuration dialogs that are part of the UI layer.
- Various utility and library files (such as classesLib.pas, parserLib.pas, scriptLib.pas, traylib.pas, etc.) point to internal modules that handle tasks such as parsing (likely HTTP or script commands), scripting support, or system tray integration.
- Additional files like default.tpl and dmBrowser.tpl suggest template based rendering or configuration options for the web server component.

a. Main Components:
- User Interface (GUI) Layer: Represented by the multiple dialog and form files (listed as *.dfm and corresponding *.pas files). This layer is used for administration, configuration, and possibly monitoring server activity.
- Core Server Engine: Centered around hfs.pas and hfs.dpr, this component processes HTTP requests and manages the virtual file system to send/receive files.
- Supporting Libraries and Utilities: This includes parserLib.pas, scriptLib.pas, utillib.pas, and others, which form the backend logic and support tasks like parsing input, handling scripting tasks, and managing file operations.
- External Dependencies: Include ICS (for networking support), TRegExpr (for regular expression processing), JEDI Code Library, and the Delphi Localizer. These should be depicted as external blocks that contribute services or functionalities to the system.

b. Relationships & Interactions:
- Communication between the Core Server Engine and the UI layer: administrative commands or configuration changes (often through dialogs such as optionsDlg, filepropDlg, etc.) affect server operation and are reflected by the core module.
- That the External Dependencies act as plug-ins or supplementary modules that inject networking, parsing, localization, and potentially other specialized features into the system.
- That configuration/resource files provide initial settings and runtime customization to both the UI and Core Server Engine.

c. Architectural Patterns & Design Principles:
- Although not explicitly noted, the organization hints at a layered architecture where the UI acts as a front-end for configuring and monitoring the backend server component.
- The modular approach with separate units/libraries (parsing, scripting, utilities) reinforces a separation of concerns.

d. Technologies and Frameworks:
- Use of Delphi (and associated IDE projects like .dproj, .bdsproj) for building the application.
- External dependencies: ICS for HTTP handling, TRegExpr for regex support, JEDI Code Library for additional common utilities, and Delphi Localizer for language support.
- Recognize that VCL forms (*.dfm) are core to the UI side.

##### Final Advice
- Be very meticulous: ensure every core element (even the less obvious utilities like traylib or shellExtDlg) is captured in your components layer.
- Don’t overcomplicate—the key is to accurately capture each architectural element and the interactions between them.
- This approach will provide a clear, visual map of how the old HFS is structured and how each part interacts with the rest of the system.

## Diagram (Mermaid)

```mermaid
flowchart TD

    subgraph "External Entities"
        HTTPClient["HTTP Client (Web Browser)"]:::external
    end

    subgraph "Core Server Engine"
        hfs_dpr["hfs.dpr"]:::core
        hfs_pas["hfs.pas"]:::core
        hfs_dproj["hfs.dproj"]:::core
        hfs_dpr --- hfs_pas --- hfs_dproj
    end

    subgraph "Graphical User Interface (Dialogs & Forms)"
        diffDlg_dfm["diffDlg.dfm"]:::ui
        diffDlg_pas["diffDlg.pas"]:::ui

        filepropDlg_dfm["filepropDlg.dfm"]:::ui
        filepropDlg_pas["filepropDlg.pas"]:::ui

        folderKindDlg_dfm["folderKindDlg.dfm"]:::ui
        folderKindDlg_pas["folderKindDlg.pas"]:::ui

        ipsEverDlg_dfm["ipsEverDlg.dfm"]:::ui
        ipsEverDlg_pas["ipsEverDlg.pas"]:::ui

        listSelectDlg_dfm["listSelectDlg.dfm"]:::ui
        listSelectDlg_pas["listSelectDlg.pas"]:::ui

        longinputDlg_dfm["longinputDlg.dfm"]:::ui
        longinputDlg_pas["longinputDlg.pas"]:::ui

        newuserpassDlg_dfm["newuserpassDlg.dfm"]:::ui
        newuserpassDlg_pas["newuserpassDlg.pas"]:::ui

        optionsDlg_dfm["optionsDlg.dfm"]:::ui
        optionsDlg_pas["optionsDlg.pas"]:::ui

        purgeDlg_dfm["purgeDlg.dfm"]:::ui
        purgeDlg_pas["purgeDlg.pas"]:::ui

        runscriptDlg_dfm["runscriptDlg.dfm"]:::ui
        runscriptDlg_pas["runscriptDlg.pas"]:::ui

        shellExtDlg_dfm["shellExtDlg.dfm"]:::ui
        shellExtDlg_pas["shellExtDlg.pas"]:::ui

        main_dfm["main.dfm"]:::ui
        main_pas["main.pas"]:::ui

        %% Grouping dialog file pairs with dashed lines
        diffDlg_dfm --- diffDlg_pas
        filepropDlg_dfm --- filepropDlg_pas
        folderKindDlg_dfm --- folderKindDlg_pas
        ipsEverDlg_dfm --- ipsEverDlg_pas
        listSelectDlg_dfm --- listSelectDlg_pas
        longinputDlg_dfm --- longinputDlg_pas
        newuserpassDlg_dfm --- newuserpassDlg_pas
        optionsDlg_dfm --- optionsDlg_pas
        purgeDlg_dfm --- purgeDlg_pas
        runscriptDlg_dfm --- runscriptDlg_pas
        shellExtDlg_dfm --- shellExtDlg_pas
        main_dfm --- main_pas
    end

    subgraph "Supporting Libraries & Utilities"
        classesLib["classesLib.pas"]:::lib
        parserLib["parserLib.pas"]:::lib
        scriptLib["scriptLib.pas"]:::lib
        traylib["traylib.pas"]:::lib
        utillib["utillib.pas"]:::lib
        hslib["hslib.pas"]:::lib
        monoLib["monoLib.pas"]:::lib
        progFrmLib["progFrmLib.pas"]:::lib
    end

    subgraph "Configuration & Resources"
        hfs_cfg["hfs.cfg"]:::conf
        hfs_lng["hfs.lng"]:::conf
        default_tpl["default.tpl"]:::conf
        dmBrowser_tpl["dmBrowser.tpl"]:::conf
        filelist_tpl["filelist.tpl"]:::conf
        fontello_json["fontello.json"]:::conf
        data_rc["data.rc"]:::conf
        hfs_res["hfs.res"]:::conf
    end

    subgraph "External Dependencies"
        ICS["ICS (Networking)"]:::ext
        TRegExpr["TRegExpr (Regex)"]:::ext
        JEDI["JEDI Code Library"]:::ext
        DelphiLocalizer["Delphi Localizer"]:::ext
    end

    subgraph "Build & Project Files"
        hfs_bdsproj["hfs.bdsproj"]:::build
        hfs_dproj_local["hfs.dproj.local"]:::build
        WindowsXP_manifest["WindowsXP.manifest"]:::build
        recompile_bat["recompile data.bat"]:::build
    end

    %% Relationships
    HTTPClient -->|"HTTP_Request"| hfs_pas

    hfs_pas -->|"Invokes"| optionsDlg_pas
    hfs_pas -->|"Invokes"| diffDlg_pas
    hfs_pas -->|"Calls"| parserLib
    hfs_pas -->|"Calls"| scriptLib
    hfs_pas -->|"Calls"| traylib
    hfs_pas -->|"Calls"| utillib
    hfs_pas -->|"Uses"| ICS
    hfs_pas -->|"Uses"| TRegExpr
    hfs_pas -->|"Uses"| JEDI
    hfs_pas -->|"Uses"| DelphiLocalizer
    hfs_pas -->|"Reads"| hfs_cfg
    hfs_pas -->|"Reads"| hfs_lng
    hfs_pas -->|"Reads"| default_tpl

    optionsDlg_pas -->|"Configures"| hfs_pas
    main_pas -->|"Displays"| hfs_pas

    hfs_pas --- hfs_bdsproj
    hfs_pas --- hfs_dproj_local
    hfs_pas --- WindowsXP_manifest
    hfs_pas --- recompile_bat

    hfs_cfg --- optionsDlg_pas
    hfs_lng --- main_pas

    %% Class Styles
    classDef core fill:#ADD8E6,stroke:#00008B,stroke-width:2px;
    classDef ui fill:#98FB98,stroke:#006400,stroke-width:2px;
    classDef lib fill:#FFDAB9,stroke:#FF8C00,stroke-width:2px;
    classDef conf fill:#E6E6FA,stroke:#4B0082,stroke-width:2px;
    classDef ext fill:#FFC0CB,stroke:#FF1493,stroke-width:2px;
    classDef build fill:#D3D3D3,stroke:#A9A9A9,stroke-width:2px;
    classDef external fill:#FFFFE0,stroke:#BDB76B,stroke-width:2px;

    %% Click Events for Core Server Engine
    click hfs_dpr "https://github.com/rejetto/hfs2/blob/master/hfs.dpr"
    click hfs_pas "https://github.com/rejetto/hfs2/blob/master/hfs.pas"
    click hfs_dproj "https://github.com/rejetto/hfs2/blob/master/hfs.dproj"

    %% Click Events for GUI Components
    click diffDlg_dfm "https://github.com/rejetto/hfs2/blob/master/diffDlg.dfm"
    click diffDlg_pas "https://github.com/rejetto/hfs2/blob/master/diffDlg.pas"
    click filepropDlg_dfm "https://github.com/rejetto/hfs2/blob/master/filepropDlg.dfm"
    click filepropDlg_pas "https://github.com/rejetto/hfs2/blob/master/filepropDlg.pas"
    click folderKindDlg_dfm "https://github.com/rejetto/hfs2/blob/master/folderKindDlg.dfm"
    click folderKindDlg_pas "https://github.com/rejetto/hfs2/blob/master/folderKindDlg.pas"
    click ipsEverDlg_dfm "https://github.com/rejetto/hfs2/blob/master/ipsEverDlg.dfm"
    click ipsEverDlg_pas "https://github.com/rejetto/hfs2/blob/master/ipsEverDlg.pas"
    click listSelectDlg_dfm "https://github.com/rejetto/hfs2/blob/master/listSelectDlg.dfm"
    click listSelectDlg_pas "https://github.com/rejetto/hfs2/blob/master/listSelectDlg.pas"
    click longinputDlg_dfm "https://github.com/rejetto/hfs2/blob/master/longinputDlg.dfm"
    click longinputDlg_pas "https://github.com/rejetto/hfs2/blob/master/longinputDlg.pas"
    click newuserpassDlg_dfm "https://github.com/rejetto/hfs2/blob/master/newuserpassDlg.dfm"
    click newuserpassDlg_pas "https://github.com/rejetto/hfs2/blob/master/newuserpassDlg.pas"
    click optionsDlg_dfm "https://github.com/rejetto/hfs2/blob/master/optionsDlg.dfm"
    click optionsDlg_pas "https://github.com/rejetto/hfs2/blob/master/optionsDlg.pas"
    click purgeDlg_dfm "https://github.com/rejetto/hfs2/blob/master/purgeDlg.dfm"
    click purgeDlg_pas "https://github.com/rejetto/hfs2/blob/master/purgeDlg.pas"
    click runscriptDlg_dfm "https://github.com/rejetto/hfs2/blob/master/runscriptDlg.dfm"
    click runscriptDlg_pas "https://github.com/rejetto/hfs2/blob/master/runscriptDlg.pas"
    click shellExtDlg_dfm "https://github.com/rejetto/hfs2/blob/master/shellExtDlg.dfm"
    click shellExtDlg_pas "https://github.com/rejetto/hfs2/blob/master/shellExtDlg.pas"
    click main_dfm "https://github.com/rejetto/hfs2/blob/master/main.dfm"
    click main_pas "https://github.com/rejetto/hfs2/blob/master/main.pas"

    %% Click Events for Supporting Libraries & Utilities
    click classesLib "https://github.com/rejetto/hfs2/blob/master/classesLib.pas"
    click parserLib "https://github.com/rejetto/hfs2/blob/master/parserLib.pas"
    click scriptLib "https://github.com/rejetto/hfs2/blob/master/scriptLib.pas"
    click traylib "https://github.com/rejetto/hfs2/blob/master/traylib.pas"
    click utillib "https://github.com/rejetto/hfs2/blob/master/utillib.pas"
    click hslib "https://github.com/rejetto/hfs2/blob/master/hslib.pas"
    click monoLib "https://github.com/rejetto/hfs2/blob/master/monoLib.pas"
    click progFrmLib "https://github.com/rejetto/hfs2/blob/master/progFrmLib.pas"

    %% Click Events for Configuration & Resources
    click hfs_cfg "https://github.com/rejetto/hfs2/blob/master/hfs.cfg"
    click hfs_lng "https://github.com/rejetto/hfs2/blob/master/hfs.lng"
    click default_tpl "https://github.com/rejetto/hfs2/blob/master/default.tpl"
    click dmBrowser_tpl "https://github.com/rejetto/hfs2/blob/master/dmBrowser.tpl"
    click filelist_tpl "https://github.com/rejetto/hfs2/blob/master/filelist.tpl"
    click fontello_json "https://github.com/rejetto/hfs2/blob/master/fontello.json"
    click data_rc "https://github.com/rejetto/hfs2/blob/master/data.rc"
    click hfs_res "https://github.com/rejetto/hfs2/blob/master/hfs.res"

    %% Click Events for Build & Project Files
    click hfs_bdsproj "https://github.com/rejetto/hfs2/blob/master/hfs.bdsproj"
    click hfs_dproj_local "https://github.com/rejetto/hfs2/blob/master/hfs.dproj.local"
    click WindowsXP_manifest "https://github.com/rejetto/hfs2/blob/master/WindowsXP.manifest"
    click recompile_bat "https://github.com/rejetto/hfs2/blob/master/recompile data.bat"
```
