ZPreview
Not logged in

ZPreview is a .NET 10 WinForms application for Windows that shows a preview of the file currently selected in ZTreeWin.

The application uses ZaapZTreeState to track the current state of ZTreeWin and to receive events for file changes, OnHold, quit, and Ctrl+Shift shortcuts.

Download and Install

For end-user installation, use one of these downloads:

See ZAAP.net/ZPreview/INSTALL.md for guidance on which variant to choose and full installation steps.

Projects

ZAAP.net/
  ZPreview/                  WinForms application
  ZPreview.Core/             Platform-neutral shortcut/core logic
  ZPreview.Abstractions/     Interfaces and base classes for preview handlers
  ZPreview.PreviewHandlers/  Built-in preview handlers
  ZPreview.SQLitePreview/    SQLite preview handler in its own project
  ZPreview.Core.Tests/       xUnit tests that also run on Linux
  ZPreview.Tests/            UI xUnit tests for WinForms-bound code

Why WinForms

WinForms was chosen here because of:

Architecture

The main application consists of:

The event flow is:

  1. ZaapZTreeState detects a change in ZTreeWin.
  2. ZTreeMonitorController translates that into app events.
  3. MainForm determines which handler should be used.
  4. The active preview control is replaced.

Preview Handler Model

Handlers implement IPreviewHandler from ZPreview.Abstractions.

Important contracts:

Handlers are discovered via assembly scanning:

Plugin load failures are recorded in PluginLoadResult.

Built-in Preview Handlers

Text

Zip Archive

Hex

Image

Windows Preview Handler Host

Thumbnail/Icon

SQLite

Configuration

Configuration is stored in:

%APPDATA%\Zaap\ZPreview\settings.json

This includes, among other things:

Runtime errors and exceptions are also logged to zpreview.log in the same directory as settings.json.

The configuration window contains:

Shortcuts

Global shortcuts from ZTreeWin and local shortcuts in the preview window:

Ctrl+Shift+M now also restores a previously maximized window as maximized.

Handler-specific shortcuts:

Window Position

The window position is remembered per monitor configuration. The fingerprint is calculated from the DeviceName and Bounds of all screens.

For a maximized window, the target monitor is now also remembered so restore happens on the same monitor.

Build and Test

Build:

dotnet build ZAAP.net/ZAAP.net.sln -p:EnableWindowsTargeting=true

Core tests that run on Linux:

dotnet test ZAAP.net/ZPreview.Core.Tests/ZPreview.Core.Tests.csproj

Build UI tests on Linux:

dotnet build ZAAP.net/ZPreview.Tests/ZPreview.Tests.csproj -p:EnableWindowsTargeting=true

ZPreview.Tests is the UI test project (ZPreview.UI.Tests in the solution) and remains bound to WinForms/WindowsDesktop. On Linux you can usually build that project, but not run it without Microsoft.WindowsDesktop.App.

Non-UI-bound or non-Windows-specific functionality belongs in ZPreview.Core, with tests in ZPreview.Core.Tests, so regressions can also actually be run on Linux.

Interactive validation of the UI and Windows Preview Handlers must be done on Windows.

Release Archive

Create and upload the release ZIP with either:

./scripts/publish-zpreview-release.sh
.\scripts\publish-zpreview-release.ps1

The script publishes ZAAP.net/ZPreview/ZPreview.csproj to out/zpreview-release/publish-fdd and out/zpreview-release/publish-sc, creates variant archives ZPreview-fdd-win-x64.zip and ZPreview-sc-win-x64.zip, then uploads both as Fossil unversioned files under /uv/.