How youchenjiang/clickra works
1. What this repository is
Clickra is a Windows 11-native context-menu utility suite built as a self-contained .NET NativeAOT product. The architecture is centered on shell integration plus local file-processing engines, not on a server or browser model.
2. Top-level runtime boundary
The solution is split into three production projects:
- ClickraShell: Windows Explorer integration
- Clickra.CLI: the user-facing Win32/GDI+ UI entrypoints for dashboard and progress windows
- Clickra.Core: all conversion, translation, compression, storage, and business logic
This separation is the main boundary to reflect in an architecture diagram.
3. Shell integration layer
ClickraShell exposes the app to Explorer via manual COM plumbing. It contains COM methods, GUIDs, VTable/export helpers, and Win32 interop for registering and invoking context-menu commands. This layer is responsible for making Clickra appear as a modern Windows 11 submenu and is sensitive to shell-specific ABI details.
4. UI layer: dashboard and progress windows
Clickra.CLI provides the native UI experience using Win32/GDI+ rather than a web or XAML stack. It has two main window families:
- DashboardWindow: system readiness/status, settings, history, and feature overview
- ProgressWindow: long-running job display, password input, tray integration, and process lifecycle
These are split into partial classes by responsibility, such as paint, events, state, hit testing, and lifecycle.
5. Core processing boundary
Clickra.Core is the engine layer. It owns all file-processing orchestration and should be shown as the central processing box in the diagram. The UI and shell layers call into it, but it does not depend on Explorer or the windowing layer.
6. File-processing framework
The core has a common processor hierarchy built around SingleFileProcessorBase, MultiFileProcessorBase, IFileProcessor, and PostProcessor. This framework handles common concerns like batching, cancellation, progress calculation, and cleanup across different file operations.
7. Main operational pipelines
The core processors implement the product’s visible features:
- Office documents to PDF: Word, Excel, PowerPoint processors
- PDF merge
- Image-to-PDF
- Image stitching
- PDF decrypt/removal of passwords
- PDF compression
- PDF translation
These are distinct processor paths, but they share the same orchestration and progress model.
8. PDF translation subsystem
PDF translation is the most complex pipeline in the repo. It is staged into analysis, classification, masking, translation, and rewrite/render steps. Subsystems cover paragraphs, tables, diagrams, gray prompts, annotations, fonts, and layout analysis. A diagram should show this as a multi-stage pipeline rather than a single monolithic translator.
9. Translation providers
The translation layer supports pluggable engines through ITranslationEngine and concrete implementations such as Google Free, MyMemory, identity, and fallback translators. This is a key external-boundary area because translation behavior depends on the selected engine and network availability, even though the rest of the app is local-first.
10. Storage and history
ClickraStorage persists local app state such as active records and history. The README emphasizes a native list-view history experience, so storage should be shown as a local persistence subsystem backing the dashboard’s history and active-job tracking, not as cloud sync.
11. Localization and font handling
The core includes localization helpers, Chinese text conversion, and font resolution. The UI layer also has localized font selection helpers. These pieces matter because the app supports multiple languages and handles PDF text rendering/rewriting across scripts.
12. Native and external dependencies
The solution relies heavily on Windows-specific APIs and native desktop patterns: COM, Win32, GDI+, shell extension registration, and NativeAOT deployment. The product also includes LibreOffice-related installation/dispatch logic as a local fallback engine for Office-to-PDF conversion when Microsoft Office is unavailable.
13. Packaging and release flow
Packaging is MSIX-based, with store assets and app manifest resources under packaging/. Release automation lives in GitHub Actions and helper scripts for building MSIX, version bumps, and Microsoft Store publishing. This is a separate distribution boundary from the runtime architecture.
14. Validation and regression ecosystem
The repository includes a broad test and diagnostics toolchain:
- .NET tests under tests/Clickra.Core.Tests
- Python-based PDF regression and health checks under tests/PdfRegression
- Diagnostic tools under tools/pdf-diagnostics
These are used to validate translation quality, layout behavior, mask coverage, compression, and shell-related edge cases.
15. How the data flows end-to-end
A typical flow is: Explorer invokes a shell command → ClickraShell hands off to the UI entrypoint → Clickra.CLI shows dashboard or progress UI → Clickra.Core runs the selected processor → results are written locally, progress/history are updated, and the UI reflects completion. For translation and compression tasks, the pipeline may branch through analyzers, engine adapters, and post-processors before output is finalized.
Main entry points: PdfTranslationPipeline.cs PDF translate · Clickra.CLI Clickra.CLI · Clickra.Core Clickra.Core · SingleFileProcessorBase.cs Processor base
Components 22
Runtime
Production runtime boundary: shell integration, native UI, and core processing.
- ClickraShell · Explorer-facing COM shell integration and command registration layer.
src/ClickraShell - COM plumbing · Manual COM methods, GUIDs, exports, and shell ABI helpers.
src/ClickraShell/ComMethods.cs - Shell utils · Kernel32 and shell helper glue used by the extension.
src/ClickraShell/ShellUtils.cs - Clickra.CLI · Native Win32/GDI+ entrypoint for dashboard and progress windows.
src/Clickra.CLI - CLI entry · Argument parsing and deployment entrypoint for the native app.
src/Clickra.CLI/Cli/ClickraCli.cs - Dashboard · Readiness, settings, history, and feature overview window.
src/Clickra.CLI/Dashboard/DashboardWindow.cs - Progress · Long-running job window with password input, tray integration, and lifecycle control.
src/Clickra.CLI/Progress/ProgressWindow.cs - Clickra.Core · Core processing engine for conversion, compression, translation, storage, and localization.
src/Clickra.Core - Processor base · Shared file-processing hierarchy with batching, cancellation, progress, and cleanup.
src/Clickra.Core/Processors/FileProcessing/SingleFileProcessorBase.cs - Office to PDF · Word, Excel, and PowerPoint conversion processors.
src/Clickra.Core/Processors/ExcelToPdfProcessor.cs - PDF ops · Merge, decrypt, compress, and image-to-PDF processing paths.
src/Clickra.Core/Processors/FileProcessing/PdfMergeProcessor.cs - Storage & history · Local active-record and history persistence backing dashboard state and job tracking.
src/Clickra.Core/Storage/ClickraStorage.cs - Localization & fonts · Chinese text conversion, localization helpers, and font resolution for UI and PDF text handling.
src/Clickra.Core/Localization/ChineseTextConverter.cs
PDF translation
Multi-stage translation pipeline for PDF analysis, masking, translation, and rewrite.
- PDF translate · End-to-end PDF translation pipeline orchestrating analysis, masking, translation, and rewrite.
src/Clickra.Core/Processors/PdfTranslation/PdfTranslationPipeline.cs - Analysis stages · Paragraph, table, diagram, annotation, gray-prompt, and layout classification stages.
src/Clickra.Core/Processors/PdfTranslation/Paragraphs/PdfParagraphAnalysis.cs - Render stages · Mask planning, translated paragraph rendering, and PDF rebuild/rewrite stages.
src/Clickra.Core/Processors/PdfTranslation/Rendering/PdfRewrite/PdfTranslatedPdfRebuilder.cs - Translation engines · Pluggable translation engines including Google Free, MyMemory, identity, and fallback.
src/Clickra.Core/Translation/TranslationEngineFactory.cs
Distribution
Packaging, manifests, and release automation.
- MSIX packaging · MSIX manifest, app assets, and store resource packaging.
packaging/msix/AppxManifest.xml - Release automation · Build, versioning, and Microsoft Store publishing automation.
scripts/build_msix.ps1
Validation
Tests and diagnostics used to verify core behavior and regressions.
- Core tests · .NET regression suites for layout, compression, translation, and LibreOffice flows.
tests/Clickra.Core.Tests/Program.cs - PDF regression · PDF health, masking, quality, and translation end-to-end regression checks.
tests/PdfRegression/run_translation_tests.py - Diagnostics · PDF inspection and visual-diff tooling used to validate translation output and layout behavior.
tools/pdf-diagnostics/pdf_health.py
Connections 23
- ClickraShell → COM plumbing: implements · Shell extension is built on manual COM plumbing.
- ClickraShell → Shell utils: uses · Shell integration depends on Win32 and shell helper utilities.
- ClickraShell → Clickra.CLI: launches · Explorer commands hand off to the native UI entrypoint.
- Clickra.CLI → CLI entry: starts at · CLI project begins with argument/deployment bootstrap.
- Clickra.CLI → Dashboard: shows · Dashboard window presents readiness, history, and settings.
- Clickra.CLI → Progress: shows · Progress window tracks long-running jobs and tray lifecycle.
- Clickra.CLI → Clickra.Core: calls · UI entrypoints invoke core processors.
- Dashboard → Storage & history: reads/writes · Dashboard history and status are backed by local storage.
- Progress → Storage & history: updates · Progress UI reflects active records and job state persistence.
- Clickra.Core → Processor base: orchestrates · Core processing builds on the shared processor framework.
- Processor base → Office to PDF: drives · Shared batching and lifecycle logic drive Office-to-PDF converters.
- Processor base → PDF ops: drives · Shared batching and lifecycle logic drive PDF operation processors.
- Processor base → PDF translate: drives · Shared batching and lifecycle logic drive translation jobs.
- PDF translate → Analysis stages: analyzes · Translation pipeline first extracts structure and classifies content.
- PDF translate → Translation engines: selects · Pipeline delegates text generation to pluggable engines.
- PDF translate → Render stages: rewrites · Pipeline finishes by masking, rendering, and rebuilding output PDFs.
- PDF translate → Localization & fonts: depends on · Translation and rendering rely on text normalization and font handling.
- Clickra.Core → Storage & history: persists · Core updates active records and history locally.
- Clickra.Core → Localization & fonts: uses · Core shares localization and font resolution helpers.
- MSIX packaging → Release automation: published by · MSIX artifacts are built and published by release scripts.
- Core tests → Clickra.Core: validates · Unit and regression suites cover core processors and engine behavior.
- PDF regression → PDF translate: validates · Python regression suite exercises translation quality and output health.
- Diagnostics → PDF translate: inspects · Diagnostics tools analyze translation artifacts, layout, and masks.