# rlv-dan/snap2html architecture

> Architecture diagram of the GitHub repository rlv-dan/snap2html, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rlv-dan/snap2html
- Repository: https://github.com/rlv-dan/snap2html

## Overview

Snap2HTML is a Windows desktop application that snapshots a folder tree into a self-contained HTML file. Users choose a root folder in the WinForms interface or supply command-line settings; the background worker scans folders and files, builds snapshot data, and writes HTML using a template. The generated page provides a navigable tree, search, and plain-text, CSV, and JSON export. The README documents these viewer capabilities, but the template implementation was not excerpted, so its internal interactions are not mapped. Some UI and settings wiring is likewise only partially visible.

Main entry points: [`Snap2HTML/frmMain.cs`](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/frmMain.cs) (Main window), [`Snap2HTML/frmMain_BackgroundWorker.cs`](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/frmMain_BackgroundWorker.cs) (Snapshot worker), [`Snap2HTML/Program.cs`](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Program.cs) (Application entry), [`Snap2HTML/Models.cs`](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Models.cs) (Snapshot data models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input and UI"]
  node_entry["Application entry<br/>[Program.cs]"]
  node_main["Main window<br/>[frmMain.cs]"]
  node_cli["Command-line parsing<br/>[CommandLine.cs]"]
  node_errorview["Scan error dialog<br/>[frmErrors.cs]"]
end

subgraph group_snapshot["Snapshot generation"]
  node_worker["Snapshot worker"]
  node_models["Snapshot data models<br/>[Models.cs]"]
end

subgraph group_output["HTML experience"]
  node_template["HTML template<br/>[template.html]"]
  node_html["Generated HTML snapshot"]
  node_viewer["Tree, search, exports<br/>[template.html]"]
end

subgraph group_support["Application support"]
  node_settings["User settings<br/>[Settings.cs]"]
  node_dpi["DPI image scaling<br/>[HighDpiHelper.cs]"]
  node_utils["Serialization and utilities<br/>[Utils.cs]"]
end

node_user(("User"))
node_filesystem["Local filesystem"]

node_user -->|"launches"| node_entry
node_entry -->|"opens"| node_main
node_user -->|"selects folder"| node_main
node_main -->|"parses arguments"| node_cli
node_main -->|"loads settings"| node_settings
node_main -->|"adjusts images"| node_dpi
node_main -->|"starts scan"| node_worker
node_worker -->|"enumerates files"| node_filesystem
node_worker -->|"builds snapshot"| node_models
node_worker -->|"serializes data"| node_utils
node_worker -->|"reads template"| node_template
node_worker -->|"writes HTML"| node_html
node_html -->|"renders features"| node_viewer
node_main -->|"shows errors"| node_errorview
node_models -->|"formats timestamps"| node_utils

click node_entry "https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Program.cs"
click node_main "https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/frmMain.cs"
click node_cli "https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Helpers/CommandLine.cs"
click node_settings "https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Helpers/Settings.cs"
click node_dpi "https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Helpers/HighDpiHelper.cs"
click node_worker "https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/frmMain_BackgroundWorker.cs"
click node_models "https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Models.cs"
click node_utils "https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Utils.cs"
click node_template "https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/template.html"
click node_viewer "https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/template.html"
click node_errorview "https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/frmErrors.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_main,node_cli,node_errorview,node_user toneBlue
class node_worker,node_models toneAmber
class node_template,node_html,node_viewer toneMint
class node_settings,node_dpi,node_utils toneRose
class node_filesystem toneIndigo
```

## Components

### Input and UI

- [Application entry](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Program.cs): `Snap2HTML/Program.cs`
- [Main window](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/frmMain.cs): `Snap2HTML/frmMain.cs`
- [Command-line parsing](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Helpers/CommandLine.cs): `Snap2HTML/Helpers/CommandLine.cs`
- [Scan error dialog](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/frmErrors.cs): `Snap2HTML/frmErrors.cs`

### Snapshot generation

- [Snapshot worker](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/frmMain_BackgroundWorker.cs): `Snap2HTML/frmMain_BackgroundWorker.cs`
- [Snapshot data models](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Models.cs): `Snap2HTML/Models.cs`

### HTML experience

- [HTML template](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/template.html): `Snap2HTML/template.html`
- **Generated HTML snapshot**
- [Tree, search, exports](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/template.html): `Snap2HTML/template.html`

### Application support

- [User settings](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Helpers/Settings.cs): `Snap2HTML/Helpers/Settings.cs`
- [DPI image scaling](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Helpers/HighDpiHelper.cs): `Snap2HTML/Helpers/HighDpiHelper.cs`
- [Serialization and utilities](https://github.com/rlv-dan/snap2html/blob/master/Snap2HTML/Utils.cs): `Snap2HTML/Utils.cs`

### Other components

- **User**
- **Local filesystem**

## Connections

- User → Application entry: launches (evidence: `Snap2HTML/Program.cs`)
- Application entry → Main window: opens (evidence: `Snap2HTML/Program.cs`)
- User → Main window: selects folder
- Main window → Command-line parsing: parses arguments (evidence: `Snap2HTML/frmMain.cs`)
- Main window → User settings: loads settings (evidence: `Snap2HTML/frmMain.cs`)
- Main window → DPI image scaling: adjusts images (evidence: `Snap2HTML/frmMain.cs`)
- Main window → Snapshot worker: starts scan (evidence: `Snap2HTML/frmMain.cs`)
- Snapshot worker → Local filesystem: enumerates files (evidence: `Snap2HTML/frmMain_BackgroundWorker.cs`)
- Snapshot worker → Snapshot data models: builds snapshot (evidence: `Snap2HTML/Models.cs`)
- Snapshot worker → Serialization and utilities: serializes data (evidence: `Snap2HTML/frmMain_BackgroundWorker.cs`)
- Snapshot worker → HTML template: reads template (evidence: `Snap2HTML/frmMain_BackgroundWorker.cs`)
- Snapshot worker → Generated HTML snapshot: writes HTML (evidence: `Snap2HTML/frmMain_BackgroundWorker.cs`)
- Generated HTML snapshot → Tree, search, exports: renders features
- Main window → Scan error dialog: shows errors (evidence: `Snap2HTML/frmMain.cs`)
- Snapshot data models → Serialization and utilities: formats timestamps (evidence: `Snap2HTML/Models.cs`)
