81 Commits
Author SHA1 Message Date
poli0981andClaude Opus 5.5 b2f8982ee6 chore(release): 2.1.0 (#35)
* test(ui): keep the capture modes in a static array (CA1861)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(release): 2.1.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 12:15:08 +00:00
poli0981andClaude Opus 5.5 3f90cbe19a feat(a11y): keyboard region selection, screen-reader announcements and accessibility statement (#34)
- Region overlay: arrow keys move, Shift+arrows resize, Ctrl for 1-pixel
  steps, Tab/Shift+Tab switch monitor, Enter/Esc; keys held as temporary
  hotkeys (arrows auto-repeat, callbacks run in press order).
- LiveRegion behavior and Announcer: status text and notifications are
  announced to screen readers; notifications honour Windows' duration.
- Hotkey recorder: Tab/Shift+Tab leave without saving (Shift+Tab was saved
  as the hotkey); buttons named with their mode and binding.
- List items expose their badges; About cards named; disclaimer headings.
- Tray icon: Enter / Shift+F10 after Win+B; page transitions follow
  Windows' animation setting; contrast colours in the region overlay.
- ACCESSIBILITY.md, accessibility issue template, PR checklist, docs sync.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 12:09:46 +00:00
poli0981andClaude Opus 5.5 da9bcae691 chore(release): 2.0.3 (#33)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 00:39:06 +00:00
poli0981andClaude Opus 5.5 cee0956c99 chore(deps): update SkiaSharp to 4.154.0, build tools and zizmor (#32)
- SkiaSharp 4.153.1 -> 4.154.0 (Skia m154 with Chrome upstream bug fixes);
  third-party notices and lock files follow.
- jetbrains.resharper.globaltools 2026.2.4 and reportgenerator 5.5.12
  (supersedes #31), zizmor 1.32.0 in workflow-lint.
- dependabot.yml: note that Dependabot reports every SkiaSharp 4.x as
  incompatible with net10.0-windows10.0.22621, so it is bumped by hand.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 00:33:20 +00:00
dependabot[bot] 98b96267ec chore(ci): Bump the github-actions group with 2 updates (#30)
Bumps the github-actions group with 2 updates: [actions/setup-dotnet](https://github.com/actions/setup-dotnet) and [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action).


Updates `actions/setup-dotnet` from 6.0.0 to 6.1.0
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](https://github.com/actions/setup-dotnet/compare/a98b56852c35b8e3190ac28c8c2271da59106c68...0f4a354dd5547a28c70b7853dbd95d5b67886e73)

Updates `zizmorcore/zizmor-action` from 0.8.0 to 0.8.1
- [Release notes](https://github.com/zizmorcore/zizmor-action/releases)
- [Commits](https://github.com/zizmorcore/zizmor-action/compare/53290badfa369cb0bf7ad16342cb62c2fa47ac7b...45d7276c9ca790aabd705e31ca99c6185c3e76dd)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: zizmorcore/zizmor-action
  dependency-version: 0.8.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-09 07:26:49 +07:00
poli0981andClaude Opus 5.5 72ad7d9e36 chore(release): 2.0.2 (#29)
- Version 2.0.2; CHANGELOG [2.0.2] - 2026-10-26 (also the release and in-app update notes):
  the .NET 10.0.14 security update as the minimum runtime, Microsoft.Extensions 10.0.14.
- Lock files refreshed for the project versions.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 10:29:38 +00:00
poli0981andClaude Opus 5.5 ec4046c385 chore(deps): require .NET 10.0.14, update Microsoft.Extensions, CsWin32 and CI actions (#28)
.NET 10.0.14 (October 25, 2026) is an out-of-band security release
(CVE-2026-111497 Brotli decoder, re-issued CVE-2026-70197 and
CVE-2026-102870).

- Velopack framework dependency net10-x64-desktop -> net10.0.14-x64-desktop:
  Setup and the in-app updater install the latest .NET 10 Desktop Runtime
  when only an older patch is present (the updater asks first, silent: false).
- Microsoft.Extensions.* 10.0.13 -> 10.0.14, SDK 10.0.401 -> 10.0.403.
- Microsoft.Windows.CsWin32 0.3.363 -> 0.3.367 (build-time only).
- markdownlint-cli2-action v25.0.0, codeql-action/upload-sarif v4.39.1,
  zizmor-action v0.8.0.
- DependencyManifestTests: THIRD_PARTY_NOTICES.md must list exactly the
  app's locked packages at their locked versions, and vpk must match the
  Velopack library.
- README, RELEASING, PRIVACY, notices and release body mention the minimum
  runtime patch.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 10:15:29 +00:00
poli0981andClaude Opus 5.5 f345769e75 refactor: follow the analyzer suggestions SonarQube Cloud reports (#27)
The first CI-based analysis of main imported 104 info-level Roslyn
suggestions as issues (Sonar's own rules found nothing). Applied the fixes
the IDE offers, one diagnostic at a time:

- IDE0290: primary constructors (28 types). Fields stay readonly and are
  initialized from the parameters; <param> docs moved to the type.
- MVVMTK0042: [ObservableProperty] on public partial properties instead of
  fields (70 properties); initializers still set the backing field silently.
  UpdateViewModel's constructor now sets Status through the property, before
  anything subscribes.
- SYSLIB1054: CreateDirect3D11DeviceFromDXGIDevice uses [LibraryImport].
- IDE0007 / IDE0028: var, collection expression.
- Tests: index the monitor list directly (CA1826); seal
  ResxLocalizationServiceTests like the other disposable test classes (CA1816).
- Long primary-constructor parameter lists are wrapped one per line.
- CLAUDE.md: note that SonarQube Cloud reports these suggestions.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 06:38:16 +07:00
poli0981andClaude Opus 5.5 d14d64241e ci: SonarQube Cloud CI-based analysis with coverage; audit .NET tools (#26)
* ci: run SonarQube Cloud analysis in CI with coverage

- New `sonarcloud` job: SonarScanner for .NET 12.0.0 (local tool) begin, build,
  tests with Cobertura coverage and TRX results, end, which waits for the
  quality gate. It passes without analysing when SONAR_TOKEN is not available
  (fork and Dependabot pull requests).
- Coverage leaves out CaptureImage.UI and CaptureImage.App, which ui-tests and
  publish-smoke exercise out of process.
- audit: check the .NET tools in .config/dotnet-tools.json against nuget.org's
  vulnerability data (tool-audit.ps1); neither NuGet's audit nor the dependency
  graph covers them.
- Dependabot: update dotnet-sonarscanner with the dev-tools group.
- Tests: await the async File APIs inside async tests (Sonar S6966).
- Docs: CLAUDE.md, CONTRIBUTING, ARCHITECTURE, SECURITY, README badges, CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci(sonarcloud): leave CI scripts out of coverage, skip non-main branch runs

- PR 26's gate failed only on coverage: SonarQube Cloud counts PowerShell as
  coverable code, so the 60 lines of tool-audit.ps1 were new, uncovered code.
  `.github/**` joins the coverage exclusions.
- The free plan analyses main and pull requests only; a workflow_dispatch run
  on another branch uploaded its report and then failed with "Organization is
  not allowed to access data from non main branches". Such runs now pass
  without analysing, like runs without SONAR_TOKEN.
- Icons and PNGs are project items the scanner read as UTF-8 text; exclude
  them from the analysis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 06:19:41 +07:00
poli0981andClaude Opus 5.5 926dfd2d72 fix: 2.0.1 — clipboard-only errors, HDR infinity pixels, Steam scan retry, readable About page (#25)
* fix: clipboard-only errors, non-finite HDR pixels, Steam scan retry, readable pages

- Clipboard-only captures that could not be copied were reported as successful although
  nothing was saved or copied; they now fail with the new CaptureError.ClipboardFailure and
  its message in all 11 languages.
- The HDR tone mapper turned +infinity into black (inf / inf = NaN) and let a NaN channel
  skip the highlight roll-off. Channels are now read as 0 for NaN/negative values and capped
  at the largest half value, so infinite highlights become white.
- SteamLibraryScanner cached a failed scan in its Lazy<T> and rethrew it on every lookup.
  An unreadable library is now skipped, and a failed scan is retried a minute later.
- Pages set the theme's text colour as their Foreground: a Page in a Frame does not inherit
  it, so unstyled text (About's component names and disclaimer headings) was drawn dim grey.
- The library grid lays thumbnails out from the left edge (SpacingMode None) instead of
  spreading the leftover width around them.
- About: the capture notice no longer mentions the GDI PrintWindow fallback removed in 2.0.0,
  and the translation notice points to src/CaptureImage.ViewModels/Resources/Strings/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(release): 2.0.1

- Version 2.0.1; CHANGELOG [2.0.1] - 2026-10-19 (also the release and in-app update notes).
- Lock files refreshed for the project versions.
- README screenshots re-rendered with 2.0.1 (demo data, hidden desktop): readable About text and
  the left-aligned library grid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 12:58:46 +07:00
poli0981andClaude Opus 5.5 999694c4b8 ci(release): write SHA256SUMS without hashing the file being written (#24)
Out-File creates SHA256SUMS.txt when the pipeline starts, so Get-ChildItem listed
the open file and Get-FileHash failed on it, which stopped the v2.0.0 release after
packing. Hash the assets first, then write the file, and leave the sums file out of
its own list.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 11:48:18 +07:00
poli0981andClaude Opus 5.5 6a21c531f6 chore(release): 2.0.0 (#23)
* chore(release): 2.0.0

- Version 2.0.0 in Directory.Build.props (the release workflow checks the tag against it).
- CHANGELOG: the v2 notes become [2.0.0] - 2026-10-19 under a new empty [Unreleased], plus the
  fix for settings missing from the file losing their defaults.
- Dependabot: open-pull-requests-limit back to 5 (NuGet) and 3 (Actions) now that the rewrite
  has landed; the config notes how to re-lock a NuGet update on Windows.
- ui-tests is now a required check on main; CLAUDE.md, CONTRIBUTING and the workflow comment
  say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: stop the release and deadcode jobs on any failing command

On Windows runners a multi-line pwsh step only fails when its last native command
fails. The release build ran restore, build and test before `dotnet tool restore`,
so a failing test could still produce a release; the deadcode job had the same
shape. Each command now runs in its own step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(changelog): list the end-to-end UI tests among the required checks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 11:05:41 +07:00
poli0981andClaude Opus 5.5 7d68be7c7f feat!: CaptureImage 2.0 — WPF UI, per-mode hotkeys, multi-monitor, HDR, library, game profiles (#22)
* refactor(core)!: v2 capture model, settings v3, profiles, coordinator

- remove the WinUI projects (replaced by WPF in this branch); resx files and
  ResxLocalizationService move to ViewModels so they stay framework-agnostic
- capture model: CaptureMode (Window/Region/Monitor), CaptureSource,
  CaptureOptions, MonitorInfo/HdrInfo, PixelRect; frames carry a pixel format
  (BGRA8 or scRGB FP16) so HDR captures flow through the pipeline
- HdrToneMapper (scRGB -> sRGB with a C1-continuous highlight shoulder),
  FrameOperations (crop, force opaque)
- AppSettings v3: one hotkey per mode, HDR/PNG/cursor/window-frame options,
  start-with-Windows, arm-on-startup, game profiles; unknown fields round-trip
  via JsonExtensionData; SettingsMigrator moves v1/v2 files forward
- GameProfile + ProfileResolver (exe path > exe name > Steam AppId)
- FileNameStrategy: fixed Windows-invalid set, strips bidi/zero-width
  characters, guards CON/NUL/COM1..., caps length, working {counter}, {Mode}
- CaptureFileWriter: encode off-thread to .tmp, move without overwrite, retry on
  name races, optional JPEG XR HDR sidecar
- CaptureCoordinator replaces the Stateless state machine and the duplicated
  save pipeline in DashboardViewModel: one capture at a time (busy requests are
  ignored instead of throwing), cancellable countdown/selection/preview,
  frozen-snapshot region capture across monitors, profile auto-arm
- interfaces for the WinEvent watcher, RegisterHotKey service, display/HDR
  info, region selector, library, shell, sound, autostart, diagnostics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(infra)!: RegisterHotKey, WinEvent watcher, WGC monitor/HDR capture, WIC

- hotkeys: Win32 RegisterHotKey on a dedicated message-loop thread (no global
  keyboard *and mouse* hook any more), MOD_NOREPEAT, real conflict detection,
  temporary keys for the region overlay; SharpHook and HotkeyConflictSniffer gone
- window list: SetWinEventHook (create/destroy/show/hide/rename/minimize/
  foreground) replaces WMI polling every 2 s; TargetCatalog runs off the UI thread,
  skips cloaked windows and reads exe paths with QueryFullProcessImageName (works
  for elevated games); bounded LRU icon cache
- DisplayService: monitors in physical pixels with DPI, HDR state per output via
  IDXGIOutput6 on every adapter, SDR white level via DisplayConfig
- WgcCaptureEngine: window and monitor sources, BGRA8 or FP16 HDR, client-area /
  ContentSize crop on the GPU, cancellable timeout, late frames disposed, device
  lost -> recreate and retry once, no RCW leaks (vtable interop), safe readback
- encoders: SkiaSharp (PNG with selectable zlib level, JPEG 4:4:4 at q>=90, WebP)
  without extra copies or premultiplied-alpha transparency; WIC for TIFF and the
  JPEG XR HDR sidecar
- JsonSettingsStore v3: real atomic replace, serialized writes, backups of
  corrupt/older/newer files, v1 file adopted from the install folder, validated
  import that rejects UNC output folders
- CaptureLibraryService (index + WIC thumbnails + Recycle Bin), ShellService,
  SoundService, PerformanceModeService (EcoQoS), AutostartService,
  DiagnosticsExporter, OCR from BGRA frames with cached engines, Velopack 1.2
  WaitExitThenApplyUpdates, log path redaction, VDF depth limit
- packages: + Microsoft.Windows.CsWin32 (build-time), Vortice.Direct2D1 (WIC);
  - SharpHook, Stateless, System.Management, System.IO.Abstractions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(viewmodels)!: v2 view models for the WPF shell

Rewrite the view-model layer against the v2 Core abstractions, with no
framework or OS calls inside view models:

- Shell (tray tooltip, arm/disarm, capture per mode, exit through
  IAppLifetime), Dashboard (in-place window list refreshed by WinEvent
  notifications only while visible, target lock, per-hotkey status),
  Library (lazy thumbnails, filters, copy/OCR/pin/delete to Recycle Bin),
  Profiles (editor, create from a Dashboard window), Settings (write-
  through, per-mode hotkey recorder with conflict checks, import/export,
  reset, diagnostics), Logs (batched, paused, filtered), Update (localized
  status, cancellable check/download, apply on exit), About, Preview.
- Coordinator gains SuspendHotkeys() so the recorder receives combinations
  that are currently registered.
- IImageDecoder + WIC implementation for library copy/OCR/pin.
- Localization service uses source-generated logging, narrows its catch
  and can match the OS language to a shipped culture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(ui)!: WPF + WPF UI shell, tray, overlays and 11-language strings

Replace the WinUI 3 front end with WPF on .NET 10 and WPF UI 4.3:

- CaptureImage.UI: FluentWindow + NavigationView (Dashboard, Library,
  Profiles, Settings, Logs, Update, About) with pages resolved from DI,
  {loc:Tr} live localization, RTL + per-window language, WPF UI themes
  (System/Light/Dark/High contrast), snackbar in the window and
  non-activating, capture-excluded toast pop-ups when it isn't in front.
- Region selection: one frozen overlay per monitor placed in physical
  pixels at the monitor's DPI; Esc/Enter also registered as temporary
  hotkeys so they work while a game holds the keyboard.
- Preview window, pinned thumbnails, clipboard (bitmap + PNG), dialogs,
  hotkey recorder (Alt combos, Print Screen key-up).
- Tray icon (H.NotifyIcon.Wpf) with an armed indicator; re-added after
  Explorer restarts.
- CaptureImage.App: Velopack hooks first, per-user single instance over a
  CurrentUserOnly pipe, Serilog (async file + in-memory, user paths
  redacted), validated container, --data-dir / --instance-id /
  --minimized / --smoke-test / --screenshots, PerMonitorV2 + long paths
  manifest, multi-size app icon, commit recorded for "2.0.0 (abc1234)".
- Strings: 306 keys translated into all 11 languages; tests compare key
  sets per culture without fallback, check placeholders and that every
  key the code uses exists and every key is used.
- Settings records keep unknown JSON fields with a settable
  ExtensionData (the source generator can't bind init-only ones).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(ui)!: view-model and FlaUI suites, WPF publish smoke, stricter analyzers

- 135 view-model tests (settings write-through and reload, hotkey recorder
  with suspension, conflicts and validation, in-place window list,
  profiles, library filters and delete, log viewer batching, update flow,
  shell tray state, About links and third-party coverage, preview/OCR).
- CaptureImage.App.UiTests: FlaUI end-to-end tests against the real exe
  with a temporary data folder and instance id (navigation, arming,
  language switch, Arabic RTL, hotkey recorder, hide to tray + second
  launch). They skip unless CAPTUREIMAGE_UI_TESTS=1; new `ui-tests` job.
- CI publish-smoke publishes framework-dependent, runs --smoke-test with
  page screenshots (uploaded as an artifact) and checks the payload;
  deadcode now covers the UI and App projects.
- Release: framework-dependent publish + smoke test, vpk --framework
  net10-x64-desktop and --icon. Package .pdb/.xml stay out of the
  installer (publish 143 MB -> 51 MB, Setup ~28 MB).
- src/ builds with AnalysisMode=Recommended (warnings are errors);
  CA1716/CA1873 off with reasons, CA1822 off for bound view models.
- Test projects moved to the "tests" solution folder; Dependabot groups
  and the license ignore list follow the new dependencies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: redundant casts and an unused P/Invoke result found by InspectCode

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui): hide and exit after Closing returns; let sign-out close the app

Hiding or shutting down from inside Window.Closing can throw ("while a
Window is closing"), and tray Exit / Windows sign-out went through
Application.Shutdown without allowing the main window to close. Defer the
hide/exit, route IAppLifetime through App.RequestExit and allow close on
SessionEnding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(changelog): v2.0 notes under Unreleased

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(logging): render enums without JSON quotes in the log file and viewer

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(app): give the startup and shutdown log lines a source context

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(ui): drop the sleep-and-retry temp cleanup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui): keep running when the tray icon can't be created

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(infra): extract window icons with Win32 and WIC instead of System.Drawing

IconExtractor now takes the executable's own 48 px icon with SHDefExtractIcon
(falling back to the shell icon from SHGetFileInfo) and encodes it to PNG with
the WIC factory the app already uses. That removes the last System.Drawing.Common
reference and its central pin, which NuGet's package pruning resolved differently
on Linux than on Windows and broke the locked restore of the audit and license jobs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui): expose pages to UI Automation as named panes

WPF creates no automation peer for Page, so the pages' automation ids and titles
never reached UI Automation: screen readers had no region to announce and the UI
tests could not find a page. Each page now creates a pane peer named after its
localized title.

The language UI test also waits for the debounced settings write instead of
reading settings.json once, which raced on the CI runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(core): v2 Core test suite

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: run the audit and license checks on Windows runners

NuGet prunes the WPF projects' Windows Desktop packages (System.Drawing.Common,
System.Diagnostics.EventLog, ...) only when restoring on Windows, so a locked
restore on Linux could never match the lock files. Both jobs now restore exactly
like the build job. The license job's restore is split so a failed package
restore can't be masked by the tool restore that follows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: v2 README, contributor guides, legal texts and contacts

- README, ARCHITECTURE, RELEASING, dev_env and pc_spec (+ Vietnamese) describe the WPF app,
  per-mode hotkeys, library, profiles, HDR, the framework-dependent installer and the new data
  folder; new screenshots rendered from seeded demo data (no personal windows or paths).
- PRIVACY, TERMS, DISCLAIMER, THIRD_PARTY_NOTICES and NOTICE match what v2 does and ships
  (clipboard, OCR, WinEvent hook, named pipe, library index, autostart, diagnostics export).
- New CONTRIBUTING, CODE_OF_CONDUCT, SUPPORT and CODEOWNERS; issue and PR templates updated.
- Contacts: contact@poli0981.dev and https://poli0981.dev/links, plus the role aliases
  (security@, privacy@, legal@, copyright@, dmca@, takedown@, code@, sponsor@, games@, collab@,
  press@) where each one belongs.
- CLAUDE.md covers the v2 layout, required checks, release steps, the Windows-only restore and
  how README screenshots are made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(infra): v2 Infrastructure test suite

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: address the SonarCloud findings on the v2 branch

- S2190: LocalizationSource.FlowDirection shared its name with the FlowDirection enum it
  returns, which reads as a recursive property; it is now CurrentFlowDirection.
- S8949: the coordinator's hotkey and auto-arm paths pass CancellationToken.None explicitly
  (a hotkey capture has no caller to cancel it; CancelCurrent() still stops it).
- S6640: unsafe code is how the Infrastructure assembly talks to Win32, Direct3D and WinRT; the
  rule is acknowledged once for that assembly with a justification instead of per call site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 10:52:30 +07:00
poli0981andClaude Opus 5.5 c649442a3a chore!: .NET 10 foundation, required CI quality gates, hardened release pipeline (#21)
* chore(build)!: move to .NET 10 LTS, refresh dependencies, enforce LF + SPDX headers

.NET 9 reaches end of support on 2026-11-10 and this machine only has .NET 10
SDKs, so the repo no longer built locally.

- global.json: SDK 10.0.401 (latestFeature) + Microsoft.Testing.Platform runner
- all projects retargeted to net10.0 / net10.0-windows10.0.22621.0
- Directory.Build.props: single version source (App no longer overrides it),
  TreatWarningsAsErrors everywhere, lock files + locked restore in CI,
  NuGetAudit (all, low), EnableWindowsTargeting (Dependabot evaluated every
  Windows-TFM project as "not compatible" without it), XML docs on so IDE0005
  runs in build
- packages: Microsoft.Extensions 10.0.13, Serilog 4.4.0 (+ sinks/extensions),
  CommunityToolkit.Mvvm 8.4.2, Stateless 5.20.1, Vortice 3.8.3, SkiaSharp
  4.153.1, Velopack 1.2.161 (DownloadUpdatesAsync lost ignoreDeltas;
  CheckForUpdatesAsync now honours cancellation via WaitAsync), WinAppSDK last
  1.8 patch
- security: drop SixLabors.ImageSharp 3.1.12 (GHSA-j3p4-wp97-rph4,
  GHSA-j9gm-c75j-xc9q, GHSA-jjfr-hcj7-qf5w high; GHSA-gwg2-r3hj-4w44,
  GHSA-wmxv-xphr-5c9g moderate) — TIFF now goes through the built-in WIC
  encoder (opaque, LZW)
- removed unused references: M.E.Hosting/Localization/Options/DI.Abstractions
  where unused, Serilog sinks in Infrastructure, SkiaSharp.NativeAssets.Win32
  (transitive), CsWinRT, Microsoft.Win32.Registry, H.NotifyIcon,
  Hosting.Abstractions
- tests: xunit 2 -> xunit.v3 4.0.2 (MTP v2), FluentAssertions 6 ->
  AwesomeAssertions 9 (FA >= 8 is commercially licensed), NSubstitute 6,
  coverlet -> Microsoft.Testing.Extensions.CodeCoverage; tests pass the xunit
  cancellation token
- .gitattributes: eol=lf everywhere (matches .editorconfig); .gitignore now
  ignores .idea/ and .claude/
- .editorconfig: SPDX header template (IDE0073) and IDE0161/0065/0005/0051/
  0052/0059/0060 enforced in build; headers added to every C# file, whitespace
  normalised; dead IID field and unused parameter/field removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: required quality gates, hardened release pipeline, working Dependabot

New required checks (one job each, no path filters so they always report):
- build: locked restore, Release build with warnings as errors, tests on
  Microsoft.Testing.Platform with Cobertura coverage summarised in the job summary
- format: `dotnet format whitespace` + style subset (SPDX header, file-scoped
  namespaces, using placement, unnecessary usings)
- deadcode: JetBrains InspectCode gated on file-local dead/redundant-code rules
  (WinUI projects excluded until they are replaced)
- audit: `dotnet list package --vulnerable --include-transitive` parsed by a gate
  script (the command itself always exits 0)
- license: nuget-license allowlist for the shipped app's dependency closure
- publish-smoke: publishes the app and verifies the payload (.pri/.xbf, legal docs)
- pr-title (Conventional Commits), dependency-review (vulnerabilities of any
  severity + non-free licenses), workflow-lint (actionlint + zizmor), docs
  (markdownlint + offline lychee); weekly external link check and OpenSSF
  Scorecard are informational

Release workflow:
- version taken from the tag through env + SemVer regex (removes the
  `${{ github.event.inputs.version }}` script injection) and checked against
  Directory.Build.props; prerelease derived from the version
- vpk pinned through the tool manifest (was unpinned while the library was
  0.0.1053); full packages only, so the previous release's 100 MB package is no
  longer re-uploaded; release notes come from CHANGELOG (the in-app update page
  showed none); identical packId/title/shortcuts/mainExe
- CycloneDX SBOM, SHA256SUMS of this version's assets, build-provenance
  attestations; release is created as a draft via gh (no third-party action with
  a write token); workflow_dispatch can rebuild an existing tag or dry-run

Other workflows: every action pinned to a commit SHA; least-privilege
permissions per job; notify-ci-failure ignores fork pull requests (they could post
their commit message to Discord) and all callers pass only the secrets they need
instead of `secrets: inherit`; announce-release now fires because releases are
published with a user token; discussion-welcome pinned and lists security@.
Removed .github/scripts/discord_notify.py (unused; the reusable workflows carry
their own copy).

Dependabot: EnableWindowsTargeting fixes the "not compatible" evaluation;
dead avalonia group removed; ecosystems grouped (incl. Velopack + vpk), 3-day
cooldown, tool manifest covered; version-update PRs paused (limit 0) until the
2.0.0 release.

Repo tooling: .config/dotnet-tools.json (vpk, InspectCode, nuget-license,
ReportGenerator, CycloneDX), markdownlint + lychee configs, RuntimeIdentifiers
win-x64 for stable lock files, CLAUDE.md for AI assistants, markdown lint fixes,
and the remaining InspectCode findings in Core/Infrastructure/ViewModels fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: fix first-run findings of the new gates

- dependency-review: drop Commons-Clause from deny-licenses (not an SPDX id)
- docs: disable markdownlint MD060 (table pipe alignment) introduced in
  markdownlint 0.41, which the CI action ships
- Dependabot cooldown 3 -> 7 days (zizmor dependabot-cooldown audit)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: quote InspectCode arguments, force HTTPS for actionlint download

- PowerShell splits a dash-prefixed native argument at its first period, so
  -o=inspectcode.sarif reached InspectCode as two arguments ('Specify only one
  solution file'); arguments are now quoted
- curl in workflow-lint refuses non-HTTPS protocols and redirects (SonarCloud
  githubactions:S6506)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 08:02:41 +07:00
dependabot[bot] 726f3076d7 chore(ci): Bump actions/setup-dotnet from 5 to 6 (#19)
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 5 to 6.
- [Commits](https://github.com/actions/setup-dotnet/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-07 16:19:49 +07:00
dependabot[bot] 61582eaf45 chore(deps): Bump the test-tooling group with 1 update (#20)
Bumps coverlet.collector from 10.0.1 to 10.1.0

---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-version: 10.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: test-tooling
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-07 16:18:46 +07:00
dependabot[bot] 90381a0e71 chore(ci): Bump actions/checkout from 6 to 7 (#18)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-25 21:13:49 +07:00
dependabot[bot] de7d4ee57e chore(deps): Bump the test-tooling group with 1 update (#17)
Bumps coverlet.collector from 10.0.0 to 10.0.1

---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-version: 10.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: test-tooling
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-21 22:06:24 +07:00
dependabot[bot] 297de450b3 chore(ci): Bump actions/github-script from 7 to 9 (#16)
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 9.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v9)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-18 21:32:46 +07:00
dependabot[bot] d80ae48174 chore(deps): Bump coverlet.collector from 8.0.1 to 10.0.0 (#8)
---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-version: 10.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: test-tooling
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-14 09:25:12 +07:00
poli0981 d01293f1a4 Hotfix v1.5.1
Hotfix mini-cycle — CI hardening, supply-chain SHA pinning, dev-env docs, About page Social/Donate/Report Bug, notify-* filter narrowing, discussion-welcome workflow. 7 milestone commits preserved.
2026-05-11 20:38:22 +07:00
poli0981andClaude Opus 4.7 394e108c22 chore(changelog): note M6 (notify filter narrow) and M7 (discussion welcome)
Two bullets added under [1.5.1]:

- Under Changed: notify workflows narrowed from workflows:["*"] to
  the specific workflows they monitor (CI, Release), stopping the
  skip-run spam in the Actions tab.

- Under Added: discussion-welcome.yml — bilingual greeting for new
  Discussion threads opened by non-maintainers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 20:36:20 +07:00
poli0981andClaude Opus 4.7 fb06950389 feat(ci): add discussion-welcome workflow
Auto-post a brief bilingual greeting (Vietnamese + English) the
first time a non-maintainer opens a Discussion thread. Directs the
poster at the right venue:

  - Bugs           -> in-app "About -> Report a bug" or the
                      bug-report issue template
  - Security       -> GitHub Security Advisories, not a public
                      discussion
  - Q&A / ideas    -> Discussions, where they already are

Skipped for OWNER / COLLABORATOR / MEMBER (the maintainer doesn't
need a venue cheat-sheet on their own threads). Uses the GraphQL
`addDiscussionComment` mutation via actions/github-script@v7, the
only scope required is `discussions: write` — everything else is
defaulted to read.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 20:35:48 +07:00
poli0981andClaude Opus 4.7 9f04b96eb6 fix(ci): narrow notify-* workflow_run filters to stop skip spam
Both notify caller workflows previously listened to
`workflows: ["*"]`, which fires the caller on every workflow
completion in the repo — every CI run, every release run, every
notify run itself. The Actions tab filled with skipped entries from
two workflows reacting to events they had no business reacting to.

- notify-ci-failure: narrowed to `workflows: ["CI"]` and gated the
  job on `github.event.workflow_run.conclusion == 'failure'`. The
  reusable still re-checks conclusion as defense-in-depth, but the
  caller now short-circuits on green builds before invoking it.

- notify-release-pipeline: narrowed to `workflows: ["Release"]`.
  Intentionally excludes "Announce Release to Discord" — that
  workflow already posts to Discord, routing it through this
  notifier too would double-post.

Effect: roughly 50% fewer notify-* runs in the Actions tab; the
remaining runs all correspond to events worth observing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 20:34:56 +07:00
poli0981andClaude Opus 4.7 4eb8f75072 chore(release): prepare v1.5.1 — README support section, version bump, changelog
Three release-prep touches:

1. README — new "Support the project" section preceding License,
   linking GitHub Sponsors, Ko-fi, Buy Me a Coffee, Patreon, and
   pointing at the in-app Report-a-bug button.

2. App.csproj — bump <Version> from 1.5.0 to 1.5.1. Picked up at
   build time and surfaced in MainWindow PaneHeader and the About
   page's "Version" row.

3. CHANGELOG — new [1.5.1] - 2026-05-11 entry following the
   Keep-a-Changelog format used for v1.5.0: Fixed (CI permissions),
   Changed (SHA pin), Added (3 About sections + FUNDING.yml +
   dev/spec docs + README section), Smoke checklist.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 20:20:46 +07:00
poli0981andClaude Opus 4.7 928badc87c feat(about): add Social Dev, Donate, Report Bug sections
About page grows three small sections between the metadata card and
the existing AI-assistance disclosure:

1. Social Dev — ItemsControl rendering 8 HyperlinkButtons (X,
   YouTube, Discord repo/game, Steam, Bluesky, Mastodon, Telegram).
   HyperlinkButton.NavigateUri opens the URL via
   Windows.System.Launcher — same shell-execute behaviour as the
   existing OpenUrl helper used by the repo link.

2. Support the project — short prose + 4 buttons (GitHub Sponsors
   accent-styled, Ko-fi, Buy Me a Coffee, Patreon). Donate URLs
   hardcoded in AboutViewModel to match the existing
   Developer/RepositoryUrl pattern. Mirror of .github/FUNDING.yml —
   keep in sync.

3. Report a bug — single low-friction button targeting the GitHub
   bug-report issue template
   (https://github.com/poli0981/captureimg/issues/new?template=bug_report.yml).

Public-handle scope only: personal email (proton.me) and PayPal
real-name link intentionally not exposed here.

Localization adds 9 new keys per locale × 11 locales = 99 .resx
entries. EN + VI human-written; the other 9 locales follow the
existing machine-assisted convention documented in
About_TranslationDisclaimer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 20:20:01 +07:00
poli0981andClaude Opus 4.7 d547a6da25 docs: add FUNDING.yml + pc_spec / dev_env (EN + VI mirrors)
Three additions for v1.5.1:

1. .github/FUNDING.yml — wires the GitHub repo "Sponsor" button to
   GitHub Sponsors (poli0981), Ko-fi, Buy Me a Coffee, and Patreon
   (all under handle "skullmute"). Public-handle scope only; email
   and PayPal intentionally omitted.

2. docs/pc_spec.md (+ docs/i18n/vi/pc_spec.md) — public reference
   for the maintainer's primary development hardware. Documents the
   Win11 Insider Dev Channel build, RTX 5080, JetBrains 2026.x
   lineup. Mobile test devices listed for transparency but flagged
   as not used for CaptureImage itself (Win11-only desktop).

3. docs/dev_env.md (+ docs/i18n/vi/dev_env.md) — toolchain versions
   (.NET 9, Python 3.12, Node 22+ LTS, Rust stable, Git + GPG),
   Rider plugin recommendations, Windows SDK requirement,
   build/test/run commands, release tooling. Mirrors the CI command
   in .github/workflows/ci.yml so contributors run the same locally.

VI mirrors keep tech terms (toolchain names, file paths, env vars)
in English per the repo bilingual convention; cross-links between
VI docs target VI siblings, with EN-only docs flagged explicitly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 20:11:48 +07:00
poli0981andClaude Opus 4.7 c48dc38e92 fix(ci): add minimum permissions to ci.yml + pin reusable workflow refs
Two CI hardening changes:

1. ci.yml previously had no top-level permissions block, which Code
   Scanning flagged as "Workflow does not contain permissions." Now
   declares the minimum it actually needs: contents: read (to checkout
   the repo and run dotnet build/test). No package writes, no release
   uploads, no PR comments.

2. announce-release.yml, notify-ci-failure.yml, and
   notify-release-pipeline.yml previously referenced
   poli0981/.github/.github/workflows/*.yml@main. A push to ops-repo
   main would land in our release pipeline silently. Now pinned to
   commit SHA e973e2f15725356653ef07539016670ad2733f83. Dependabot
   already has the github-actions ecosystem rule (.github/dependabot.yml
   line 39-51); it will bump these refs weekly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 20:09:30 +07:00
poli0981 d8b5e2e436 Refactor workflows to use reusable configurations for Discord notifications 2026-05-09 01:16:18 +07:00
poli0981 4f7059e585 Add notify release pipeline workflow for Discord notifications 2026-05-08 21:12:11 +07:00
poli0981 acaee4a0a0 Enhance Discord notification helper with phase 2 commands and improved webhook handling 2026-05-08 20:10:16 +07:00
poli0981 3bb238be3f Add CI failure notification workflow for Discord
This workflow listens for CI failures and posts notifications to a Discord channel.
2026-05-08 18:47:16 +07:00
poli0981 c6e4145f5d Add GitHub Actions workflow to announce releases on Discord 2026-05-08 18:46:40 +07:00
poli0981 33d6b0c004 Add Discord notification helper script
This script helps send notifications to Discord via webhooks for release announcements and CI failure alerts. It includes configuration for colors, truncation of messages, and handles environment variables for dynamic content.
2026-05-08 18:45:49 +07:00
poli0981 419ab7a627 Merge pull request #14 from poli0981/release/v1.5.0
release: v1.5.0 — process leak fix, theme sync, +4 langs, 4 features
2026-05-07 21:48:42 +07:00
poli0981andClaude Opus 4.7 a29217a324 chore(release): bump to v1.5.0
Closes the v1.5 cycle: process-leak fix + theme-sync fix + 4 new
languages + 4 new features (countdown / clipboard / pinned thumbnail /
OCR / region capture) + single-instance guard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 21:34:34 +07:00
poli0981andClaude Opus 4.7 72a6730c84 test(v1.5-M9): regression test for new AppSettings defaults
Locks in the v1.5 schema defaults so a future refactor can't silently
flip CountdownSeconds=3 or AutoPinAfterCapture=true and surprise
existing users on upgrade. Also smoke-tests the `with` round-trip to
guard against the STJ source-gen init-default gotcha from the v1.2
cycle ledger.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 21:33:04 +07:00
poli0981andClaude Opus 4.7 94027889d3 feat(v1.5-M8): region capture mode
A new Settings → Capture mode dropdown switches between Window mode
(default; existing Windows.Graphics.Capture pipeline) and Region mode,
which opens a full-screen overlay so the user can drag-select any
rectangle of the desktop.

Flow:
1. Region hotkey fires → service captures the primary monitor pixels
   in one GDI shot (CopyFromScreen). This locks the source image
   BEFORE the overlay appears, so the overlay never shows up inside
   the screenshot.
2. RegionSelectorOverlay shows the dimmed screenshot full-screen, with
   a Border that re-shows the image at 100% inside the user's drag
   rectangle (a "spotlight" effect that needs no clip path).
3. On pointer release, the original BGRA buffer is cropped to the
   selected rect and packaged into a CapturedFrame, which then flows
   through the existing Preview / Save / Clipboard / Pinned-thumbnail
   pipeline unchanged.
4. Esc or a micro-drag (<4 px) cancels — state machine returns to
   Armed without firing FrameCaptured.

v1.5 ships primary-monitor support only. Multi-monitor + per-monitor
DPI scaling is on the v1.6 roadmap (the codepath already accepts a
RECT in pixel coords; it just hasn't been generalised to enumerate
DisplayArea.FindAll yet).

5 new localization keys (Settings_CaptureMode, …Window, …Region,
Region_TargetName, Region_DragHint) added to all 11 packs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 21:31:48 +07:00
poli0981andClaude Opus 4.7 38b1554dc5 feat(v1.5-M7): built-in offline OCR via Windows.Media.Ocr
PreviewWindow gains an Extract Text (OCR) button that runs the OS-supplied
OCR engine on the captured frame and copies recognised text to the
clipboard. All processing is on-device — nothing leaves the machine,
which fits the local/private ethos.

- IOcrService + OcrResult abstraction in Core/Abstractions so portable VM
  code stays free of WinRT references; WindowsOcrService in Infrastructure
  wraps OcrEngine.TryCreate* with a 3-tier fallback chain (explicit lang
  tag → user profile languages → en-US → unavailable).
- IClipboardService grew a CopyText overload so the OCR result can land
  in the clipboard in plain-text form (callers already had the image
  variant).
- PreviewViewModel: ExtractTextCommand calls OCR, copies, and surfaces
  one of three toast outcomes — N words copied / no text / engine
  unavailable — all localized.
- 4 new keys (Preview_ExtractText, Toast_OcrSuccess, Toast_OcrEmpty,
  Toast_OcrUnavailable) added to all 11 packs.

Note: engine availability depends on the user's installed OCR language
packs (Settings → Time & language → Language & region → Optional
features). The fallback chain keeps things working when the requested
language pack isn't installed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 21:25:42 +07:00
poli0981andClaude Opus 4.7 f296756b0d feat(v1.5-M6): pinned floating thumbnail window
After capture, optionally spawns a small always-on-top window holding a
thumbnail of the shot — handy for comparing successive captures or
keeping a reference visible while playing/working in another app.

- PinnedThumbnailWindow: 280×220, Mica backdrop, ExtendsContentIntoTitleBar
  for a draggable header strip with Show-in-Explorer + Close buttons. The
  always-on-top behaviour comes from OverlappedPresenter.IsAlwaysOnTop —
  cleaner than SetWindowPos(HWND_TOPMOST) and reverts naturally if the
  user un-pins later.
- Theme tracking via the M3 ThemeApplicator (subscribes to ISettingsStore.
  Changed; unsubscribes on Closed) so dark-mode users don't get a Light
  flash.
- Each capture spawns a fresh window, so the user can pile up multiple
  pins to compare side-by-side.
- DashboardViewModel encodes PNG once and feeds the same buffer into both
  the clipboard service and the pin host (lazy `EnsurePngAsync` cache).

Settings: new `UISettings.AutoPinAfterCapture` toggle. Pinning from the
Preview window's Save button is deferred — the auto-pin checkbox covers
the headline use case for v1.5.

3 new localization keys (Settings_AutoPinAfterCapture, PinnedWindow_Open,
PinnedWindow_Close) added to all 11 packs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 21:20:38 +07:00
poli0981andClaude Opus 4.7 56cd1047c2 feat(v1.5-M5): countdown delay, clipboard mode, auto-open folder
Three small Settings toggles that have been frequently requested:

- **Capture countdown** (Off / 3s / 5s / 10s) — runs before the state
  machine fires HotkeyPressed, so the dashboard still reads "Armed"
  during the wait and StatusMessage shows "Capturing in N…" each tick.
  Useful for capturing tooltips and menu animations that vanish when
  you Alt-Tab back from the target.
- **Clipboard mode** (None / Copy only / Copy + Save) — the encoder
  pipeline now optionally produces PNG bytes that flow through the new
  IClipboardService into the WinRT clipboard. "Copy only" skips the
  file write entirely.
- **Open output folder after save** — toggle on UI page; reuses the
  existing UseShellExecute pattern.

The clipboard service is a thin abstraction over WinRT's DataPackage
+ InMemoryRandomAccessStream so portable VM code stays free of
Windows.* references.

12 new localization keys added to all 11 packs; SettingsViewModel
gains CountdownOption / ClipboardOption helpers (parallel of the
ThemeOption pattern) so ComboBox labels rebuild cleanly on culture
switch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 21:16:04 +07:00
poli0981andClaude Opus 4.7 933e872b49 feat(v1.5-M4): add fr-FR, de-DE, pt-BR, ru-RU language packs
Brings shipped locales to 11 (en, vi, ar, ja, zh-Hans, ko, es + new fr,
de, pt-BR, ru). Each pack carries the full 112-key load. The translation
disclaimer in every pre-existing locale was also updated to mention the
four new languages so the About page stays honest about what's machine-
assisted.

Test plumbing: LocalizationCompletenessTests' Theory matrix now spans all
11 cultures, and both ResxLocalizationServiceTests and the completeness
tests are pinned to a shared xUnit collection so they can't race on the
process-wide CultureInfo.DefaultThreadCurrent* statics — adding 4 more
cultures to the parallel pool finally tipped that pre-existing race into
a consistent failure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 21:07:07 +07:00
poli0981andClaude Opus 4.7 cfe2b5ce69 feat(v1.5-M3): sync PreviewWindow theme with main app via ThemeApplicator
PreviewWindow used to ship with whatever theme the OS happened to be on
because it never read the persisted theme from ISettingsStore. Now it
mirrors MainWindow: applies the saved theme before Activate (no flash on
open) and re-applies on every settings.Changed (so toggling theme while
the preview is up updates it live). The Closed handler unsubscribes so
each preview doesn't leak a handler into the singleton settings store.

Extracted the string→ElementTheme switch into ThemeApplicator so future
secondary windows (pinned thumbnail, region overlay) reuse the same
mapping and can't drift.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 20:56:04 +07:00
poli0981andClaude Opus 4.7 9f5986dbac feat(v1.5-M2): single-instance guard with restore-on-relaunch
A second launch of the app no longer spawns a duplicate process — instead it
pings the existing instance over a named pipe and the original window pops to
the foreground. Mirrors the Spotify/Slack pattern.

- SingleInstanceGuard.TryAcquire holds Local\CaptureImage.SingleInstance.<user>
  scoped per OS user; abandoned mutex from a crashed prior run is treated as
  acquired so we don't lock ourselves out.
- ActivationListener runs a NamedPipeServerStream loop on a background task
  and posts the restore sequence to the UI thread on ACTIVATE — same
  AppWindow.Show + ShowWindow(SW_RESTORE) + SetForegroundWindow dance the
  tray icon already uses.
- Guard runs AFTER VelopackApp.Build().Run() so installer/uninstaller hooks
  (--squirrel-*) keep working.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 20:54:03 +07:00
poli0981andClaude Opus 4.7 585dfb3de5 fix(v1.5-M1): close dispose chain to stop process zombies on exit
DashboardViewModel.Dispose was missing _watcher.Stop() — the WMI watcher's
ManagementEventWatcher subscriptions run on non-background threads, so when
the dashboard tore down its other watchers but left the WMI one alive the
CLR couldn't unwind on exit. Combined with the fact that Program.Main
never disposed the IServiceProvider, the entire singleton graph (tray,
foreground watcher, WMI watcher) leaked across each launch — Task Manager
accumulated one zombie CaptureImage.exe per app open.

Two-line fix: stop the WMI watcher in DashboardViewModel.Dispose and
dispose App.Services in Program.Main's finally block. ServiceProvider
disposal now cascades through every IDisposable singleton.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 20:51:42 +07:00
poli0981 e5ddc4e3ac Merge pull request #13 from poli0981/release/v1.4.0
v1.4.0 — UX polish + accessibility cycle
2026-04-27 09:36:26 +07:00
poli0981andClaude Opus 4.7 81563c65f0 fix(v1.4-M3): use GetForegroundWindow inside the WinEvent callback
The original M3 implementation trusted the hwnd parameter the OS
passes to the WinEvent callback. On Win11 that's reliable for
mouse-click activations (single clean event with idObject=OBJID_WINDOW)
but breaks Alt-Tab: the modern Task View overlay fires events whose
hwnd points at a DWM-cloaked window, and the secondary event for the
real destination sometimes carries idObject != 0 (which the previous
'if (idObject != 0) return' filter dropped on the floor).

Net effect for users: enabling auto-switch only updated the selected
target on click, never on Alt-Tab.

Fix:
- Add User32.GetForegroundWindow P/Invoke.
- Inside OnRawForegroundEvent, ignore the event-supplied hwnd and
  poll GetForegroundWindow() to get the real current foreground at
  callback time. The 250 ms debounce already collapses the burst of
  events Alt-Tab fires into a single delivery.
- Drop the idObject != 0 short-circuit. WINEVENT_SKIPOWNPROCESS plus
  the explicit pid check still keep our own windows out.

Also adds a Debug-level log when the watcher fires - makes future
diagnosis easier without touching Information level for end users.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 09:30:10 +07:00
poli0981andClaude Opus 4.7 e13b9a6b56 chore(release): bump to v1.4.0
UX polish + accessibility cycle (M1-M7).

- Window fixed at 1200x720, maximize and resize disabled
- Light / Dark / System theme picker
- Auto-switch on Alt-Tab (opt-in)
- 4 new language packs: ja-JP, zh-Hans, ko-KR, es-ES (machine-assisted)
- Friendlier end-user log lines + new lifecycle events
- Tests cover 7 cultures x load-bearing keys (401 cases)

Publish smoke verified locally - .xbf + .pri custom MSBuild target
from v1.3.1 still propagates correctly, all 6 non-English satellite
assemblies materialize under bin/.../publish/{ar,es,ja,ko,vi,zh-Hans}/.

settings.json schema is unchanged (Theme stays a string, default
"System"; Capture.AutoSwitchOnAltTab is a new optional bool that
defaults false on missing). Existing v1.3.x users upgrade in place
without migration.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 09:12:07 +07:00
poli0981andClaude Opus 4.7 414d145bc8 test(v1.4-M6): smoke coverage for Win32ForegroundWindowWatcher
Three lifecycle tests - new instance not running, stop-before-start
is a no-op, dispose is idempotent. The actual SetWinEventHook path
needs a UI thread with a live message pump and is exercised manually
during QA on Win11.

The localization completeness matrix already covers all 7 cultures
(401 cases) - that's M6's other tested deliverable, picked up via the
M5 commit. Manual QA matrix (7 cultures x 3 themes x auto-switch
on/off) lives outside the automated suite and runs against the M7
publish output.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 09:09:43 +07:00
poli0981andClaude Opus 4.7 1a57c07409 feat(v1.4-M5): add ja-JP, zh-Hans, ko-KR, es-ES language packs
Brings shipped culture count to 7. Translations are machine-assisted
- the About > Translations disclaimer now lists all 6 non-English
packs and invites native-speaker proofreading PRs.

- src/CaptureImage.UI/Resources/Strings/Strings.{ja,zh-Hans,ko,es}.resx
  translate all 56 keys (nav, dashboard, settings, hotkey errors,
  update, about, log viewer, preview, toasts, tray menu).
- ResxLocalizationService.ShippedCultures grows to 7 entries
  (en-US, vi-VN, ar-SA + ja-JP, zh-Hans, ko-KR, es-ES). All 4 new
  cultures are LTR so existing RTL handling for Arabic stays
  unchanged.
- LocalizationCompletenessTests.CultureMatrix iterates all 7 - 401
  test cases now assert every load-bearing key is non-bracketed and
  non-empty in every shipped culture.
- Updated About_TranslationDisclaimerBody in en/vi/ar to reference
  the full set of machine-translated packs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 09:08:12 +07:00
poli0981andClaude Opus 4.7 edf6ab93d7 feat(v1.4-M4): friendlier log messages + new lifecycle log sites
End-user-facing logs are now phrased like a person, not a stack
trace.

New log sites:
- "Picture captured: {Name} ({W}x{H}, {KB} KB) at {Path} [{Format}]"
  on success (replaces "Capture OK -> ...").
- "Picture capture cancelled by user." on OperationCanceledException
  AND CaptureException(Cancelled).
- "Picture capture failed: {Reason}" on other CaptureExceptions.
- "Language switched to {Code} ({Name})." on culture change.
- "Capture sound {State}." on sound toggle.
- "Auto-switch on Alt-Tab {State}." on toggle.

Tone shift on existing sites - "Failed to X" -> "Couldn't X" across
DashboardViewModel, SettingsViewModel, UpdateViewModel, AboutViewModel,
LogViewerViewModel. Structured properties unchanged so log queries and
diagnostics still work.

Logs remain English-only per v1.2 design (file shareability + parser
stability across cultures).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 09:00:39 +07:00
poli0981andClaude Opus 4.7 b9ec09c62e feat(v1.4-M3): auto-switch capture target when Alt-Tab
Adds an opt-in foreground watcher so the dashboard's selected
target follows whichever window has focus.

- IForegroundWindowWatcher (Core.Abstractions): contract for
  start/stop + ForegroundChanged event.
- Win32ForegroundWindowWatcher (Infrastructure.Processes):
  SetWinEventHook on EVENT_SYSTEM_FOREGROUND with
  WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS, plus a 250ms
  debounce timer so rapid Alt-Tab sequences only fire once on
  the landing window. Holds a strong reference to the delegate
  so the OS doesn't AV when the next event arrives.
- AppSettings.Capture.AutoSwitchOnAltTab (default false) — bool
  toggle. Source-gen STJ picks it up automatically.
- DashboardViewModel: subscribes to ForegroundChanged, marshals
  to UI via IUIThreadDispatcher, matches HWND against the
  Targets collection. Non-target windows keep current selection
  so users who Alt-Tab to Explorer/Settings don't lose context.
  Watcher start/stop driven by ApplyAutoSwitchSetting() called
  from the constructor and OnSettingsChanged.
- SettingsViewModel + SettingsPage: CheckBox with hint copy.
- Strings.{en,vi,ar}.resx: new keys + completeness test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 08:56:05 +07:00
poli0981andClaude Opus 4.7 bef2e2fdc6 feat(v1.4-M2): wire Light/Dark/System theme
AppSettings.Theme was reserved in v1.3 but never applied. M2 hooks
it up:

- SettingsViewModel: SelectedTheme + SupportedThemes (rebuilt on
  culture change so labels stay localized), persists via Update().
- SettingsPage: new Theme ComboBox sandwiched between Language and
  Hotkey, ItemTemplate binds to localized DisplayLabel.
- MainWindow.ApplyTheme: maps "Light"/"Dark"/"System" to ElementTheme,
  hops via DispatcherQueue so callers don't have to.
- App.OnLaunched: applies persisted theme before Activate, then
  re-applies on every ISettingsStore.Changed.
- Strings.resx/vi/ar: 4 new keys (Settings_Theme + System/Light/Dark).
- LocalizationCompletenessTests: theme keys added to LoadBearingKeys.

XAML audit found zero hardcoded brushes - v1.3 migrate already used
ThemeResource throughout, so light/dark flips with no extra cleanup.
Mica Base re-tints with the resolved theme automatically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 08:48:42 +07:00
poli0981andClaude Opus 4.7 1e02f7578e feat(v1.4-M1): fix window size + disable maximize/resize
Cast AppWindow.Presenter to OverlappedPresenter and clear
IsMaximizable + IsResizable. Window stays at 1200x720; minimize
remains enabled for tray flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 08:41:22 +07:00
poli0981andClaude Opus 4.7 8baefc4a1e chore: remove unused System usings from Program.cs
Leftover cleanup from v1.3 cycle.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 08:40:49 +07:00
poli0981andClaude Opus 4.7 4c1dba2dbd fix(release): v1.3.1 hotfix — copy .xbf + .pri to publish output
v1.3.0 shipped broken. The WinUI 3 publish pipeline silently omits two
file types from the self-contained publish output:

  1. .xbf — compiled XAML binary format (MainWindow.xbf, App.xbf, plus
     every Page/UserControl in CaptureImage.UI/Controls/ +
     CaptureImage.UI/Views/). Without these,
     Application.LoadComponent throws XamlParseException at runtime on
     every ms-appx:/// XAML reference.
  2. CaptureImage.App.pri — the app's compiled Package Resource Index.
     Without it, Windows can't resolve any ms-appx:/// URI at all,
     including the WinAppSDK theme resources at
     ms-appx:///Microsoft.UI.Xaml/Themes/themeresources.xaml.

Both files are produced into bin/Release/.../win-x64/ during build but
`dotnet publish --self-contained` skips them. v1.3.0 users got an installer
+ Velopack pack that ran fine, but the new app's MainWindow constructor
threw on InitializeComponent and the UI thread caught it via App.Unhandled-
Exception — process kept running, no window ever appeared. Silent failure.

Bisect:
- Local Debug bin works (XAML compiler outputs to obj/, .NET picks them
  up via Content items at runtime).
- Local Release bin works (.xbf + .pri land in bin/.../win-x64/).
- Local Release publish FAILS (.xbf + .pri NOT propagated to publish
  output) — same failure as the GitHub Actions release.yml.

Fix: add a custom MSBuild target `CopyWinUIArtifactsToPublishDirectory`
(AfterTargets="ComputeFilesToPublish") that explicitly adds every .xbf
plus $(AssemblyName).pri from $(OutDir) to ResolvedFileToPublish,
preserving the cross-assembly subfolder structure the XAML compiler
creates. Verified: publish-fix2/ now contains all 10 expected .xbf
(App, MainWindow, 4 Pages, 2 Controls, LogViewerView, PreviewWindow,
UpdatePage) + CaptureImage.App.pri; launched .exe completes full boot
path through Tray icon initialization.

Bumps version 1.3.0 → 1.3.1. CHANGELOG [1.3.1] hotfix section explains
the bug and recovery path for users already on broken v1.3.0 (Update
tab can't reach them since their window never opens — they need to
download the new Setup.exe manually).

Tests: 320/320 pass (Core 67 + Infra 60 + VM 22 + UI 171).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 12:36:20 +07:00
poli0981andClaude Opus 4.7 0967de6ceb chore(release): bump to v1.3.0
Cut the v1.3.0 WinUI 3 / Fluent 2 release. Closes the v1.3 cycle that ran
M1 → M7b on branch feature/v1.3-winui3 from v1.2.0 baseline.

Version bump:
- src/CaptureImage.App/CaptureImage.App.csproj: <Version>1.3.0-dev</Version>
  → <Version>1.3.0</Version>. release.yml's tag-driven publish overrides
  this via /p:Version=$(steps.version.outputs.version) so the dev marker is
  cosmetic; bumping it keeps `dotnet run` builds reporting the right number.

CHANGELOG.md:
- New [1.3.0] - 2026-04-26 section with Added / Changed / Removed / Fixed /
  Deferred-to-v1.4 subsections. Headlines: WinUI 3 + Fluent 2 + Mica
  migration, sound on capture (was a v1.2 feature gap), Browse button,
  Composition slide animation, +164 tests (total 320 incl. 141-case
  3-culture localization completeness matrix).

release.yml:
- Drop /p:PublishSingleFile=true + /p:IncludeNativeLibrariesForSelfExtract=true
  + /p:EnableCompressionInSingleFile=true — WinAppSDK can't bundle into a
  single .exe; multi-file self-contained is the only option for unpackaged
  WinUI 3.
- Add /p:Platform=x64 + /p:WindowsPackageType=None for explicitness.
- Header comment updated.
- Add ./releases/*.zip to upload list (carry-over from v1.2 — Velopack's
  CaptureImage-win-Portable.zip output never reached the Release page).
- Release-body description adds the Portable.zip line.

Doc sync (Avalonia → WinUI 3 references in current-state docs; CHANGELOG
history of v1.0–v1.2 stays untouched since those releases WERE Avalonia):
- README.md: project structure description (CaptureImage.UI now hosts
  WinUI 3 Pages + UserControls).
- docs/ARCHITECTURE.md: layer rules + dependency mermaid + i18n sequence
  diagram + startup-order list now reference WinUI 3 / WinAppSDK.
  CaptureImage.UI TFM updated to net9.0-windows10.0.22621.0.
- docs/CONTRIBUTORS.md: acknowledgement updated — WindowsAppSDK / WinUI 3
  team for v1.3+, Avalonia team retained as historical credit for
  v1.0–v1.2, H.NotifyIcon team added.
- docs/legal/THIRD_PARTY_NOTICES.md: UI framework section rewritten —
  Microsoft.WindowsAppSDK + WinUI + SDK.BuildTools + H.NotifyIcon.WinUI +
  System.Drawing.Common; Avalonia.* + Inter typeface dropped.
- docs/legal/DISCLAIMER.md + TERMS.md: trademark lists swap "Avalonia"
  for "WinUI" + "Windows App SDK".

Verification:
- dotnet build: 0 errors, 0 warnings.
- dotnet test: 320/320 pass (Core 67, Infra 60, VM 22, UI 171).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 11:57:57 +07:00
poli0981 0cb119be6e remove unused using 2026-04-26 11:49:48 +07:00
poli0981andClaude Opus 4.7 319a3756ba test(v1.3-M7b): converter coverage + localization completeness matrix
Round out v1.3 test coverage. Total goes from 156 → 320 (+164 tests).

CaptureImage.Core.Tests/Models/LogEntryTests.cs (new — 5 tests):
- TimestampText (the v1.3-M5 addition that exists because WinUI 3 {Binding}
  doesn't honour StringFormat) — asserts HH:mm:ss.fff InvariantCulture format.
- FileLineText edge cases (both present, file missing, line missing, line=0).

CaptureImage.UI.Tests/Converters/ (new — 18 tests across 4 files):
- FlowDirectionConverter: LTR, RTL, null defensive default, unexpected type,
  ConvertBack throws.
- BoolToVisibilityConverter: true → Visible, false → Collapsed, null → Collapsed,
  ConvertBack roundtrip.
- InvertedBoolToVisibilityConverter: inverted mappings, ConvertBack roundtrip.
- NotNullToVisibilityConverter: null, string, empty string, object, ConvertBack
  throws.

These were the 4 v1.3-M4 / M6 converters with zero test coverage. All depend
only on Microsoft.UI.Xaml.{FlowDirection, Visibility} enums (no XAML runtime
init needed) so they run cleanly in xUnit on the net9.0-windows10.0.22621.0
TFM that UI.Tests already targets.

CaptureImage.UI.Tests/Localization/LocalizationCompletenessTests.cs (new —
3 cultures × 47 keys = 141 Theory cases):
- Asserts every load-bearing UI string (nav rail labels, page headers, dialog
  buttons, tray menu, toast headlines, preview prompt) renders to a non-empty,
  non-bracketed value in en-US / vi-VN / ar-SA. The bracketed fallback
  (e.g. "[Nav_Dashboard]") signals a missing resx entry; this matrix catches
  that early instead of during user testing.
- 47 curated keys cover what an end-user actually sees during normal flows.
  New visible labels added in v1.4+ should be appended to LoadBearingKeys
  to keep the matrix comprehensive.

Coverage of the new v1.3 services that genuinely need a UI thread (TrayIconHost,
PreviewPresenter, Win32FolderPicker, WinUIThreadDispatcher, HotkeyRecorder)
is intentionally NOT added — they require a live WinAppSDK runtime + XAML
context that xUnit can't realistically provide. Their behaviour is exercised
through the smoke runs at every milestone.

Verification:
- dotnet build: 0 errors, 0 warnings.
- dotnet test: 320/320 pass (Core 67, Infra 60, VM 22, UI 171).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 11:29:06 +07:00
poli0981andClaude Opus 4.7 8d460a5afa fix(v1.3-M7a): 2nd-pass fixes for drawer, tray menu, folder picker
User-reported regressions after the M7a 1st-pass interactive verification:
3 of 7 fixes didn't actually solve the issue. This commit re-fixes them
with the right WinUI 3 idioms.

#1 Log drawer still rendering on the leading edge (Column-based positioning
   from 1st pass didn't help):
- The bug was Composition `visual.Offset = (48, 0, 0)` OVERRIDING the
  layout-computed position rather than adding on top. So regardless of
  HorizontalAlignment / Grid.Column, the drawer rendered at absolute x=48
  on first measure. After window resize the layout pass reset Offset and
  the drawer snapped to its anchored position — matching the user's
  observation.
- Fix: switch to the WinUI 3 Translation pattern. Call
  `ElementCompositionPreview.SetIsTranslationEnabled(LogDrawer, true)`
  once on Loaded, then animate `visual.Properties["Translation"]`
  (additive on top of layout) instead of `visual.Offset` (which overrides
  it). Drawer now stays pinned to Grid.Column=1 (right 480 px) and
  Translation supplies the slide offset only. Same animation duration +
  easing as v1.2-M7.

#6 Tray right-click menu items not invoking actions (single-click +
   double-click on the icon work fine; only the popup menu items don't):
- Click event on MenuFlyoutItem doesn't route reliably when the flyout is
  hosted by H.NotifyIcon's TaskbarIcon ContextFlyout — H.NotifyIcon shows
  the popup outside the normal XAML routing chain so click events drop
  on the floor.
- Fix: switch all menu items from Click event to Command property using
  the same SimpleCommand pattern that already worked for
  LeftClickCommand / DoubleClickCommand on the TaskbarIcon. Upgraded
  click logging from Debug → Information so menu invocations now show
  in the default log level.

#3 Browse button throwing COMException 0x80004005 on PickSingleFolderAsync:
- `Windows.Storage.Pickers.FolderPicker` is unreliable in unpackaged
  WinUI 3 even with `WinRT.Interop.InitializeWithWindow` correctly set
  up — it throws E_FAIL with no recoverable detail. Known issue across
  WinAppSDK versions.
- Fix: replace with a Win32 IFileOpenDialog COM-interop helper
  (`Win32FolderPicker.PickSingleFolder`) using FOS_PICKFOLDERS +
  FOS_FORCEFILESYSTEM + FOS_NOCHANGEDIR option flags. Modern Vista+ Open
  dialog look, no package identity required, 100% reliable across SDK
  versions. ~150 lines of P/Invoke + COM declarations all kept in one
  file so the workaround is self-contained.
- SettingsPage.xaml.cs now passes the current OutputDirectory as the
  initial location so the dialog opens at the previously-chosen folder.

Verification:
- dotnet build: 0 errors, 0 warnings.
- dotnet test: 156/156 pass — same baseline.
- Smoke run: app boots through full path, no exceptions. Interactive
  re-verification of the 3 fixed paths is the user's job (drawer slide
  to right edge on click; tray menu items fire actions; Browse opens
  IFileOpenDialog and writes back to OutputDirectory).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 11:22:37 +07:00
poli0981andClaude Opus 4.7 6656e6380c fix(v1.3-M7a): sharp-edge sweep from interactive verification
Seven user-reported issues from M6 visual verification, fixed in priority
order (highest user-impact first).

#2 Title bar overlap (caption buttons obscuring nav rail / drawer / pages):
- MainWindow.xaml: split root Grid into 2 rows. Row 0 = 48 px transparent
  Border (AppTitleBar) reserved as drag region; Row 1 = body Grid. The
  Mica backdrop still covers the full window; the OS-drawn caption
  buttons land inside Row 0's reserved strip without overlapping content.
- MainWindow.xaml.cs: SetTitleBar(AppTitleBar) right after Activate so the
  drag region is registered with the windowing system.

#1 Log drawer rendering on the leading edge until window resize:
- MainWindow.xaml: body Grid now has 2 columns ("*" + "480"). LogDrawer
  pinned to Column 1 instead of relying on HorizontalAlignment="Right",
  which WinUI 3 doesn't honour reliably on first measure (drawer would
  render on the leading edge until a relayout). NavigationView spans
  both columns. Composition animation Offset.X +48/−48 still slides the
  drawer correctly under both LTR and RTL.

#6 Tray menu/click broken when minimized:
- TrayIconHost.cs ShowMainWindow(): now calls AppWindow.Show +
  ShowWindow(SW_RESTORE) + Activate + SetForegroundWindow. AppWindow.Show
  alone leaves a taskbar-minimized window minimized; ShowWindow(SW_RESTORE)
  handles that case. SetForegroundWindow forces Z-order to top even when
  another app has focus.
- TaskbarIcon.NoLeftClickDelay = true so single-click fires immediately
  instead of waiting ~500 ms for a possible double-click.
- DoubleClickCommand also wired to ShowMainWindow so either user habit
  works.
- Diagnostic logging on each menu Click handler so we can tell whether
  the click fired or the action silently failed.
- _quitting flag bypasses the MinimizeToTray hide-instead-of-close
  intercept when the user picks Exit from the tray menu — without it,
  Application.Current.Exit() would loop forever as the closing handler
  cancelled the shutdown.

#5 Auto-refresh disrupting preview decisions:
- DashboardViewModel.OnProcessChanged: skip RefreshAsync while
  _stateMachine.CurrentState is Previewing or Saving. Rebuilding Targets
  during a preview replaces the GameTargetViewModel instances and
  shuffles SelectedTarget out from under the user. The next process
  event after the preview closes triggers a fresh debounce — nothing's
  lost.

#3 Browse button no-op:
- SettingsPage.xaml.cs: wire BrowseOutputButton.Click to a FolderPicker
  flow. WinUI 3 unpackaged needs explicit HWND association via
  WinRT.Interop.InitializeWithWindow, otherwise the picker silently
  no-ops or crashes. HWND comes from the host window via a new
  WindowHostHelper static accessor (CaptureImage.UI side), set by
  App.OnLaunched after the main window is created. The picker writes
  the chosen path back through SettingsViewModel.OutputDirectory which
  already round-trips through ISettingsStore.

#4 Sound on capture (was a v1.2 feature gap):
- DashboardViewModel: hook the success path of CaptureOnceAsync to
  PlayCaptureSoundIfEnabled, gated on Settings.UI.SoundEnabled (the
  checkbox shipped in v1.0 but had no consumer). Uses Win32 PlaySound
  via P/Invoke instead of System.Media.SystemSounds — the latter ships
  in System.Windows.Extensions which only targets Windows TFMs, and
  ViewModels.csproj is intentionally TFM-portable. PlaySound("SystemAsterisk",
  IntPtr.Zero, SND_ASYNC | SND_ALIAS) works on net9.0 portable.

#7 Third-party list update:
- AboutViewModel.cs: drop "Avalonia" + "Inter typeface" entries; add
  "Windows App SDK / WinUI 3" and "H.NotifyIcon.WinUI". Other entries
  (SkiaSharp, Velopack, etc.) still ship.

Carry-overs (intentionally NOT fixed in M7a):
- Tray icon still ships with OS default glyph (real .ico round-trip
  deferred to v1.4 — see feedback_h_notifyicon_winui_quirks.md).
- Indexer-style {Binding Localization[Key]} bindings — verify in M7b
  3-culture smoke; port to computed properties only if WinUI 3 doesn't
  refresh them on culture change.

Verification:
- dotnet build: 0 errors, 0 warnings.
- dotnet test: 156/156 pass — same baseline.
- Smoke run: app boots clean through full path; no exceptions in startup.
  Interactive re-verification of each of the 7 fixes is the user's M7b job.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 11:01:40 +07:00
poli0981andClaude Opus 4.7 c7e9db3673 feat(v1.3-M6): port HotkeyRecorder + ToastHost; rewrite Tray + Preview
Sixth milestone of v1.3. Replace the M1 stubs (StubTrayIconHost,
StubPreviewPresenter) with real implementations and port the two custom
controls (HotkeyRecorder, ToastHost) that the v1.2 SettingsPage and
MainWindow shell depended on.

Directory.Packages.props:
- Rename `H.NotifyIcon.WindowsAppSDK 2.2.0` -> `H.NotifyIcon.WinUI 2.2.0`
  (the original package id from v1.2 doesn't exist on nuget.org;
  WinUI is the actual WinAppSDK-compatible variant).

CaptureImage.UI.csproj:
- Add PackageReference H.NotifyIcon.WinUI + System.Drawing.Common.

App.xaml:
- Register ToastKindToBrushConverter at Application.Resources scope.

CaptureImage.UI/Controls/HotkeyRecorder.xaml(.cs):
- WinUI 3 UserControl. ContentControl is the focusable surface (Border can't
  receive keyboard focus; ContentControl is the smallest stock element with
  IsTabStop + KeyDown). Captures key events while IsRecording, queries
  modifier state via Microsoft.UI.Input.InputKeyboardSource.GetKeyStateForCurrentThread.
  VirtualKey enum values match Win32 VK codes 1:1, so persistence carries
  the integer through unchanged. ESC alone cancels; pure modifier keys
  swallow the event and wait for a real combination.

CaptureImage.UI/Controls/ToastHost.xaml(.cs):
- WinUI 3 UserControl. Drops v1.2's custom ItemsSource StyledProperty —
  inherits MainWindowVM context from the host root Grid and binds the
  inner ItemsControl directly to {Binding Toasts}. Cleaner, sufficient
  for v1.3's single host site.

CaptureImage.UI/Converters/ToastKindToBrushConverter.cs:
- Recreate the v1.2 converter against Microsoft.UI.Xaml.Media.SolidColorBrush.
  Same accent colors as v1.2 (Tailwind sky-500/green-500/amber-500/red-500).

CaptureImage.UI/Services/TrayIconHost.cs (new, replaces StubTrayIconHost):
- H.NotifyIcon.WinUI's TaskbarIcon backed by a MenuFlyout context menu.
  Show / Open Folder / Exit items, each rebuilt on culture change.
- close-to-tray: AppWindow.Closing intercept (Window.Closed has no Cancel
  hook in WinUI 3). Cancel + AppWindow.Hide() when MinimizeToTray is on.
- Show from tray: AppWindow.Show + Window.Activate.
- Quit: Application.Current.Exit.
- Icon: SkiaSharp PNG draw is preserved + exercised, but TaskbarIcon.IconSource
  isn't set yet — H.NotifyIcon's IconSource pipeline ends in
  System.Drawing.Icon which only accepts .ico file streams; real .ico round-
  trip via HICON needs P/Invoke cleanup that's out of scope for M6. OS
  default glyph in the meantime; M7 polish ships the real .ico.

CaptureImage.UI/Services/PreviewPresenter.cs (new, replaces StubPreviewPresenter):
- Encodes the captured frame to PNG bytes (port of v1.2 SkiaSharp pixel-
  install path), opens a non-modal PreviewWindow on the UI thread, awaits
  PreviewWindow.ResultAsync. Disposes the per-call PreviewViewModel after
  the window closes so the singleton localization service doesn't leak
  PropertyChanged subscribers.

CaptureImage.UI/Views/PreviewWindow.xaml(.cs) (new):
- 720x560 modal-style child window with Mica backdrop + extended title
  bar. Save / Discard buttons + X-to-close all resolve ResultAsync to the
  appropriate bool. FlowDirection bound via the App.xaml-scoped converter.

CompositionRoot.cs:
- Swap StubTrayIconHost -> TrayIconHost, StubPreviewPresenter -> PreviewPresenter.
- Drop the CaptureImage.UI.Services.Stubs using.

MainWindow.xaml:
- Add xmlns:controls. Embed <controls:ToastHost/> as the last overlay child
  of the root Grid (anchored bottom-right, RTL mirrors to bottom-left).

SettingsPage.xaml:
- Replace the M4 placeholder TextBox in the Hotkey section with the real
  <controls:HotkeyRecorder DataContext="{Binding Hotkey}" />.

Removed: src/CaptureImage.UI/Services/Stubs/{StubTrayIconHost,StubPreviewPresenter}.cs
— no longer referenced after the swap.

Verification:
- dotnet build: 0 errors, 0 warnings.
- dotnet test: 156/156 pass.
- Smoke run: tray initialized + visible, no exceptions on boot, all 4
  Pages still resolve, log shows full happy path through OnLaunched.
  Interactive verification of tray menu / hotkey capture / preview modal /
  toasts is left to the user — animations + window activation only show
  on a real display.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 10:16:03 +07:00
poli0981andClaude Opus 4.7 d0ebf6548d feat(v1.3-M5): port LogViewer + Composition-API animated drawer
Fifth milestone of v1.3. Port the slide-in log drawer that PaneFooter's
button toggles. Animation re-implementation uses the WinUI 3 Composition
API (ElementCompositionPreview + Visual.StartAnimation) instead of the
v1.2 Avalonia Style + Transitions pattern.

LogEntry (Core/Models):
- Add TimestampText computed property formatting Timestamp as
  "HH:mm:ss.fff" (InvariantCulture). WinUI 3 {Binding} doesn't honour
  StringFormat the way Avalonia/WPF do; baking the format into the model
  keeps view XAML free of one-off converters.

LogViewerView (UI/Views/, new):
- UserControl, presentation-only — animation is the host MainWindow's job
  so this stays composable + future overlays can reuse the pattern.
- Border with chrome background (LayerFillColorAltBrush), top-left rounded
  corner only (matches v1.2's right-anchored drawer aesthetic).
- Header: Title + filter label + level ComboBox + Pause/Clear/Reveal
  buttons + EventsCountText.
- Body: ScrollViewer + ItemsControl with 4-col DataTemplate (Timestamp,
  Level, FileLineText, Message) all in monospace; empty-state TextBlock
  overlays via converters.

MainWindow.xaml:
- LogViewerView added as the last child of the root Grid (overlays the
  NavigationView). Width=480, HorizontalAlignment=Right, DataContext bound
  to MainWindowVM.LogViewer. Stays in the visual tree always — never
  toggle Visibility, only Opacity + Offset, so Composition has something
  to animate every time.
- xmlns:views added.

MainWindow.xaml.cs:
- Hook Root.Loaded to push the drawer to its initial collapsed state via
  Composition: Offset.X = +48 (or -48 under RTL), Opacity = 0,
  IsHitTestVisible = false.
- Subscribe to vm.PropertyChanged in SetViewModel; when IsLogViewerVisible
  flips, fire AnimateDrawer with target offset/opacity.
- AnimateDrawer uses CubicBezier(0.4, 0, 0.2, 1) easing (Material/Fluent
  decelerate) which is visually indistinguishable from v1.2's
  CircularEaseOut for sub-300ms motion. SlideDuration=220ms,
  FadeDuration=180ms — same numbers as v1.2-M7.
- GetCollapsedOffsetX() reads Root.FlowDirection so the drawer slides
  toward the correct edge under RTL (M7 will smoke-test ar-SA).

Verification:
- dotnet build: 0 errors, 0 warnings.
- dotnet test: 156/156 pass — same baseline; LogEntry property addition
  is purely additive and doesn't break any existing test.
- Smoke run: app boots cleanly; OnRootLoaded fires (drawer collapses
  silently), no exception. Interactive verification of the actual slide
  animation is left to the user — Composition smoothness only shows on a
  real display.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 09:58:02 +07:00
poli0981andClaude Opus 4.7 c477dfe144 feat(v1.3-M4): port Dashboard, Update, Settings, About to WinUI 3 Pages
Fourth milestone of v1.3. Replace the M3 placeholder Pages with the four
real views, ported one-for-one from the v1.2 Avalonia UserControls but
re-authored against WinUI 3 Page semantics + Fluent 2 brushes + the
design tokens established in M2.

New converters (UI/Converters/):
- BytesToBitmapConverter: byte[] -> BitmapImage via MemoryStream.AsRandomAccessStream.
  Used by DashboardPage's per-target icon column.
- BoolToVisibilityConverter / InvertedBoolToVisibilityConverter: replace
  Avalonia's IsVisible="{Binding X}" / "{Binding !X}" patterns.
- NotNullToVisibilityConverter: replaces Avalonia's
  ObjectConverters.IsNotNull check (used on UpdatePage AvailableVersion).

App.xaml registers all 4 converters at Application.Resources scope (per
feedback_winui3_resource_scope.md — local Page.Resources hits forward-
reference issues).

MainWindow.xaml.cs:
- ContentFrame.Navigate(pageType, App.Services) — passes the DI provider as
  the navigation parameter so each Page can resolve its own VM in
  OnNavigatedTo without taking a project reference back to CaptureImage.App.
  CaptureImage.UI does not depend on CaptureImage.App; this keeps the
  layering clean.

Per-page code-behind pattern (all 4 Pages):
- Empty constructor (just InitializeComponent).
- Override OnNavigatedTo, cast e.Parameter to IServiceProvider, resolve the
  VM, set DataContext.

DashboardPage.xaml:
- Header (Title + Subtitle + Refresh/Arm/Disarm buttons with visibility
  driven by IsArmed). Arm uses AccentButtonStyle.
- Targets ListView with per-target template (icon via BytesToBitmap, name
  + process name stack, Steam pill badge with #FF6B35 fill).
- Empty-state TextBlock overlays when HasNoTargets.
- Status indicator: 3 stacked Border dots (gray idle / green armed /
  orange capturing) with Visibility converters; StatusMessage to the right.
- Footer: TargetsCountText + LoadingText.

UpdatePage.xaml:
- Header (Title + CurrentVersion run).
- Available-version Border (NotNullToVisibility on AvailableVersion) with
  release notes.
- Three buttons (Check/Download/Install) — Download/Install use
  AccentButtonStyle.
- ProgressBar + status line (BoolToVisibility on IsBusy).
- Log-lines ItemsControl in a bordered ScrollViewer, monospace font.

SettingsPage.xaml:
- 18 form fields binding to the existing computed-property labels on
  SettingsViewModel (TitleLabel, LanguageLabel, …, LogLevelHint).
- Language ComboBox (CultureInfo.DisplayName).
- Hotkey is a read-only TextBox showing Hotkey.DisplayText with a
  PlaceholderText pointing at v1.3-M6 — the real HotkeyRecorder control
  lands then.
- Format ComboBox, paired JPEG/WebP quality sliders side-by-side, output
  folder TextBox + Browse, file-name template (mono font), 3 toggles,
  log-level picker + hint, Import/Export/OpenFile buttons,
  SettingsFilePath display.

AboutPage.xaml:
- Header (Title + Tagline).
- Metadata card (5 rows: AppName, AppVersion, License, Developer,
  RepositoryUrl as HyperlinkButton).
- AI assistance disclosure.
- 3 disclaimers (Translation / CaptureLimitation / Liability).
- 6 legal-doc buttons in a horizontal StackPanel (no WrapPanel in WinUI 3
  by default; 6 buttons fit at 1200 px — M7 polish if needed).
- Third-party items list inside a bordered ItemsControl.

Avalonia -> WinUI 3 mapping notes:
- IsVisible="{Binding X}" -> Visibility="{Binding X, Converter=...}"
- TextBox Watermark -> PlaceholderText
- Classes="accent" -> Style="{StaticResource AccentButtonStyle}"
- ListBox -> ListView
- ToolTip.Tip -> ToolTipService.ToolTip
- DynamicResource SystemControlBackgroundChromeMediumLowBrush ->
  ThemeResource CardBackgroundFillColorDefaultBrush (Fluent 2 naming)

Verification:
- dotnet build: 0 errors, 0 warnings.
- dotnet test: 156/156 pass — same baseline.
- Smoke run: app boots, DashboardPage's OnNavigatedTo fires before
  Activate() (WMI watcher + Steam scan logs land at the right moment),
  user navigates through Update / Settings / About — each Page's
  OnNavigatedTo resolves its VM and sets DataContext; "Navigated to X"
  lines from NavigationService confirm the dual-flow (NavigationView
  routes Frame, MainWindowVM independently routes via NavigationService).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 09:45:14 +07:00
poli0981andClaude Opus 4.7 a85dfa8ec0 feat(v1.3-M3): MainWindow shell — NavigationView + Frame + FlowDirection
Third milestone of v1.3. Replace the M2 placeholder content with the real
shell: NavigationView nav rail (220 px open), data-bound MenuItems from
MainWindowViewModel.NavItems, Fluent FontIcon glyphs, log-toggle button in
PaneFooter, and a Frame content host that routes through 4 placeholder
Pages. RTL FlowDirection is wired through the existing FlowDirectionConverter.

App.xaml:
- Move FlowDirectionConverter to Application.Resources scope. Local
  Grid.Resources hits a forward-reference issue because the Grid evaluates
  its FlowDirection property before the inner Resources element is
  processed — Application.Resources is always available first.

MainWindow.xaml:
- Root Grid bound to FlowDirection via {StaticResource FlowDirectionConverter}.
- NavigationView with PaneDisplayMode=Left, OpenPaneLength=220, MenuItems
  data-bound (BindingMode=TwoWay on SelectedItem), back button + Settings
  hidden (we have our own Settings nav item, no back nav semantic).
- PaneHeader: AppTitle + AppVersion using design tokens from M2.
- MenuItemTemplate: NavigationViewItem with FontIcon (Segoe Fluent Icons)
  + bound Label / IconGlyph.
- PaneFooter: log-toggle button bound to ToggleLogViewerCommand. Drawer
  itself lands in M5; the button just fires the command.
- ContentFrame fills the rest. Pages live in CaptureImage.UI.Views.

MainWindow.xaml.cs:
- New SetViewModel(vm) public method called from App.OnLaunched. Window has
  no DataContext property in WinUI 3 — content elements (the root Grid)
  carry it instead.
- SelectionChanged handler maps NavItemViewModel.Key -> Page Type and
  navigates the Frame. Initial nav is fired from SetViewModel so the Frame
  isn't blank when the window first shows.

App.xaml.cs OnLaunched:
- Resolve MainWindowViewModel from DI, hand to SetViewModel(vm) before
  Activate(). Tray init unchanged.

CaptureImage.UI/Views/{Dashboard,Update,Settings,About}Page (new):
- Minimal placeholder Pages with a centered TextBlock. M4 swaps the content
  + wires the existing per-tab ViewModels via DataContext.

Verification:
- dotnet build: 0 errors, 0 warnings.
- dotnet test: 156/156 pass — same baseline.
- Smoke run: log records full path through DI -> initial NavigateToNavItem
  -> Frame.Navigate(DashboardPage) -> WMI/Steam scan kicks off (DashboardVM
  resolved) -> tray stub -> user clicks all 4 nav items -> Velopack +
  SettingsVM + AboutVM all resolve, "Navigated to X" lines fire for each.
  No XamlParseException.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 09:30:34 +07:00
poli0981andClaude Opus 4.7 241bad20be feat(v1.3-M2): Fluent 2 theme baseline — Mica backdrop + design tokens
Second milestone of v1.3. Move the placeholder shell onto the Win11 native
look-and-feel: Mica backdrop, Segoe UI Variable, integrated title bar, and
the design-token resource set the rest of the v1.3 ports will reuse.

App.xaml:
- Add design-token resources to Application.Resources, mirroring the v1.2
  Avalonia comment block (4/8/12/16/24 spacing, 4/8 corner radius, 11/12/13/
  14/16/22 font sizes). Drop Inter; Fluent 2's Segoe UI Variable Display is
  the explicit BodyFontFamily — keeps the look native to Win11.
- Keep XamlControlsResources merged dict from M1.

MainWindow.xaml.cs:
- SystemBackdrop = MicaBackdrop { Kind = MicaKind.Base } — picks up the
  Win11 desktop wallpaper tint, falls back gracefully on RDP / Win10 builds.
- ExtendsContentIntoTitleBar = true for the Fluent 2 borderless look.
- AppWindow.Resize(1200x720) carries over the v1.2-M7 dimensions; DPI-aware
  refinement is M3's job when the real shell lands.

MainWindow.xaml:
- Root Grid intentionally has no Background so MicaBackdrop shines through.
- Placeholder text uses the new resource keys (BodyFontFamily, FontSizeTitle,
  SpacingSmall) so the design tokens get exercised end-to-end.
- Secondary text uses ThemeResource TextFillColorSecondaryBrush — keeps WCAG
  AA contrast on both light and dark variants without hardcoded opacity.

Verification:
- dotnet build: 0 errors, 0 warnings.
- Smoke run: app launches, log records full happy path through App.OnLaunched
  + MainWindow init (Mica/AppWindow/title bar APIs all succeed without
  exception). Visible verification of Mica blur is left to the user.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 09:22:16 +07:00
poli0981andClaude Opus 4.7 310708483e feat(v1.3-M1): bootstrap WinUI 3 app shell, gut Avalonia from UI/App
First milestone of the v1.3 cycle: replace the Avalonia 11 UI stack with
WinUI 3 (Windows App SDK 1.8.x, self-contained x64). Logic layers
(Core, Infrastructure, ViewModels) untouched — they survive the swap as
designed.

Removed (Avalonia):
- Directory.Packages.props: 5 Avalonia.* package versions
- App.csproj + UI.csproj: all Avalonia.* PackageReferences
- 25 source files: App.axaml(.cs), 7 view .axaml(.cs), 2 control
  .axaml(.cs), AvaloniaUIDispatcher, AvaloniaTrayIconHost,
  AvaloniaPreviewPresenter, BytesToBitmapConverter, ToastKindToBrushConverter
- UI.csproj TFM: net9.0 -> net9.0-windows10.0.22621.0
- UI.Tests TFM: net9.0 -> net9.0-windows10.0.22621.0

Added (WinUI 3):
- Directory.Packages.props: Microsoft.WindowsAppSDK family + WinUI subpkg
- App.csproj: <UseWinUI>true</UseWinUI>, <WindowsPackageType>None</WindowsPackageType>,
  <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>,
  <Platforms>x64</Platforms>, <RuntimeIdentifier>win-x64</RuntimeIdentifier>,
  DISABLE_XAML_GENERATED_MAIN define
- App.xaml + App.xaml.cs in App project (was in UI project before — moved to
  follow WinUI 3 idiom). App.OnLaunched binds the WinUI dispatcher and
  shows MainWindow.
- MainWindow.xaml + .cs (placeholder TextBlock; M3 ports the real shell).
- WinUIThreadDispatcher: IUIThreadDispatcher impl wrapping
  Microsoft.UI.Dispatching.DispatcherQueue. Bound from App.OnLaunched.
- StubTrayIconHost + StubPreviewPresenter: keep DI happy until M6 wires the
  real H.NotifyIcon.WindowsAppSDK + WinUI 3 modal implementations.
- FlowDirectionConverter rewritten against Microsoft.UI.Xaml.

Modified:
- Program.cs: Velopack init + logging + settings + culture untouched. Only
  the lifetime call swaps from BuildAvaloniaApp().StartWithClassicDesktopLifetime
  to Microsoft.UI.Xaml.Application.Start(...) with an explicit
  DispatcherQueueSynchronizationContext.
- CompositionRoot: register WinUIThreadDispatcher (concrete + interface),
  StubTrayIconHost, StubPreviewPresenter.
- ToastService: drop now-unused using Avalonia.Threading.

Verification:
- dotnet build: 0 errors, 0 warnings on full solution.
- dotnet test: 156/156 pass (Core 62, Infra 60, VM 22, UI 12) — same as v1.2 baseline.
- Smoke run: app launches, log records full happy path through
  App.OnLaunched, tray stub initializes (proves MainWindow.Activate() ran).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 09:17:11 +07:00
poli0981andClaude Opus 4.7 7bd2bf9df0 chore(release): bump to v1.2.0
Logging-overhaul release. Turns the v1.1 logging surface — working but
thin — into a diagnostic tool developers and end-users can rely on when
something misbehaves. No capture-engine changes, no breaking config
changes; Velopack publish on the existing `win` channel.

Highlights:
  - Runtime log-level picker in Settings (Debug / Info / Warn / Error)
  - Log viewer min-level filter + "Open folder" button
  - Caller context (File:Line:Member) on every entry, via
    CallerAwareLoggerExtensions
  - Global exception handlers for AppDomain / TaskScheduler /
    Avalonia dispatcher
  - Expanded coverage across WGC, hotkey, Velopack, tray,
    localization
  - 4 previously silent catches now log
  - settings.json schema bumped v1→v2 with auto migration
  - Window widened to 1200×720 with animated log drawer (480 px,
    200 ms fade + slide)
  - Scroll bars hidden on About + Settings (wheel scrolling still works)

Default minimum log level is now Information (was Debug) — flip back
to Debug via Settings → Logging if you were relying on verbose output.

Tests: 156 green (was 123). New suites cover InMemorySink,
SerilogLogLevelSwitcher, CallerAwareLoggerExtensions, LogViewer
filter / hydration / live-tail, and v1→v2 settings migration with
write-back.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 09:40:33 +07:00
poli0981andClaude Opus 4.7 7cd59eac36 feat(v1.2-M7): widen window, animate log drawer, hide main-view scrollbars
UX polish on top of the M1–M5 logging work:

- **Window 1200×720** (was 960×600) with **log drawer at 480 px**
  (was 400 px). Content area visible while the drawer is open goes
  from ~340 px to ~500 px — the cramped "half your app is behind a
  drawer" feeling is gone.
- **Log drawer slides in with a 200 ms fade + translate-X easing.**
  The drawer is now kept in the visual tree permanently so
  transitions fire on every toggle. Classes.visible is bound to
  IsLogViewerVisible; IsHitTestVisible is bound to the same flag so
  the drawer stays click-through while hidden. DoubleTransition
  (Opacity, 180 ms) + TransformOperationsTransition (translateX,
  220 ms) with CircularEaseOut.
- **Scroll bars hidden on About + Settings** (Horizontal=Disabled,
  Vertical=Hidden). Mouse-wheel scrolling still works; the track
  just isn't drawn. Update log + Log viewer drawer keep their bars
  since those are diagnostic surfaces where users want to scrub.

Dashboard has no ScrollViewer so it wasn't touched. UpdateView's
inner log ScrollViewer is left alone for the same reason as the log
drawer: it's a diagnostic surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 09:39:57 +07:00
poli0981andClaude Opus 4.7 f82b300d25 test(v1.2-M5): unit coverage for logging stack + v1→v2 settings migration
New test suites:
  - InMemorySinkTests (7 cases): ring-buffer eviction at MaxCapacity,
    pause suppresses Emitted but still buffers, Snapshot returns a
    defensive copy, Clear empties, caller properties round-trip when
    present on the LogEvent and stay null when absent
  - SerilogLogLevelSwitcherTests (13 cases): canonical + alias names
    (info/warn/ERROR/empty) map correctly, unknown/null falls back
    to Information, CurrentLevel reports canonical capitalisation
  - CallerAwareLoggerExtensionsTests (4 cases): LogXAt extensions
    attach Member/File/Line as scope state, Path.GetFileName strips
    absolute build-machine paths, exception overloads forward both
    exception and caller context, template args pass through
  - LogViewerViewModelTests (6 cases): hydration copies snapshot
    (idempotent), live tail appends, filter rebuild keeps only ≥
    selected level, filter never touches the underlying buffer, live
    tail below filter is suppressed

Extended JsonSettingsStoreTests:
  - V1File_MigratesToV2AndWritesBack: v1 document without LogLevel is
    upgraded in memory AND the canonical v2 form is written back to
    disk
  - V2File_PreservesLogLevelField: existing LogLevel value round-trips

Also tightened JsonSettingsStore migration: STJ source-gen does NOT
honour record init defaults when a property is absent from JSON, so
we set LogLevel explicitly in the v1→v2 branch and add a defensive
"v2 file with null LogLevel" fill-in (possible via hand-edits).

Totals: 156 tests (was 123), all green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 09:24:00 +07:00
poli0981andClaude Opus 4.7 e6ba7b4dfa feat(v1.2-M4): runtime log-level switch + viewer filter + reveal folder
User-facing logging controls:

Settings → Logging group adds a "Minimum log level" picker bound to a new
AppSettings.LogLevel field (schema v1→v2, additive). Changing the picker
updates a Serilog LoggingLevelSwitch live — no restart — and persists to
settings.json through the debounced writer. Default is "Information";
legacy v1 users migrate in place and keep their existing values
(LogLevel defaults when deserialised). Hand-edited or unknown values
fall back to Information with a log line at startup.

LogViewer gets two new controls in the header:
  - Min-level filter dropdown (view-side only — sink keeps everything,
    so Export always carries the full history regardless of filter)
  - "Open folder" button that launches Explorer at
    %LocalAppData%\CaptureImage\logs, with a Toast on failure

Plumbing:
  - LoggingSetup.Initialize now returns (InMemorySink, LoggingLevelSwitch);
    Program wires the switch to settings.Current.LogLevel after LoadAsync.
    Boot floor stays at Debug so early-startup lines always reach the
    rolling file.
  - CompositionRoot adds LoggingLevelSwitch singleton + the new
    ILogLevelSwitcher abstraction (Core) backed by SerilogLogLevelSwitcher
    (Infrastructure). Keeps VMs free of a Serilog dependency.
  - MEL minimum level goes to Trace so filtering stays with the Serilog
    switch.
  - LogPaths.GetLogsDirectory (new Core helper) — single source of truth
    for %LocalAppData%\CaptureImage\logs, used by both LoggingSetup and
    LogViewerViewModel's Reveal command.
  - JsonSettingsStore: v1→v2 migration stamps the new version and writes
    back on load so existing users don't need to touch settings.json.
  - SettingsJsonContext needs no change — LogLevel is a string.

Localization: new keys Settings_Logging, Settings_LogLevel,
Settings_LogLevelHint, Log_Filter, Log_RevealFolder added in EN / VI / AR.
Arabic / Vietnamese remain machine-assisted per existing disclaimer.

Tests updated: JsonSettingsStoreTests now expect Version=2 and assert the
new LogLevel default.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 09:19:51 +07:00
poli0981andClaude Opus 4.7 3ae8fdddfe feat(v1.2-M3): expand logging coverage across capture/hotkey/update/tray/localization
Fill in log call sites that were either silent or shallow:

- WindowsGraphicsCaptureEngine: Info on session start (HWND + size), Debug on
  first frame arrival and session dispose, Warning on CreateForWindow
  COMException with explicit HRESULT formatting, Warning on frame timeout
  with configured deadline, dedicated COMException path on outer catch
- HotkeyConflictSniffer: Win32 error codes now decode to names
  (ERROR_HOTKEY_ALREADY_REGISTERED / ERROR_INVALID_PARAMETER / etc.) so
  debug output reads without Googling 1409
- SharpHookHotkeyService: Info when TaskPoolGlobalHook actually starts
  (previously only logged on Stop + binding change)
- VelopackUpdateService: Info before ApplyUpdatesAndRestart with target
  version + Error if the call throws (it used to fail silently into the
  relaunch)
- AvaloniaTrayIconHost: wrap BuildRuntimeIcon (SkiaSharp) in a guarded
  helper so a native-asset blow-up falls back to Avalonia's default glyph
  instead of crashing startup; Info when the tray is initialized and
  disposed
- ResxLocalizationService: inject ILogger and dedup-log Warning on the
  first time a resource key is missing per (culture, key) pair — catches
  resx typos without flooding the file on every refresh
- Program.cs: startup banner now includes Version / OS / Culture / Args
  so support sessions can pick the build up from a glance

Also extend CallerAwareLoggerExtensions with LogWarningAt<T0>,
LogWarningAt<T0,T1> exception overloads and LogErrorAt<T0,T1> to cover
the new WGC call sites. Update ResxLocalizationServiceTests to pass
NullLogger through the new required ctor parameter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 09:04:53 +07:00
poli0981andClaude Opus 4.7 2367082aab feat(v1.2-M2): caller-aware logger extensions with file:line context
Add LogXAt extensions on ILogger that capture [CallerMemberName],
[CallerFilePath], [CallerLineNumber] and attach them as Serilog properties
(Member / File / Line) via MEL BeginScope, which the Serilog MEL bridge
forwards as LogEvent properties. Path.GetFileName strips build-machine
paths so we don't leak E:\capture\captureimg\... into shipped logs.

Pipeline plumbed end-to-end:
  - LogEntry gains File / Line / Member init-only properties + FileLineText
    computed helper for the viewer
  - InMemorySink.MapToEntry reads the three scalar properties
  - CallerPropertyDefaultsEnricher injects empty defaults so the rolling-
    file template renders cleanly on legacy call sites
  - Rolling-file outputTemplate gains ({File}:{Line}) between level and
    message
  - LogViewer gets a subdued File:Line column; Export file format matches
    the rolling file

Overloads cover 0-3 template args for Info/Debug/Warning, plus Error
variants that take an Exception. Existing ILogger<T>.LogX call sites keep
working unchanged (no caller context, rendered as legacy defaults).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 08:59:26 +07:00
poli0981andClaude Opus 4.7 b72d9d9e22 fix(v1.2-M1): global exception handlers + unswallow silent catches
Register AppDomain.UnhandledException, TaskScheduler.UnobservedTaskException,
and Avalonia Dispatcher.UnhandledException handlers in Program.cs so background-
thread and UI-dispatcher crashes reach the rolling log instead of silently
tearing down the process. Structured log on each path with IsTerminating flag,
SetObserved() on unobserved tasks, Handled=true on dispatcher exceptions.

Unswallow four silent catches that hid real failures:
  - SharpHookHotkeyService.Stop/Dispose: log at Warning when hook dispose throws
  - WmiProcessWatcher.DisposeWatchers_NoLock: log at Debug on teardown failures
  - JsonSettingsStore.Deserialize: log JsonException with line/byte position
    before returning null (caller still falls back to defaults)
  - JsonSettingsStore.TryDelete: log at Debug when temp-file cleanup fails

Also add shutdown marker in finally (Reason=Normal|StartupCrash) so logs
bracket every session.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 08:54:03 +07:00
poli0981andClaude Opus 4.7 3224ad65c2 chore(release): bump to v1.1.2
M5 of the v1.1.2 localization hotfix. Closes the cycle: adds regression
tests for the two most foundational pieces of the fix, bumps the dev
version so fresh builds report v1.1.2, and writes the release notes.

- New `tests/CaptureImage.UI.Tests/` project covering
  `ResxLocalizationService`: SetCulture thread-culture propagation
  (CurrentUICulture / CurrentCulture / DefaultThreadCurrent* all
  follow), FlowDirection mapping for ar-SA, event count per switch
  (Item[] once + CurrentCulture + CurrentFlowDirection + CultureChanged),
  no-op when target culture equals current, indexer fallback for
  missing and empty keys, real resx lookup for known keys in en + vi,
  SupportedCultures surface. 12 tests.
- New `tests/CaptureImage.ViewModels.Tests/Preview/PreviewViewModelTests.cs`
  covering the M1 regression guard: VM forwards Item[] and
  CurrentCulture notifications as PropertyChanged("Localization"),
  ignores other notifications, and detaches its subscription on
  Dispose. 4 tests.
- `CaptureImage.App.csproj` version bumped to 1.1.2 so dev builds
  report the right string in the About tab; release.yml still
  overrides via `/p:Version=<git-tag>` on tag-driven builds.
- `CHANGELOG.md` adds a [1.1.2] section grouping the 13 original
  audit items + 3 user-reported bugs from smoke testing into
  Fixed / Changed / Removed / Known limitations / Tests, with
  cross-references to the affected VMs and services.

Test totals: 123 passing across four projects (Core 58 + VM 16 +
Infrastructure 37 + UI 12), up from 107 before M5. Build: 0 warnings,
0 errors.

Next step after this commit: tag v1.1.2 and run the Velopack release
pipeline on the `win` channel (same as v1.1.1) so the delta chain
stays intact.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 23:22:52 +07:00
poli0981andClaude Opus 4.7 eaf34e5543 fix(v1.1.2): live-refresh Log button + SettingsView + HotkeyRecorder, init settings.json on first run
M4a of the v1.1.2 localization hotfix — three bugs discovered during
smoke testing after M4:

A. Log drawer toggle button (MainWindow nav rail) did not retranslate
   when the user switched language — a restart was needed. Root cause:
   `{Binding Localization[Nav_LogViewer]}` and `[Dashboard_LogToggle]`
   are compiled indexer bindings through an intermediate `Localization`
   property on MainWindowViewModel. Avalonia does not reliably
   reevaluate these when the intermediate reference is unchanged, so
   the v1.1.1 `OnPropertyChanged(nameof(Localization))` signal does
   not wake them. Fix: expose `LogToggleLabel` and `LogToggleTooltip`
   as plain computed properties reading through the indexer, raise them
   on culture change, and bind the XAML to those properties instead.

B. SettingsView did not retranslate live when the user switched
   language from the Settings tab itself (where the language picker
   lives) — they had to navigate to another tab and back to see the
   new culture. The other tabs "appeared" to work only because the
   DataTemplate re-instantiated them on navigation. Same compiled
   indexer binding limitation as (A). Fix: add 18 plain computed
   properties on SettingsViewModel (TitleLabel, LanguageLabel,
   HotkeyLabel, …) and 6 on HotkeyBindingViewModel
   (RecordLabel, CancelLabel, ResetLabel, RecorderPromptText,
   ConflictWarningText, HotkeyFieldAutomationName). Raise all on
   culture change and rewrite SettingsView.axaml +
   HotkeyRecorder.axaml bindings to target the new properties.

   Scope is deliberately limited to the two views the user is active
   in when switching language (Settings + HotkeyRecorder) plus the
   always-visible MainWindow Log button. Dashboard / About / Update /
   Preview / LogViewer may have the same latent bug but are not user-
   reported, and their indexer bindings refresh on re-navigation since
   the views are destroyed / recreated via DataTemplate.

C. `settings.json` was never written to disk on first run. Previously
   `JsonSettingsStore.LoadAsync` created a fresh `AppSettings()` in
   memory when the file was missing but only persisted on the first
   `Update()` — users who launched the app without changing anything
   never saw a settings file they could edit. Partial / malformed /
   version-too-new files fell back to defaults in memory but left the
   on-disk file skewed. Fix: set a `needsWriteBack` flag for four
   paths (file missing, parse failure, future version, canonical
   form differs from raw JSON) and call `WriteAsync` directly after
   `SetCurrent`. Write failure is logged but non-fatal so a read-only
   disk does not break Load.

Build: 0 warnings, 0 errors. Tests: 107 passing (Core 58 + VM 12 +
Infrastructure 37, includes the existing `JsonSettingsStoreTests`
which still pass since they only assert `store.Current.*` state, not
file absence).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 23:07:49 +07:00
poli0981andClaude Opus 4.7 4d358028d0 chore(v1.1.2): thread-culture hardening, startup validation, dead key cleanup
M4 of the v1.1.2 localization hotfix. Three platform-level cleanups:

- ResxLocalizationService.SetCulture used to set only
  DefaultThreadCurrentUICulture, which is the baseline for threads
  that haven't overridden their culture. The UI thread keeps its
  OS-inherited culture, so any implicit .ToString() on DateTime,
  numbers, or currency stayed in the OS locale even after the user
  switched language. Align CurrentUICulture + CurrentCulture on the
  calling thread and DefaultThreadCurrentCulture for new background
  threads, so date/number formatting follows the chosen language
  wherever implicit formatting lands. Resx lookup was already correct
  (indexer passes _currentCulture explicitly to ResourceManager).
- Program.cs used to accept any culture name that CultureInfo.
  GetCultureInfo could resolve. A hand-edited settings.json with
  Culture=fr-FR would flip the app to fr, fall through to neutral
  English resx, and leave Settings showing "English" selected —
  coherent but misleading. Validate against SupportedCultures before
  calling SetCulture; unsupported cultures log a warning and stay on
  the en-US default, matching what Settings displays.
- Remove four unused resx keys (Settings_Theme, Tray_Arm, Tray_Disarm,
  Log_Export) in lockstep across en/vi/ar. No UI wires these — theme
  picker, tray arm/disarm, and log-export button aren't built yet.
  A future v1.2+ can re-add the keys when the UI actually needs them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 22:35:50 +07:00
poli0981andClaude Opus 4.7 5ac99712b0 refactor(v1.1.2): named localization handlers + IDisposable on Settings/LogViewer VMs
M3 of the v1.1.2 localization hotfix. Cleans up handler hygiene across
the localization subscribers:

- AvaloniaTrayIconHost used to rebuild the tray menu three times per
  culture switch because it reacted to every PropertyChanged
  (Item[], CurrentCulture, CurrentFlowDirection — the service fires
  all three on SetCulture). Filter to "Item[]" so it rebuilds once.
  Also unsubscribe in Dispose.
- DashboardViewModel, AboutViewModel, LogViewerViewModel, and
  SettingsViewModel had their Localization.PropertyChanged handlers
  as anonymous lambdas that could not be detached. Extract each to a
  named OnLocalizationChanged method so they can be unsubscribed.
  DashboardViewModel also gains a _disposed guard mirroring the other
  IDisposable VMs.
- SettingsViewModel's _settings.Changed subscription was likewise a
  lambda (`(_, _) => Hydrate()`); extract to OnSettingsStoreChanged
  so both subscriptions can be torn down together.
- LogViewerViewModel and SettingsViewModel now implement IDisposable
  and unsubscribe both of their event sources. DI container disposes
  singletons on shutdown, so runtime behavior is unchanged — the
  value is the consistency with the Dashboard/Update/HotkeyBinding
  pattern and the future-proofing against lifetime changes.
- AboutViewModel keeps its no-IDisposable status intentionally: it's a
  DI singleton owned by the nav shell for the whole process, so the
  leak is theoretical. The extraction to a named handler still lands
  for consistency.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 22:30:03 +07:00
poli0981andClaude Opus 4.7 5b6c2ddf01 feat(v1.1.2): localize About disclaimer bodies (vi/ar)
M2 of the v1.1.2 localization hotfix. The About tab already localized
the three disclaimer section headings (Translations / Capture support /
No warranty) but the body paragraphs stayed hardcoded English — an
inconsistency that looked half-translated to vi/ar users.

- Add About_TranslationDisclaimerBody, About_CaptureLimitationDisclaimerBody,
  About_LiabilityDisclaimerBody to all three resx files (en/vi/ar) in
  lockstep. vi + ar translations are machine-assisted, matching the
  existing Translations disclaimer that warns users about this.
- Swap AboutViewModel's three disclaimer properties from hardcoded
  strings to Localization[...] indexer reads. AiAssistanceNotice stays
  English by design (dev-process disclosure, not user-facing functionality).
- AboutView.axaml binds each disclaimer by property name, not through
  the Localization indexer, so the v1.1.1 Item[] refresh alone won't
  wake those bindings. Raise PropertyChanged explicitly for each
  disclaimer property on culture switch so the bound TextBlocks
  retranslate in place.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 22:17:07 +07:00
poli0981andClaude Opus 4.7 d3e9b7df5c fix(v1.1.2): live localize picker titles, toast error, preview window + status message
M1 of v1.1.2 localization hotfix — 6 fixes the user sees directly when
switching languages at runtime:

- PreviewWindow now binds Title + FlowDirection to Localization, so the
  modal's title and mirrored layout track the current culture (Arabic
  RTL used to stay LTR, English title used to stay "Preview").
- PreviewViewModel is IDisposable and subscribes to Localization.
  PropertyChanged with a named handler, matching the v1.1.1 pattern the
  other VMs use. AvaloniaPreviewPresenter Dispose()s it after each
  modal so the subscription doesn't leak into the singleton service.
- Settings file picker titles ("Import settings" / "Export settings")
  and the generic error-toast title ("Error") now come from resx
  (Settings_ImportTitle, Settings_ExportTitle, Toast_Error), with
  vi-VN + ar-SA translations added in lockstep.
- Dashboard StatusMessage retranslates on culture change — previously
  it was an [ObservableProperty] stored field, so the PropertyChanged
  notification handed the UI the same stale string. Call
  UpdateStatusForState() instead to rederive it from the state machine
  under the new culture.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 22:11:36 +07:00
poli0981 3da2fcc65d remove unused 'using' in code 2026-04-20 20:48:46 +07:00
379 changed files with 36845 additions and 10122 deletions

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
{
"version": 1,
"isRoot": true,
"tools": {
"vpk": {
"version": "1.2.161",
"commands": [
"vpk"
],
"rollForward": false
},
"jetbrains.resharper.globaltools": {
"version": "2026.2.4",
"commands": [
"jb"
],
"rollForward": false
},
"nuget-license": {
"version": "4.0.18",
"commands": [
"nuget-license"
],
"rollForward": false
},
"dotnet-reportgenerator-globaltool": {
"version": "5.5.12",
"commands": [
"reportgenerator"
],
"rollForward": false
},
"cyclonedx": {
"version": "6.3.1",
"commands": [
"dotnet-CycloneDX"
],
"rollForward": false
},
"dotnet-sonarscanner": {
"version": "12.0.0",
"commands": [
"dotnet-sonarscanner"
],
"rollForward": false
}
}
}
+26 -6
View File
@@ -23,12 +23,28 @@ csharp_using_directive_placement = outside_namespace:warning
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
# Nullable
dotnet_diagnostic.CS8600.severity = warning
dotnet_diagnostic.CS8601.severity = warning
dotnet_diagnostic.CS8602.severity = warning
dotnet_diagnostic.CS8603.severity = warning
dotnet_diagnostic.CS8618.severity = warning
# License header on every C# file (IDE0073 is enforced during build).
file_header_template = SPDX-License-Identifier: GPL-3.0-or-later\nCopyright (c) CaptureImage Contributors
dotnet_diagnostic.IDE0073.severity = warning
# Style rules enforced during build (EnforceCodeStyleInBuild + TreatWarningsAsErrors).
# The ":warning" suffix on the options above is honored only by IDEs; these lines make
# the compiler report them too.
dotnet_diagnostic.IDE0161.severity = warning # file-scoped namespace
dotnet_diagnostic.IDE0065.severity = warning # using directives outside the namespace
dotnet_diagnostic.IDE0005.severity = warning # unnecessary using (needs GenerateDocumentationFile)
dotnet_diagnostic.IDE0051.severity = warning # unused private member
dotnet_diagnostic.IDE0052.severity = warning # private member assigned but never read
dotnet_diagnostic.IDE0059.severity = warning # value assigned but never used
dotnet_diagnostic.IDE0060.severity = warning # unused parameter
dotnet_code_quality_unused_parameters = non_public
# src/ builds with AnalysisMode=Recommended (src/Directory.Build.props). Rules switched off:
# CA1716 flags names that are keywords in other .NET languages (IWindowWatcher.Stop is "Stop"
# in VB); this is a C#-only app. CA1873 flags argument evaluation in log calls; the ones left
# run once per startup or per error, and LoggerMessage methods check IsEnabled themselves.
dotnet_diagnostic.CA1716.severity = none
dotnet_diagnostic.CA1873.severity = none
# Code style - var
csharp_style_var_for_built_in_types = true:suggestion
@@ -43,3 +59,7 @@ csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# View models: XAML binds to instance properties even when they return constants.
[src/CaptureImage.ViewModels/**.cs]
dotnet_diagnostic.CA1822.severity = none
+32 -41
View File
@@ -1,45 +1,36 @@
# Normalize line endings for all text files — Git stores LF internally and
# checks out CRLF on Windows automatically for *.cs / *.csproj / *.md / etc.
# This avoids the "CRLF will be replaced by LF" warning on every commit.
* text=auto
# Store text as LF in the repository *and* check it out as LF, regardless of the
# local core.autocrlf setting (this dev box and GitHub's Windows runners both
# default to true). .editorconfig says end_of_line = lf and the CI `format` job
# runs `dotnet format --verify-no-changes`, which enforces it.
* text=auto eol=lf
# Files that must stay LF regardless of platform.
*.sh text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
Dockerfile text eol=lf
*.gitattributes text eol=lf
*.gitignore text eol=lf
# Windows batch files must keep CRLF.
*.bat text eol=crlf
*.cmd text eol=crlf
# Files that must stay CRLF (Windows scripts).
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf
# Source / config files — auto is fine but declaring explicit makes intent obvious.
*.cs text diff=csharp
*.csproj text
*.sln text
*.props text
*.targets text
*.json text
*.xml text
*.config text
*.resx text
*.axaml text
# Diff drivers.
*.cs text diff=csharp
*.md text diff=markdown
# Binaries — never touch.
*.dll binary
*.pdb binary
*.exe binary
*.so binary
*.dylib binary
*.png binary
*.jpg binary
*.jpeg binary
*.webp binary
*.tiff binary
*.ico binary
*.nupkg binary
*.snupkg binary
*.zip binary
*.dll binary
*.exe binary
*.pdb binary
*.so binary
*.dylib binary
*.nupkg binary
*.zip binary
*.ico binary
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.bmp binary
*.webp binary
*.tif binary
*.tiff binary
*.jxr binary
*.ttf binary
*.otf binary
*.woff binary
*.woff2 binary
+2
View File
@@ -0,0 +1,2 @@
# Every change is reviewed by the maintainer.
* @poli0981
+10
View File
@@ -0,0 +1,10 @@
# Wires the "Sponsor" button on the repo header to the maintainer's
# funding destinations. GitHub renders one button per non-empty entry.
#
# Email + PayPal intentionally omitted — see commit log for v1.5.1 and
# the v1.5.1 hotfix plan: public handles only, no personal identifiers.
github: [poli0981]
ko_fi: skullmute
buy_me_a_coffee: skullmute
patreon: skullmute
+129
View File
@@ -0,0 +1,129 @@
name: Accessibility barrier
description: Something is hard or impossible to use with a keyboard, a screen reader, magnification, a contrast theme or other assistive technology.
title: "[a11y] "
labels: ["accessibility", "triage"]
body:
- type: markdown
attributes:
value: |
Thank you for reporting this. Accessibility barriers are handled before cosmetic issues;
see [ACCESSIBILITY.md](https://github.com/poli0981/captureimg/blob/main/ACCESSIBILITY.md)
for what is supported today and the known limitations.
You don't need to tell us about a disability or any other personal information. If you'd
rather not use GitHub, email `contact@poli0981.dev` instead.
- type: textarea
id: summary
attributes:
label: What were you trying to do?
description: The task, in a sentence or two.
placeholder: "Change the region hotkey in Settings using only the keyboard."
validations:
required: true
- type: textarea
id: actual
attributes:
label: What happened?
description: What you heard, saw or couldn't do.
placeholder: "Narrator reads the button as 'Region' but doesn't say which keys are set."
validations:
required: true
- type: textarea
id: expected
attributes:
label: What did you expect?
validations:
required: true
- type: textarea
id: repro
attributes:
label: Steps to reproduce
description: Starting from opening CaptureImage. Keys you pressed are especially helpful.
placeholder: |
1. Open Settings with Tab and Enter.
2. Tab to the Region hotkey.
3. …
- type: dropdown
id: technology
attributes:
label: Assistive technology or setting
multiple: true
options:
- Narrator
- NVDA
- JAWS
- Magnifier or another magnifier
- Voice access or speech recognition
- Keyboard only (no mouse)
- Contrast theme
- Large display scaling or text size
- Reduced motion (animation effects off)
- Other (please describe below)
validations:
required: true
- type: input
id: technology-version
attributes:
label: Assistive technology version
description: "For example `NVDA 2026.3`, or `built-in` for Narrator."
- type: input
id: version
attributes:
label: CaptureImage version
description: "Shown in the title bar and on the About page, e.g. `2.1.0 (abc1234)`."
validations:
required: true
- type: input
id: windows
attributes:
label: Windows version
description: "Run `winver`, e.g. `Windows 11 Pro 24H2 (26100.2454)`."
validations:
required: true
- type: input
id: language
attributes:
label: App language
description: "The language CaptureImage is shown in, e.g. English, Tiếng Việt, العربية."
- type: dropdown
id: impact
attributes:
label: How much does this affect you?
description: Your impression is enough; the maintainer assigns the final severity.
options:
- I can't complete the task at all
- I can complete it only with great difficulty or a workaround
- It is slower or confusing, but I can do it
- It is a small issue
- type: textarea
id: workaround
attributes:
label: Workaround
description: If you found a way around it, it may help others until it is fixed.
- type: textarea
id: attachments
attributes:
label: Screenshots, recordings or diagnostics (optional)
description: |
Only if you're comfortable sharing them. **Settings → Advanced → Export diagnostics**
creates a zip with your user paths removed.
- type: checkboxes
id: preflight
attributes:
label: Before submitting
options:
- label: I searched existing issues for a duplicate.
required: true
+46 -35
View File
@@ -6,16 +6,22 @@ body:
- type: markdown
attributes:
value: |
Thanks for taking the time to report a bug. Please fill in every
field — bug reports missing environment or repro details usually
cannot be acted on.
Thanks for taking the time to report a bug. Reports with the version, Windows build and
steps to reproduce are the ones that get fixed.
**Tip:** in the app, set **Settings → Advanced → Minimum log level** to **Debug**,
reproduce the problem, then use **Export diagnostics** and attach the zip below (user
paths are removed automatically).
Something that is hard to use with a keyboard, a screen reader or another assistive
technology? Please use the **Accessibility barrier** template instead.
- type: textarea
id: summary
attributes:
label: Summary
description: One-sentence description of what's wrong.
placeholder: "Capturing Elden Ring produces an all-black PNG."
description: One sentence describing what's wrong.
placeholder: "Region captures of my second monitor are shifted to the left."
validations:
required: true
@@ -23,12 +29,12 @@ body:
id: repro
attributes:
label: Steps to reproduce
description: Numbered steps from a clean launch of CaptureImage.
description: Numbered steps, starting from opening CaptureImage.
placeholder: |
1. Start Elden Ring in borderless windowed mode.
2. Open CaptureImage and select "Elden Ring" from the Dashboard.
3. Click Arm, focus Elden Ring, press Ctrl+Shift+F12.
4. Observe the resulting PNG in Pictures\CaptureImage.
1. Start the game in borderless windowed mode on my second monitor (150% scaling).
2. Click Arm on the Dashboard.
3. Press Ctrl+Shift+F11 and drag an area.
4. Open the saved PNG.
validations:
required: true
@@ -36,7 +42,6 @@ body:
id: expected
attributes:
label: Expected behavior
placeholder: "The PNG should contain the game frame."
validations:
required: true
@@ -44,7 +49,18 @@ body:
id: actual
attributes:
label: Actual behavior
placeholder: "The PNG is 1920x1080 but every pixel is (0,0,0,255)."
validations:
required: true
- type: dropdown
id: mode
attributes:
label: Capture mode
options:
- "Window (Ctrl+Shift+F12 by default)"
- "Region (Ctrl+Shift+F11 by default)"
- "Screen (Ctrl+Shift+F10 by default)"
- "Not about capturing (UI, settings, library, update…)"
validations:
required: true
@@ -52,8 +68,8 @@ body:
id: version
attributes:
label: CaptureImage version
description: "See About tab. Example: `1.0.0`"
placeholder: "1.0.0"
description: "Shown in the title bar and on the About page, e.g. `2.0.0 (abc1234)`."
placeholder: "2.0.0 (abc1234)"
validations:
required: true
@@ -61,45 +77,40 @@ body:
id: windows
attributes:
label: Windows version
description: "Run `winver` — example: `Windows 11 Pro 24H2 (26100.2454)`"
description: "Run `winver`, e.g. `Windows 11 Pro 24H2 (26100.2454)`."
validations:
required: true
- type: input
id: gpu
id: displays
attributes:
label: GPU + driver version
description: "Example: `RTX 4070 / NVIDIA 566.14`"
label: Displays and graphics
description: "Number of monitors, their scaling, whether HDR is on, GPU and driver."
placeholder: "2 monitors (100% + 150%), HDR on the first, RTX 4070 / 566.14"
- type: dropdown
id: capture-api
- type: input
id: game
attributes:
label: Which capture engine produced the bug?
options:
- "Windows.Graphics.Capture (primary)"
- "PrintWindow fallback"
- "Both"
- "Not sure"
validations:
required: true
label: Game or application
description: "Name, and whether it runs windowed, borderless or exclusive full screen."
- type: textarea
id: logs
attributes:
label: Relevant log snippet
label: Diagnostics or log excerpt
description: |
Paste the relevant window from `%LocalAppData%\CaptureImage\logs\captureimg-<date>.log`.
Please redact anything sensitive (window titles of other apps, file paths in your home).
Attach the zip from **Export diagnostics**, or paste the relevant lines from
`%LocalAppData%\poli0981\CaptureImage\logs\captureimage-<date>.log`.
render: text
- type: checkboxes
id: preflight
attributes:
label: Pre-flight checks
label: Before submitting
options:
- label: I have searched existing issues for a duplicate.
- label: I searched existing issues for a duplicate.
required: true
- label: I have read `docs/legal/DISCLAIMER.md §2` (capture limitations) and the bug is not an expected limitation.
- label: I read the capture limitations in `docs/legal/DISCLAIMER.md` (section 2) and this isn't one of them.
required: true
- label: This is NOT a security vulnerability (those go through Security Advisories, not issues).
- label: This is not a security vulnerability (those go to `security@poli0981.dev` or a private advisory).
required: true
+6 -3
View File
@@ -2,7 +2,10 @@ blank_issues_enabled: false
contact_links:
- name: Security vulnerability
url: https://github.com/poli0981/captureimg/security/advisories/new
about: Please report security issues privately via GitHub Security Advisories, not public issues.
- name: Question / discussion
about: Report security issues privately (or email security@poli0981.dev), never in a public issue.
- name: Questions and ideas
url: https://github.com/poli0981/captureimg/discussions
about: For questions and general discussion, open a Discussion instead of an issue.
about: Ask questions and discuss ideas in GitHub Discussions.
- name: Other ways to reach the maintainer
url: https://poli0981.dev/links
about: General contact is contact@poli0981.dev; all channels are listed here.
@@ -45,6 +45,7 @@ body:
- Preview / editing
- Tray / hotkey
- Localization
- Accessibility (keyboard, screen readers, contrast, motion)
- Update / About / docs
- Build / release / installer
- Cloud upload (post-1.0)
+52 -10
View File
@@ -1,8 +1,18 @@
version: 2
# NuGet updates only work because Directory.Build.props sets
# EnableWindowsTargeting=true — Dependabot's updater runs on Linux and otherwise
# reports every newer version as "not compatible" with the Windows TFMs.
#
# The updater restores on Linux, where NuGet prunes the WPF projects' Windows
# Desktop packages differently: if a PR fails `restore --locked-mode`, run
# `dotnet restore CaptureImage.sln --force-evaluate` on Windows and push the
# lock files.
#
# Dependabot pull requests get no repository secrets, so the `sonarcloud` check
# passes without analysing them; main is analysed after the merge.
updates:
# NuGet — the actual runtime + build dependencies. Weekly cadence; grouped
# minor/patch bumps so we don't get a PR per package when .NET rolls.
- package-ecosystem: nuget
directory: "/"
schedule:
@@ -10,6 +20,8 @@ updates:
day: monday
time: "07:00"
timezone: Asia/Ho_Chi_Minh
cooldown:
default-days: 7
open-pull-requests-limit: 5
commit-message:
prefix: "chore(deps)"
@@ -17,25 +29,49 @@ updates:
labels:
- dependencies
groups:
avalonia:
patterns:
- "Avalonia*"
microsoft-extensions:
patterns:
- "Microsoft.Extensions.*"
serilog:
patterns:
- "Serilog*"
skiasharp:
# Dependabot reports every SkiaSharp 4.x as "not compatible" with
# net10.0-windows10.0.22621 (its net10.0-windows10.0.19041 asset group trips the
# updater's compatibility check), so SkiaSharp never gets a pull request: bump it by hand.
patterns:
- "SkiaSharp*"
vortice:
patterns:
- "Vortice.*"
velopack:
# The library and the `vpk` tool in .config/dotnet-tools.json must move together.
patterns:
- "Velopack"
- "vpk"
wpf-ui:
patterns:
- "WPF-UI*"
- "H.NotifyIcon*"
- "CommunityToolkit.Mvvm"
win32-interop:
patterns:
- "Microsoft.Windows.CsWin32"
test-tooling:
patterns:
- "xunit*"
- "FluentAssertions"
- "AwesomeAssertions"
- "NSubstitute"
- "Microsoft.NET.Test.Sdk"
- "coverlet.*"
- "Microsoft.Testing.*"
- "FlaUI*"
dev-tools:
patterns:
- "jetbrains.resharper.globaltools"
- "nuget-license"
- "dotnet-reportgenerator-globaltool"
- "cyclonedx"
- "dotnet-sonarscanner"
# GitHub Actions workflow files themselves. Dependabot bumps action
# versions when upstream releases.
- package-ecosystem: github-actions
directory: "/"
schedule:
@@ -43,9 +79,15 @@ updates:
day: monday
time: "07:00"
timezone: Asia/Ho_Chi_Minh
cooldown:
default-days: 7
open-pull-requests-limit: 3
commit-message:
prefix: "chore(ci)"
labels:
- dependencies
- ci
groups:
github-actions:
patterns:
- "*"
+12
View File
@@ -0,0 +1,12 @@
[
"MIT",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"ISC",
"Zlib",
"0BSD",
"Unlicense",
"LGPL-2.1-or-later",
"LGPL-3.0-or-later"
]
+1
View File
@@ -0,0 +1 @@
[]
+27 -36
View File
@@ -1,52 +1,43 @@
<!-- Thanks for contributing to CaptureImage! Please fill in every section. -->
<!-- markdownlint-disable-file MD041 -->
<!-- Thanks for contributing to CaptureImage! The PR title must follow Conventional Commits,
e.g. "fix(capture): keep alpha opaque" — it becomes the squash-commit subject. -->
## Summary
<!-- One or two sentences about what this PR does and why. -->
## Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation only
- [ ] Build / CI / release infrastructure
- [ ] Refactoring (no functional change)
<!-- What does this change and why? -->
## Related issues
<!-- Reference with `Fixes #123` / `Closes #456` / `Refs #789`. -->
<!-- Fixes #123 / Closes #456 / Refs #789 -->
## Testing
<!--
Describe how you verified the change. Minimum:
- `dotnet build CaptureImage.sln` and `dotnet test CaptureImage.sln` locally
- Manual repro of the bug (for fixes) or the new workflow (for features)
<!-- How did you verify it? For UI changes, add screenshots
(`CaptureImage.App.exe --screenshots <dir> --data-dir <temp>` renders every page). -->
For UI changes, attach screenshots or a short GIF.
-->
- [ ] `dotnet build CaptureImage.sln -c Release` passes (warnings are errors)
- [ ] `dotnet test --solution CaptureImage.sln -c Release` passes
- [ ] New or changed behavior is covered by tests
- [ ] Tried it in the app (describe what you checked)
- [ ] `dotnet build CaptureImage.sln` passes with 0 warnings / 0 errors
- [ ] `dotnet test CaptureImage.sln` passes all existing tests
- [ ] New tests added for new logic (if applicable)
- [ ] Manual smoke test performed (describe below)
## Accessibility (UI changes)
## AI assistance disclosure
<!-- See ACCESSIBILITY.md → "Contributor expectations". Delete this section if no UI changed. -->
<!--
Check if the diff was materially generated with AI help. This does NOT
disqualify the PR — it just helps reviewers focus their attention. See
`docs/CONTRIBUTORS.md` for the project's AI assistance policy.
-->
- [ ] This change was produced with significant AI assistance
- [ ] This change is human-authored (no meaningful AI involvement)
- [ ] Everything changed works with the keyboard alone, with a visible focus and no focus trap
- [ ] Controls have a unique accessible name (icon-only buttons too) and status text is announced
- [ ] Colour is not the only signal; theme brushes are used, and it looks right in a contrast theme
- [ ] New animations respect Windows' "Animation effects"; nothing takes the focus unasked
- [ ] Checked once with Narrator
## Checklist
- [ ] I have read [`docs/CONTRIBUTORS.md`](../docs/CONTRIBUTORS.md) and agree to license this contribution under GPL-3.0-or-later.
- [ ] I have updated `CHANGELOG.md` under the appropriate section.
- [ ] I have updated localization resources if the UI changed (`Strings.resx` + `.vi.resx` + `.ar.resx`).
- [ ] My commits follow conventional-commits style (`feat(...)`, `fix(...)`, `docs(...)`, etc.).
- [ ] I have not committed secrets, credentials, or personal screenshots.
- [ ] I read [`CONTRIBUTING.md`](../CONTRIBUTING.md) and license this contribution under GPL-3.0-or-later.
- [ ] User-visible text is in all 11 `Strings*.resx` files (or I asked for help translating).
- [ ] `CHANGELOG.md` has an entry under `[Unreleased]` for user-visible changes.
- [ ] No secrets, credentials or personal screenshots are included.
- [ ] AI assistance, if any, is mentioned below.
## AI assistance
<!-- e.g. "Drafted with Claude Code, reviewed and tested by me", or "None". -->
+58
View File
@@ -0,0 +1,58 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (c) CaptureImage Contributors
#
# Fails the CI `deadcode` job when JetBrains InspectCode reports dead or redundant
# code. Only file-local rules are gated: the `*.Global` variants produce false
# positives in a XAML + DI app (members used only from XAML bindings or resolved by
# the container), so they are listed in the job summary but never fail the build.
[CmdletBinding()]
param(
[Parameter(Mandatory)] [string] $Sarif,
# Repository-relative path prefixes whose findings are ignored, separated by ';' or ','
# (a single string, because `pwsh -File` does not parse arrays).
[string] $ExcludePath = ''
)
$ErrorActionPreference = 'Stop'
$gatedRules = @(
'UnusedMember.Local', 'UnusedType.Local', 'UnusedParameter.Local',
'UnusedVariable', 'UnusedVariable.Compiler', 'NotAccessedVariable',
'NotAccessedField.Local', 'UnusedField.Compiler', 'UnusedAutoPropertyAccessor.Local',
'UnusedMethodReturnValue.Local', 'UnusedMemberInSuper.Local',
'NotAccessedPositionalProperty.Local', 'EmptyNamespace',
'RedundantUsingDirective', 'RedundantCast', 'RedundantSuppressNullableWarningExpression'
)
$reportedRules = @('UnusedMember.Global', 'UnusedType.Global', 'UnusedMethodReturnValue.Global')
$excluded = @($ExcludePath -split '[;,]' | ForEach-Object { $_.Trim() } | Where-Object { $_ })
$doc = Get-Content -Raw -LiteralPath $Sarif | ConvertFrom-Json
$results = @($doc.runs | ForEach-Object { $_.results })
$failures = @()
$informational = @()
foreach ($r in $results) {
$loc = $r.locations[0].physicalLocation
$path = $loc.artifactLocation.uri
if ($excluded | Where-Object { $path.StartsWith($_, [StringComparison]::OrdinalIgnoreCase) }) { continue }
$entry = [pscustomobject]@{ Rule = $r.ruleId; Path = $path; Line = $loc.region.startLine; Message = $r.message.text }
if ($gatedRules -contains $r.ruleId) { $failures += $entry }
elseif ($reportedRules -contains $r.ruleId) { $informational += $entry }
}
$summary = @(
'## InspectCode — dead code', '',
"Gated findings: **$($failures.Count)** · informational (``*.Global``): $($informational.Count)", ''
)
if ($failures.Count -gt 0) {
$summary += '| Rule | Location | Message |', '|---|---|---|'
foreach ($f in $failures) {
$summary += "| ``$($f.Rule)`` | ``$($f.Path):$($f.Line)`` | $($f.Message -replace '\|', '\|') |"
Write-Output "::error file=$($f.Path),line=$($f.Line),title=$($f.Rule)::$($f.Message)"
}
}
if ($env:GITHUB_STEP_SUMMARY) { $summary | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8 }
else { $summary | Write-Output }
if ($failures.Count -gt 0) { exit 1 }
+106
View File
@@ -0,0 +1,106 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (c) CaptureImage Contributors
#
# NuGet's audit only checks package references, and GitHub's dependency graph doesn't read
# .config/dotnet-tools.json, so nothing else watches the local tools (vpk, the Sonar scanner, ...).
# The CI `audit` job runs this script: it looks up every tool version in nuget.org's
# vulnerability data (the data NuGetAudit uses), fails on any finding (any severity) and lists
# them in the job summary.
[CmdletBinding()]
param(
[Parameter(Mandatory)] [string] $Manifest,
[string] $ServiceIndex = 'https://api.nuget.org/v3/index.json'
)
$ErrorActionPreference = 'Stop'
# A NuGet version: up to four numbers, an optional pre-release label; build metadata is ignored.
function Split-NuGetVersion([string] $Version) {
$release, $label = ($Version.Trim() -split '\+', 2)[0] -split '-', 2
$parts = [long[]]($release -split '\.')
$numbers = [long[]]::new(4)
[Array]::Copy($parts, $numbers, $parts.Count)
[pscustomobject]@{ Numbers = $numbers; Label = $label }
}
# -1, 0 or 1. A release sorts after its pre-releases; labels compare part by part (SemVer 2.0).
function Compare-NuGetVersion([string] $Left, [string] $Right) {
$a = Split-NuGetVersion $Left
$b = Split-NuGetVersion $Right
for ($i = 0; $i -lt 4; $i++) {
if ($a.Numbers[$i] -ne $b.Numbers[$i]) { return [Math]::Sign($a.Numbers[$i] - $b.Numbers[$i]) }
}
if ($a.Label -eq $b.Label) { return 0 }
if (-not $a.Label) { return 1 }
if (-not $b.Label) { return -1 }
$x = $a.Label -split '\.'
$y = $b.Label -split '\.'
for ($i = 0; $i -lt [Math]::Min($x.Count, $y.Count); $i++) {
$xIsNumber = $x[$i] -match '^\d+$'
$yIsNumber = $y[$i] -match '^\d+$'
$order = if ($xIsNumber -and $yIsNumber) { ([long]$x[$i]).CompareTo([long]$y[$i]) }
elseif ($xIsNumber) { -1 }
elseif ($yIsNumber) { 1 }
else { [string]::Compare($x[$i], $y[$i], [StringComparison]::OrdinalIgnoreCase) }
if ($order -ne 0) { return [Math]::Sign($order) }
}
return [Math]::Sign($x.Count - $y.Count)
}
# NuGet range notation: "1.0" (minimum, inclusive), "[1.0]" (exact), "[1.0, 2.0)", "(, 2.0]", ...
function Test-VersionInRange([string] $Version, [string] $Range) {
$Range = $Range.Trim()
if ($Range -notmatch '^[\[(]') { return (Compare-NuGetVersion $Version $Range) -ge 0 }
$inner = $Range.Substring(1, $Range.Length - 2)
if ($inner -notmatch ',') { return (Compare-NuGetVersion $Version $inner) -eq 0 }
$min, $max = $inner -split ',', 2 | ForEach-Object { $_.Trim() }
if ($min) {
$order = Compare-NuGetVersion $Version $min
if ($order -lt 0 -or ($order -eq 0 -and $Range[0] -eq '(')) { return $false }
}
if ($max) {
$order = Compare-NuGetVersion $Version $max
if ($order -gt 0 -or ($order -eq 0 -and $Range[-1] -eq ')')) { return $false }
}
return $true
}
$tools = @((Get-Content -Raw -LiteralPath $Manifest | ConvertFrom-Json).tools.PSObject.Properties)
$resource = (Invoke-RestMethod -Uri $ServiceIndex).resources |
Where-Object { $_.'@type' -like 'VulnerabilityInfo/*' } | Select-Object -First 1
if (-not $resource) { throw "$ServiceIndex has no VulnerabilityInfo resource." }
$severities = 'Low', 'Moderate', 'High', 'Critical'
$rows = @()
# The data comes in pages (a base file plus updates), each keyed by lower-case package id.
# Invoke-RestMethod returns a JSON array as one object; `foreach` enumerates it.
$pages = Invoke-RestMethod -Uri $resource.'@id'
foreach ($page in $pages) {
$advisories = Invoke-RestMethod -Uri $page.'@id'
foreach ($tool in $tools) {
foreach ($advisory in @($advisories.($tool.Name.ToLowerInvariant()))) {
if (-not $advisory -or -not (Test-VersionInRange $tool.Value.version $advisory.versions)) { continue }
$rows += [pscustomobject]@{
Tool = $tool.Name
Version = $tool.Value.version
Severity = $severities[[int]$advisory.severity]
Advisory = $advisory.url
}
}
}
}
$rows = @($rows | Sort-Object Tool, Version, Advisory -Unique)
$summary = @('## Tool vulnerability audit', '', "Tools checked: **$($tools.Count)**, vulnerable: **$($rows.Count)**", '')
if ($rows.Count -gt 0) {
$summary += '| Tool | Version | Severity | Advisory |', '|---|---|---|---|'
foreach ($r in $rows) {
$summary += "| $($r.Tool) | $($r.Version) | $($r.Severity) | $($r.Advisory) |"
Write-Output "::error title=Vulnerable tool::$($r.Tool) $($r.Version) ($($r.Severity)) $($r.Advisory)"
}
}
if ($env:GITHUB_STEP_SUMMARY) { $summary | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8 }
else { $summary | Write-Output }
if ($rows.Count -gt 0) { exit 1 }
+46
View File
@@ -0,0 +1,46 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (c) CaptureImage Contributors
#
# `dotnet list package --vulnerable` exits 0 even when it finds vulnerable packages,
# so the CI `audit` job feeds its JSON output to this script, which fails on any
# finding (direct or transitive, any severity) and lists them in the job summary.
[CmdletBinding()]
param([Parameter(Mandatory)] [string] $Report)
$ErrorActionPreference = 'Stop'
$doc = Get-Content -Raw -LiteralPath $Report | ConvertFrom-Json
$rows = @()
foreach ($project in @($doc.projects)) {
foreach ($framework in @($project.frameworks)) {
foreach ($kind in 'topLevelPackages', 'transitivePackages') {
foreach ($package in @($framework.$kind)) {
foreach ($vuln in @($package.vulnerabilities)) {
if (-not $vuln) { continue }
$rows += [pscustomobject]@{
Project = [IO.Path]::GetFileNameWithoutExtension($project.path)
Package = $package.id
Version = $package.resolvedVersion
Severity = $vuln.severity
Advisory = $vuln.advisoryurl
}
}
}
}
}
}
$rows = @($rows | Sort-Object Package, Version, Advisory -Unique)
$summary = @('## NuGet vulnerability audit', '', "Vulnerable packages: **$($rows.Count)**", '')
if ($rows.Count -gt 0) {
$summary += '| Package | Version | Severity | Advisory | Project |', '|---|---|---|---|---|'
foreach ($r in $rows) {
$summary += "| $($r.Package) | $($r.Version) | $($r.Severity) | $($r.Advisory) | $($r.Project) |"
Write-Output "::error title=Vulnerable package::$($r.Package) $($r.Version) ($($r.Severity)) $($r.Advisory)"
}
}
if ($env:GITHUB_STEP_SUMMARY) { $summary | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8 }
else { $summary | Write-Output }
if ($rows.Count -gt 0) { exit 1 }
+28
View File
@@ -0,0 +1,28 @@
name: Announce Release to Discord
# Fires when a release is published. Releases are created as drafts by
# release.yml and published by the maintainer (`gh release edit --draft=false`),
# so this event is raised by a user token and actually triggers.
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Existing release tag to re-announce"
required: true
type: string
permissions: {}
jobs:
announce:
permissions:
contents: read
# Reusable workflows are pinned to a commit of poli0981/.github.
uses: poli0981/.github/.github/workflows/announce-release.yml@e973e2f15725356653ef07539016670ad2733f83
with:
tag_override: ${{ inputs.tag || '' }}
secrets:
DISCORD_RELEASES_WEBHOOK: ${{ secrets.DISCORD_RELEASES_WEBHOOK }}
DISCORD_REPO_WEBHOOK: ${{ secrets.DISCORD_REPO_WEBHOOK }}
+423 -27
View File
@@ -1,55 +1,451 @@
name: CI
# Build + test CaptureImage on every push to main and every pull request.
# Runs on windows-latest because the Infrastructure project targets
# net9.0-windows10.0.22621.0 and the WGC integration tests require a real
# desktop session with Windows 11 22H2 SDK.
# Every job name below is a required status check on `main` (repository ruleset).
# Keep job ids stable and never add `paths:` filters here: a required check that
# does not report leaves the pull request waiting forever.
on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
workflow_dispatch:
# Cancel in-progress runs for the same ref when a new commit lands.
permissions: {}
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build-test:
runs-on: windows-latest
timeout-minutes: 20
env:
DOTNET_NOLOGO: "true"
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "true"
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
jobs:
build:
name: build
runs-on: windows-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # full history so MinVer / git describe works later
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@v5
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# Honor global.json; avoids drift between local + CI.
global-json-file: global.json
cache: true
cache-dependency-path: "**/packages.lock.json"
- name: Print .NET version
run: dotnet --info
- name: Restore (locked)
run: dotnet restore CaptureImage.sln --locked-mode
- name: Restore
run: dotnet restore CaptureImage.sln
- name: Build (Release, warnings as errors)
run: dotnet build CaptureImage.sln -c Release --no-restore
- name: Build (Release, no restore)
run: dotnet build CaptureImage.sln -c Release --no-restore /p:TreatWarningsAsErrors=true /p:WarningsAsErrors=nullable
- name: Test (Microsoft.Testing.Platform + coverage)
run: >
dotnet test --solution CaptureImage.sln -c Release --no-build
--results-directory TestResults
--coverage --coverage-output-format cobertura
--report-xunit-trx
- name: Test
run: dotnet test CaptureImage.sln -c Release --no-build --logger "trx;LogFileName=test-results.trx" --results-directory ./TestResults
- name: Upload test results
- name: Coverage summary
if: always()
uses: actions/upload-artifact@v7
shell: pwsh
run: |
dotnet tool restore
dotnet reportgenerator "-reports:TestResults/*.cobertura.xml" "-targetdir:coverage-report" `
"-reporttypes:MarkdownSummaryGithub;Cobertura" "-assemblyfilters:+CaptureImage.*;-CaptureImage.*.Tests"
if (Test-Path coverage-report/SummaryGithub.md) {
Get-Content coverage-report/SummaryGithub.md | Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
}
- name: Upload test results + coverage
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: test-results
path: ./TestResults/**/*.trx
path: |
TestResults/**/*.trx
coverage-report/**
retention-days: 14
# SonarQube Cloud, CI-based analysis (automatic analysis is off in the project settings).
# Its own build: `begin` turns TreatWarningsAsErrors off, which `build` must keep. The job
# fails when the quality gate fails. Runs that can't be analysed pass without analysing:
# fork and Dependabot pull requests get no SONAR_TOKEN (main is analysed after the merge),
# and the free plan analyses only main and pull requests, not other branches.
sonarcloud:
name: sonarcloud
runs-on: windows-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Analyse this run?
id: sonar
shell: pwsh
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
EVENT_NAME: ${{ github.event_name }}
REF: ${{ github.ref }}
run: |
$skip = ''
if ([string]::IsNullOrEmpty($env:SONAR_TOKEN)) { $skip = 'no SONAR_TOKEN (fork or Dependabot pull request)' }
elseif ($env:EVENT_NAME -ne 'pull_request' -and $env:REF -ne 'refs/heads/main') { $skip = "only main and pull requests are analysed, not $env:REF" }
"analyse=$(([string]::IsNullOrEmpty($skip)).ToString().ToLowerInvariant())" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8
if ($skip) { "::notice title=sonarcloud::Analysis skipped: $skip." }
- name: Checkout
if: steps.sonar.outputs.analyse == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # full history: new code is found with git blame
persist-credentials: false
- name: Setup .NET
if: steps.sonar.outputs.analyse == 'true'
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
cache: true
cache-dependency-path: "**/packages.lock.json"
# The scanner downloads its engine, a JRE and the analyzers from SonarQube Cloud.
- name: Cache SonarQube Cloud downloads
if: steps.sonar.outputs.analyse == 'true'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.sonar/cache
key: sonar-${{ runner.os }}-${{ hashFiles('.config/dotnet-tools.json') }}
restore-keys: sonar-${{ runner.os }}-
- name: Restore (locked)
if: steps.sonar.outputs.analyse == 'true'
run: dotnet restore CaptureImage.sln --locked-mode
- name: Restore tools
if: steps.sonar.outputs.analyse == 'true'
run: dotnet tool restore
- name: Project version
id: version
if: steps.sonar.outputs.analyse == 'true'
shell: pwsh
run: |
[xml]$props = Get-Content Directory.Build.props
$version = @($props.Project.PropertyGroup | ForEach-Object { $_.Version } | Where-Object { $_ })[0]
if (-not $version) { throw 'Directory.Build.props has no <Version>.' }
"version=$version" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8
# The project version marks where new code starts (new code = since the previous version).
# Not counted for coverage: CaptureImage.UI (the WPF shell) and CaptureImage.App (the host),
# which the FlaUI tests and the published-app smoke test exercise out of process, and the
# CI scripts under .github. Icons and images are project items but not text.
- name: SonarScanner begin
if: steps.sonar.outputs.analyse == 'true'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
VERSION: ${{ steps.version.outputs.version }}
run: >
dotnet sonarscanner begin /k:poli0981_captureimg /o:poli0981 "/v:$env:VERSION"
"/d:sonar.token=$env:SONAR_TOKEN"
"/d:sonar.cs.cobertura.reportsPaths=TestResults/*.cobertura.xml"
"/d:sonar.cs.vstest.reportsPaths=TestResults/*.trx"
"/d:sonar.coverage.exclusions=src/CaptureImage.UI/**,src/CaptureImage.App/**,.github/**"
"/d:sonar.exclusions=**/*.ico,**/*.png"
/d:sonar.qualitygate.wait=true
- name: Build
if: steps.sonar.outputs.analyse == 'true'
run: dotnet build CaptureImage.sln -c Release --no-restore --no-incremental --disable-build-servers
- name: Test with coverage
if: steps.sonar.outputs.analyse == 'true'
run: >
dotnet test --solution CaptureImage.sln -c Release --no-build
--results-directory TestResults
--coverage --coverage-output-format cobertura
--report-xunit-trx
- name: SonarScanner end (waits for the quality gate)
if: steps.sonar.outputs.analyse == 'true'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet sonarscanner end "/d:sonar.token=$env:SONAR_TOKEN"
format:
name: format
runs-on: windows-latest
timeout-minutes: 20
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
cache: true
cache-dependency-path: "**/packages.lock.json"
- name: Restore (locked)
run: dotnet restore CaptureImage.sln --locked-mode
- name: Whitespace / line endings
run: dotnet format whitespace CaptureImage.sln --no-restore --verify-no-changes
# Unused-member rules (IDE0051/0052/…) are enforced by the compiler in `build`,
# where XAML-generated code is visible; `dotnet format` cannot see it.
- name: Code style (SPDX header, namespaces, usings)
run: >
dotnet format style CaptureImage.sln --no-restore --verify-no-changes
--diagnostics IDE0073 IDE0161 IDE0065 IDE0005
deadcode:
name: deadcode
runs-on: windows-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
cache: true
cache-dependency-path: "**/packages.lock.json"
# One command per step: a pwsh step only fails when its last native command does.
- name: Restore
run: dotnet restore CaptureImage.sln --locked-mode
- name: Build
run: dotnet build CaptureImage.sln -c Release --no-restore
- name: Restore tools
run: dotnet tool restore
# Quoted: PowerShell splits a dash-prefixed native argument at its first period.
- name: JetBrains InspectCode
run: >
dotnet jb inspectcode CaptureImage.sln "--output=inspectcode.sarif" "--format=Sarif"
"--severity=SUGGESTION" "--properties:Configuration=Release" --no-build
- name: Gate on dead / redundant code
shell: pwsh
run: ./.github/scripts/inspectcode-gate.ps1 -Sarif inspectcode.sarif
- name: Upload InspectCode report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: inspectcode
path: inspectcode.sarif
retention-days: 14
# audit and license restore on Windows like the build: NuGet prunes the WPF projects'
# Windows Desktop packages only there, so a Linux restore can't match the lock files.
audit:
name: audit
runs-on: windows-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
- name: Restore (locked)
run: dotnet restore CaptureImage.sln --locked-mode
- name: Vulnerable packages (direct + transitive)
shell: pwsh
run: |
dotnet list CaptureImage.sln package --vulnerable --include-transitive --format json --output-version 1 > vulnerable.json
./.github/scripts/vulnerability-gate.ps1 -Report vulnerable.json
# The local tools (vpk, the Sonar scanner, …) are neither package references nor in the
# dependency graph, so neither NuGet's audit nor Dependabot alerts cover them.
- name: Vulnerable tools (.config/dotnet-tools.json)
shell: pwsh
run: ./.github/scripts/tool-audit.ps1 -Manifest .config/dotnet-tools.json
- name: Deprecated / outdated packages (report only)
if: always()
shell: pwsh
run: |
"## Deprecated packages`n" | Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
'```' | Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
dotnet list CaptureImage.sln package --deprecated --include-transitive | Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
'```' | Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
license:
name: license
runs-on: windows-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
- name: Restore (locked)
run: dotnet restore CaptureImage.sln --locked-mode
- name: Restore tools
run: dotnet tool restore
# Only the shipped app's dependency closure is checked against the allowlist —
# build/test-only tooling never reaches users.
- name: Licenses of shipped dependencies
run: >
dotnet nuget-license -i src/CaptureImage.App/CaptureImage.App.csproj -t
-a .github/license/allowed-licenses.json
-ignore .github/license/ignored-packages.json
-o Markdown -fo license-report.md
- name: License report
if: always()
shell: pwsh
run: |
if (Test-Path license-report.md) {
"## Licenses of shipped dependencies`n" | Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
Get-Content license-report.md | Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
}
publish-smoke:
name: publish-smoke
runs-on: windows-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
cache: true
cache-dependency-path: "**/packages.lock.json"
- name: Publish app (same switches as the release workflow)
run: >
dotnet publish src/CaptureImage.App/CaptureImage.App.csproj
-c Release -r win-x64 --self-contained false
-o publish
- name: Verify published payload
shell: pwsh
run: |
$required = @(
'CaptureImage.App.exe', 'CaptureImage.App.dll', 'CaptureImage.App.runtimeconfig.json',
'Wpf.Ui.dll', 'LICENSE', 'NOTICE',
'docs/legal/DISCLAIMER.md', 'docs/legal/PRIVACY.md', 'docs/legal/TERMS.md',
'docs/legal/THIRD_PARTY_NOTICES.md', 'docs/CONTRIBUTORS.md',
'vi/CaptureImage.ViewModels.resources.dll', 'ar/CaptureImage.ViewModels.resources.dll'
)
$missing = $required | Where-Object { -not (Test-Path (Join-Path publish $_)) }
if ($missing) { $missing | ForEach-Object { "::error title=publish-smoke::missing $_" }; exit 1 }
$size = (Get-ChildItem publish -Recurse -File | Measure-Object Length -Sum).Sum / 1MB
"publish-smoke: payload OK ({0:N1} MB)" -f $size
# Starts the published app with a throwaway data folder, opens every page,
# saves a screenshot of each and exits 0 (non-zero on any failure).
- name: Smoke test the published app
shell: pwsh
run: |
$data = Join-Path $env:RUNNER_TEMP 'smoke-data'
$shots = Join-Path $env:RUNNER_TEMP 'screenshots'
$app = Start-Process -FilePath publish/CaptureImage.App.exe -PassThru `
-ArgumentList @('--screenshots', $shots, '--data-dir', $data, '--instance-id', 'ci')
if (-not $app.WaitForExit(180000)) { $app.Kill(); "::error title=publish-smoke::the app did not exit within 3 minutes"; exit 1 }
Get-ChildItem (Join-Path $data 'logs') -Filter *.log | Get-Content
if ($app.ExitCode -ne 0) { "::error title=publish-smoke::smoke test exited with $($app.ExitCode)"; exit 1 }
$pages = @(Get-ChildItem $shots -Filter *.png).Count
if ($pages -lt 7) { "::error title=publish-smoke::expected 7 page screenshots, got $pages"; exit 1 }
"smoke test OK: $pages pages"
- name: Upload page screenshots
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: screenshots
path: ${{ runner.temp }}/screenshots
retention-days: 14
if-no-files-found: ignore
# End-to-end UI tests (FlaUI) against the real app.
ui-tests:
name: ui-tests
runs-on: windows-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
cache: true
cache-dependency-path: "**/packages.lock.json"
- name: Restore + build
run: |
dotnet restore CaptureImage.sln --locked-mode
dotnet build tests/CaptureImage.App.UiTests/CaptureImage.App.UiTests.csproj -c Release --no-restore
- name: UI tests (FlaUI)
env:
CAPTUREIMAGE_UI_TESTS: "1"
run: >
dotnet test --project tests/CaptureImage.App.UiTests/CaptureImage.App.UiTests.csproj
-c Release --no-build --results-directory TestResults-ui --report-xunit-trx
- name: Upload UI test results
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ui-test-results
path: TestResults-ui/**
retention-days: 14
if-no-files-found: ignore
+40
View File
@@ -0,0 +1,40 @@
name: Dependency review
# Blocks pull requests that introduce a vulnerable dependency (any severity) or a
# dependency under a license that cannot be combined with GPL-3.0-or-later.
# `dependency-review` is a required status check.
on:
pull_request:
branches: [main]
permissions: {}
concurrency:
group: dependency-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
dependency-review:
name: dependency-review
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: write # summary comment on failure
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Review dependency changes
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
with:
fail-on-severity: low
license-check: true
deny-licenses: >-
SSPL-1.0, BUSL-1.1, Elastic-2.0, CC-BY-NC-1.0, CC-BY-NC-2.0, CC-BY-NC-2.5,
CC-BY-NC-3.0, CC-BY-NC-4.0, CC-BY-NC-SA-4.0, CC-BY-NC-ND-4.0,
JSON, CPOL-1.02
comment-summary-in-pr: on-failure
+71
View File
@@ -0,0 +1,71 @@
name: Welcome new discussions
# Auto-post a brief bilingual greeting (Vietnamese + English) the first time
# a non-maintainer opens a Discussion thread. The goal is to lower triage
# burden by directing posters at the right venue up front:
# - Bugs -> the in-app "About -> Report a bug" button or the
# bug-report issue template (requires Windows build,
# GPU, log snippet — the data the solo maintainer
# actually needs to act on a report).
# - Security holes -> GitHub Security Advisories, NOT a public discussion.
# - Q&A / ideas -> stay here, you're in the right place.
on:
discussion:
types: [created]
# `discussions: write` is the only scope required to add a discussion comment
# via the GraphQL `addDiscussionComment` mutation. Default everything else to
# read so a compromised step can't push code or open releases.
permissions: {}
jobs:
welcome:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
discussions: write
# Skip greetings for OWNER / COLLABORATOR / MEMBER — the maintainer and
# any future collaborators don't need a venue cheat-sheet on their own
# threads.
if: >-
github.event.discussion.author_association != 'OWNER'
&& github.event.discussion.author_association != 'COLLABORATOR'
&& github.event.discussion.author_association != 'MEMBER'
steps:
- name: Add welcome comment
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const body = [
"Cảm ơn bạn đã mở thread tại **CaptureImage Discussions** — thanks for opening a discussion!",
"",
"**Tiếng Việt**",
"",
"- Báo lỗi (crash, capture lỗi, OCR sai, hotkey không hoạt động): dùng nút **About → Report a bug** ngay trong app, hoặc mở [bug-report template](https://github.com/poli0981/captureimg/issues/new?template=bug_report.yml). Issue tracker yêu cầu các field (Windows build, GPU, log snippet) cần để debug nhanh.",
"- Lỗi bảo mật (security vulnerability): **không** post công khai — báo riêng qua [GitHub Security Advisories](https://github.com/poli0981/captureimg/security/advisories/new) hoặc email **security@poli0981.dev**.",
"- Câu hỏi sử dụng, ý tưởng, show & tell: bạn đang ở đúng chỗ rồi.",
"",
"**English**",
"",
"- Bug reports (crash, broken capture, OCR mistakes, hotkey not firing): use the **About → Report a bug** button in-app, or open the [bug-report template](https://github.com/poli0981/captureimg/issues/new?template=bug_report.yml). The issue tracker requires the fields (Windows build, GPU, log snippet) needed to debug.",
"- Security vulnerabilities: please **don't** post publicly — report privately via [GitHub Security Advisories](https://github.com/poli0981/captureimg/security/advisories/new) or email **security@poli0981.dev**.",
"- Usage questions, ideas, show & tell: you're in the right place.",
"",
"Other ways to reach the maintainer: **contact@poli0981.dev** · https://poli0981.dev/links",
"",
"_posted automatically by [.github/workflows/discussion-welcome.yml](https://github.com/poli0981/captureimg/blob/main/.github/workflows/discussion-welcome.yml)_"
].join("\n");
await github.graphql(
`mutation($discussionId: ID!, $body: String!) {
addDiscussionComment(input: { discussionId: $discussionId, body: $body }) {
comment { id }
}
}`,
{
discussionId: context.payload.discussion.node_id,
body
}
);
+74
View File
@@ -0,0 +1,74 @@
name: Docs
# Markdown lint + link check. `docs` is a required status check and runs on every
# pull request; it only checks links inside the repository (offline) so external
# outages never block a merge. External links are checked weekly and reported.
on:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: "17 3 * * 1" # Mondays 03:17 UTC
workflow_dispatch:
permissions: {}
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
jobs:
docs:
name: docs
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: markdownlint
uses: DavidAnson/markdownlint-cli2-action@696eb3f2509270d7b882d2aa68347bc676e7af34 # v25.0.0
with:
globs: |
**/*.md
!LICENSE
!**/bin/**
!**/obj/**
- name: Links inside the repository
uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2.9.0
with:
args: --config lychee.toml --offline --no-progress .
fail: true
output: lychee-offline.md
jobSummary: true
external-links:
name: external-links
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: All links (report only)
uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2.9.0
with:
args: >-
--config lychee.toml --no-progress --max-concurrency 4
--accept 200,206,429 .
fail: false
output: lychee-external.md
jobSummary: true
+27
View File
@@ -0,0 +1,27 @@
name: Notify CI Failures
# Posts failed CI runs on `main` to Discord through the shared notifier in
# poli0981/.github. Only pushes made in this repository qualify — a fork's pull
# request also reports `head_branch == 'main'`, and its commit message must never
# reach the Discord channel.
on:
workflow_run: # zizmor: ignore[dangerous-triggers] — read-only; no checkout of the triggering ref
workflows: ["CI"]
types: [completed]
permissions: {}
jobs:
notify:
if: >-
github.event.workflow_run.conclusion == 'failure'
&& github.event.workflow_run.event == 'push'
&& github.event.workflow_run.head_branch == 'main'
&& github.event.workflow_run.head_repository.full_name == github.repository
permissions:
contents: read
actions: read
# Reusable workflows are pinned to a commit of poli0981/.github.
uses: poli0981/.github/.github/workflows/notify-ci-failure.yml@e973e2f15725356653ef07539016670ad2733f83
secrets:
DISCORD_CI_WEBHOOK: ${{ secrets.DISCORD_CI_WEBHOOK }}
@@ -0,0 +1,21 @@
name: Notify Release Pipeline
# Reports the outcome of each Release workflow run to Discord. The public release
# announcement itself comes from announce-release.yml when the draft is published.
on:
workflow_run: # zizmor: ignore[dangerous-triggers] — read-only; no checkout of the triggering ref
workflows: ["Release"]
types: [completed]
permissions: {}
jobs:
notify:
if: github.event.workflow_run.head_repository.full_name == github.repository
permissions:
contents: read
actions: read
# Reusable workflows are pinned to a commit of poli0981/.github.
uses: poli0981/.github/.github/workflows/notify-release-pipeline.yml@e973e2f15725356653ef07539016670ad2733f83
secrets:
DISCORD_RELEASE_PIPELINE_WEBHOOK: ${{ secrets.DISCORD_RELEASE_PIPELINE_WEBHOOK }}
+41
View File
@@ -0,0 +1,41 @@
name: PR lint
# Squash merges use the pull request title as the commit subject, so the title must
# follow Conventional Commits. `pr-title` is a required status check.
on:
pull_request:
types: [opened, edited, synchronize, reopened]
permissions: {}
concurrency:
group: pr-lint-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
pr-title:
name: pr-title
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
pull-requests: read
steps:
- name: Conventional Commits title
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
perf
refactor
docs
test
build
ci
chore
revert
style
requireScope: false
+204 -126
View File
@@ -1,170 +1,248 @@
name: Release
# Cut a new release when a tag of the form v1.2.3 is pushed. Packages the
# CaptureImage.App project as a single-file self-contained Win64 build,
# wraps it in a Velopack installer, and uploads the result to a GitHub
# Release matching the tag.
# Builds a release from a `vX.Y.Z[-pre]` tag and uploads it as a DRAFT GitHub
# Release. Velopack clients (`prerelease: false`) never see drafts, so the
# maintainer can verify the assets before publishing with
# `gh release edit <tag> --draft=false` — publishing with a user token also fires
# `release: published`, which runs announce-release.yml.
#
# Code signing is NOT performed yet (SignPath application was declined).
# The installer will trigger Windows SmartScreen "Unknown publisher" until
# a signing cert is available. Users can verify the build manually by
# comparing SHA256 sums — see docs/RELEASING.md §5.
# Re-running for an existing tag (the tag ruleset forbids moving tags) works through
# workflow_dispatch: it checks out the requested tag with the workflow as it is on
# the default branch. `dry_run` builds and packs without touching any release.
#
# Code signing is not available yet (SignPath declined the application); every
# asset gets a SHA-256 checksum and a GitHub build-provenance attestation instead.
on:
push:
tags:
- "v*"
tags: ["v*"]
workflow_dispatch:
inputs:
version:
description: "Version to release (without leading v, e.g. 1.0.0)"
tag:
description: "Existing release tag to build, e.g. v2.0.0"
required: true
type: string
dry_run:
description: "Build and pack only (no GitHub Release)"
type: boolean
default: true
permissions: {}
concurrency:
group: release-${{ github.ref }}
group: release-${{ inputs.tag || github.ref_name }}
cancel-in-progress: false
permissions:
contents: write # needed to create a GitHub Release
env:
DOTNET_NOLOGO: "true"
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "true"
# Must stay identical across releases so installed copies keep updating and
# existing shortcuts stay valid.
PACK_ID: CaptureImage
PACK_TITLE: CaptureImage
MAIN_EXE: CaptureImage.App.exe
CHANNEL: win
# The app is framework-dependent: Setup and the updater install the latest .NET 10 Desktop
# Runtime when none is installed or only one older than this patch. Raise it with .NET
# security releases (10.0.14: October 25, 2026 out-of-band update).
RUNTIME: net10.0.14-x64-desktop
jobs:
release:
build:
name: build
runs-on: windows-latest
timeout-minutes: 30
env:
PACK_ID: CaptureImage
MAIN_EXE: CaptureImage.App.exe
timeout-minutes: 45
permissions:
contents: read
outputs:
tag: ${{ steps.version.outputs.tag }}
version: ${{ steps.version.outputs.version }}
prerelease: ${{ steps.version.outputs.prerelease }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Resolve version
- name: Resolve and validate the tag
id: version
shell: pwsh
env:
EVENT_NAME: ${{ github.event_name }}
INPUT_TAG: ${{ inputs.tag }}
REF_NAME: ${{ github.ref_name }}
run: |
if ($env:GITHUB_REF -like "refs/tags/v*") {
$v = $env:GITHUB_REF -replace "^refs/tags/v", ""
} elseif ("${{ github.event.inputs.version }}" -ne "") {
$v = "${{ github.event.inputs.version }}"
} else {
throw "No tag and no manual version supplied."
}
Write-Host "Resolved version: $v"
"version=$v" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
$tag = if ($env:EVENT_NAME -eq 'workflow_dispatch') { $env:INPUT_TAG } else { $env:REF_NAME }
$semver = '^v(?<v>(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?)$'
if ($tag -notmatch $semver) { throw "Not a SemVer release tag: '$tag'" }
$version = $Matches.v
"tag=$tag" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8
"version=$version" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8
"prerelease=$($version.Contains('-').ToString().ToLowerInvariant())" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8
- name: Checkout the tag
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: refs/tags/${{ steps.version.outputs.tag }}
persist-credentials: false
- name: Tag must match Directory.Build.props
shell: pwsh
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
[xml]$props = Get-Content Directory.Build.props
$declared = @($props.Project.PropertyGroup | ForEach-Object { $_.Version } | Where-Object { $_ })[0]
if ($declared -ne $env:VERSION) { throw "Tag version $env:VERSION does not match Directory.Build.props ($declared)." }
# No NuGet cache here: a poisoned cache must never reach release binaries.
- name: Setup .NET
uses: actions/setup-dotnet@v5
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
- name: Restore + test
run: |
dotnet restore CaptureImage.sln
dotnet test CaptureImage.sln -c Release --logger "trx;LogFileName=test-results.trx" --results-directory ./TestResults
# One command per step: a pwsh step only fails when its last native command does.
- name: Restore
run: dotnet restore CaptureImage.sln --locked-mode
- name: Publish CaptureImage.App (win-x64 self-contained)
- name: Build
run: dotnet build CaptureImage.sln -c Release --no-restore
- name: Test
run: dotnet test --solution CaptureImage.sln -c Release --no-build
- name: Restore tools
run: dotnet tool restore
# Framework-dependent: Setup installs the .NET Desktop Runtime when it is missing.
- name: Publish app
run: >
dotnet publish src/CaptureImage.App/CaptureImage.App.csproj
-c Release
-r win-x64
--self-contained
/p:PublishSingleFile=true
/p:IncludeNativeLibrariesForSelfExtract=true
/p:EnableCompressionInSingleFile=true
/p:Version=${{ steps.version.outputs.version }}
/p:AssemblyVersion=${{ steps.version.outputs.version }}.0
/p:FileVersion=${{ steps.version.outputs.version }}.0
-o ./publish
-c Release -r win-x64 --self-contained false
-o publish
- name: Install Velopack CLI
run: dotnet tool install --global vpk
- name: Add dotnet tools to PATH
- name: Smoke test the published app
shell: pwsh
run: echo "$env:USERPROFILE\.dotnet\tools" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Download previous release (for delta generation)
# Velopack only emits a *-delta.nupkg when it finds a previous full package
# in --outputDir. Fetching the last GitHub release before pack gives the
# Update tab a working incremental path from n-1 → n. Safe to continue-on-error:
# a first-ever release has nothing to download and we just publish full.
shell: pwsh
continue-on-error: true
run: |
New-Item -ItemType Directory -Force -Path ./releases | Out-Null
vpk download github --repoUrl https://github.com/${{ github.repository }} --outputDir ./releases --channel win
$data = Join-Path $env:RUNNER_TEMP 'smoke-data'
$app = Start-Process -FilePath publish/CaptureImage.App.exe -PassThru `
-ArgumentList @('--smoke-test', '--data-dir', $data, '--instance-id', 'release')
if (-not $app.WaitForExit(180000)) { $app.Kill(); throw 'The app did not exit within 3 minutes.' }
if ($app.ExitCode -ne 0) {
Get-ChildItem (Join-Path $data 'logs') -Filter *.log | Get-Content
throw "Smoke test exited with $($app.ExitCode)."
}
- name: Release notes from CHANGELOG
shell: pwsh
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
$lines = Get-Content CHANGELOG.md
$start = [Array]::FindIndex($lines, [Predicate[string]] { param($l) $l -match "^## \[$([regex]::Escape($env:VERSION))\]" })
if ($start -lt 0) { throw "CHANGELOG.md has no section for $env:VERSION." }
$end = [Array]::FindIndex($lines, $start + 1, [Predicate[string]] { param($l) $l -match '^## \[' })
if ($end -lt 0) { $end = $lines.Length }
$lines[($start + 1)..($end - 1)] | Out-File release-notes.md -Encoding utf8
- name: Velopack pack
# --channel win produces the modern releases.win.json manifest alongside the
# legacy RELEASES file, which is what Velopack clients >= 0.0.900 poll for.
# --delta BestSize keeps the hotfix payload small (typical v1.1.0 → v1.1.1
# delta is a few MB vs the ~55 MB full).
run: >
vpk pack
--packId ${{ env.PACK_ID }}
--packVersion ${{ steps.version.outputs.version }}
--packDir ./publish
--mainExe ${{ env.MAIN_EXE }}
--outputDir ./releases
--channel win
--delta BestSize
- name: Compute SHA256 sums
shell: pwsh
env:
VERSION: ${{ steps.version.outputs.version }}
# Full packages only: deltas need the previous package and are not worth the
# extra moving parts for this app's size.
run: |
$outDir = "./releases"
Get-ChildItem $outDir -File | ForEach-Object {
$hash = (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower()
"$hash $($_.Name)" | Out-File -FilePath "$outDir\SHA256SUMS.txt" -Append -Encoding utf8
dotnet vpk pack --packId $env:PACK_ID --packVersion $env:VERSION --packTitle $env:PACK_TITLE `
--packAuthors "poli0981 and contributors" --packDir publish --mainExe $env:MAIN_EXE `
--channel $env:CHANNEL --shortcuts "Desktop,StartMenuRoot" --delta None `
--framework $env:RUNTIME --icon src/CaptureImage.UI/Assets/CaptureImage.ico `
--releaseNotes release-notes.md --outputDir releases
- name: Collect assets, SBOM and checksums
shell: pwsh
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
New-Item -ItemType Directory dist | Out-Null
Get-ChildItem releases -File | Copy-Item -Destination dist
dotnet CycloneDX src/CaptureImage.App/CaptureImage.App.csproj --output dist `
--filename "CaptureImage-$env:VERSION-sbom.cdx.json" --output-format Json `
--set-name CaptureImage --set-version $env:VERSION --exclude-test-projects
Push-Location dist
# Hash first, then write: Out-File creates SHA256SUMS.txt as soon as the pipeline
# starts, so it would otherwise list (and fail to read) its own output file.
$sums = Get-ChildItem -File | Where-Object Name -ne 'SHA256SUMS.txt' | Sort-Object Name | ForEach-Object {
"$((Get-FileHash $_.Name -Algorithm SHA256).Hash.ToLowerInvariant()) $($_.Name)"
}
Get-Content "$outDir\SHA256SUMS.txt"
$sums | Out-File SHA256SUMS.txt -Encoding utf8
Get-Content SHA256SUMS.txt
Pop-Location
- name: Upload release artifacts
uses: actions/upload-artifact@v7
- name: Release body
shell: pwsh
env:
VERSION: ${{ steps.version.outputs.version }}
REPOSITORY: ${{ github.repository }}
run: |
$body = @(
"## CaptureImage v$env:VERSION", '',
(Get-Content release-notes.md -Raw), '',
'### Downloads',
'- **`CaptureImage-win-Setup.exe`** — installer (per-user). Windows 11 22H2 or later; installs the .NET 10 Desktop Runtime (10.0.14 or later) if it is missing or older.',
'- **`CaptureImage-win-Portable.zip`** — extract-and-run build without installer (needs the [.NET 10 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/10.0) 10.0.14 or later).',
'- **`*-full.nupkg`**, **`releases.win.json`** — update feed used by the in-app updater.',
'- **`SHA256SUMS.txt`**, **`*-sbom.cdx.json`** — checksums and CycloneDX SBOM.', '',
'### Verify the download',
'The installer is not code-signed yet, so Windows SmartScreen shows "Unknown publisher".',
'Check the checksum or the build-provenance attestation before running it:', '',
'```powershell',
'Get-FileHash -Algorithm SHA256 .\CaptureImage-win-Setup.exe # compare with SHA256SUMS.txt',
"gh attestation verify .\CaptureImage-win-Setup.exe --repo $env:REPOSITORY",
'```'
)
$body | Out-File release-body.md -Encoding utf8
- name: Upload release payload
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: captureimage-release-${{ steps.version.outputs.version }}
path: ./releases/**
name: release-${{ steps.version.outputs.version }}
path: |
dist/**
release-body.md
retention-days: 30
if-no-files-found: error
- name: Create / update GitHub Release
uses: softprops/action-gh-release@v3
if: startsWith(github.ref, 'refs/tags/v')
publish:
name: publish
needs: build
if: github.event_name == 'push' || !inputs.dry_run
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write # create / update the draft release
id-token: write # build provenance
attestations: write
steps:
- name: Download release payload
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: CaptureImage v${{ steps.version.outputs.version }}
tag_name: ${{ github.ref_name }}
draft: false
prerelease: false
generate_release_notes: true
files: |
./releases/*.exe
./releases/*.nupkg
./releases/RELEASES
./releases/releases.*.json
./releases/SHA256SUMS.txt
body: |
## CaptureImage v${{ steps.version.outputs.version }}
name: release-${{ needs.build.outputs.version }}
Lightweight Windows screen capture for games without a built-in screenshot key.
- name: Attest build provenance
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: dist/*
### Downloads
- **`Setup.exe`** — Velopack installer. Windows 11 22H2+ only.
- **`*.nupkg`** — portable Velopack package for manual install / CI updates.
- **`RELEASES`** — Velopack release manifest.
- **`SHA256SUMS.txt`** — checksums for manual verification.
### Unsigned installer notice
This release is **not code-signed** yet (OSS signing application
pending). Windows SmartScreen will show an "Unknown publisher"
warning on first run. To verify the installer is unmodified:
1. Download `SHA256SUMS.txt` from this release.
2. Run `Get-FileHash -Algorithm SHA256 Setup.exe` in PowerShell.
3. Compare with the entry in `SHA256SUMS.txt`.
### Changelog
See [CHANGELOG.md](https://github.com/poli0981/captureimg/blob/v${{ steps.version.outputs.version }}/CHANGELOG.md).
- name: Create or update the draft release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
TAG: ${{ needs.build.outputs.tag }}
VERSION: ${{ needs.build.outputs.version }}
PRERELEASE: ${{ needs.build.outputs.prerelease }}
run: |
set -euo pipefail
if gh release view "$TAG" >/dev/null 2>&1; then
gh release edit "$TAG" --notes-file release-body.md
gh release upload "$TAG" dist/* --clobber
else
flags=(--draft --verify-tag --title "CaptureImage v$VERSION" --notes-file release-body.md)
if [ "$PRERELEASE" = "true" ]; then flags+=(--prerelease); fi
gh release create "$TAG" "${flags[@]}" dist/*
fi
+43
View File
@@ -0,0 +1,43 @@
name: OpenSSF Scorecard
# Supply-chain posture report (branch protection, pinned dependencies, token
# permissions, …). Results are published to the Scorecard API and code scanning.
on:
push:
branches: [main]
schedule:
- cron: "41 4 * * 2" # Tuesdays 04:41 UTC
branch_protection_rule:
workflow_dispatch:
permissions: {}
jobs:
scorecard:
name: scorecard
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
actions: read
security-events: write # upload SARIF to code scanning
id-token: write # publish results to the Scorecard API
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run analysis
uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0
with:
results_file: scorecard.sarif
results_format: sarif
publish_results: true
- name: Upload to code scanning
uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with:
sarif_file: scorecard.sarif
category: scorecard
+52
View File
@@ -0,0 +1,52 @@
name: Workflow lint
# Syntax (actionlint) and security (zizmor) checks for everything under
# .github/workflows. Runs on every pull request because `workflow-lint` is a
# required status check — a path filter would leave unrelated PRs waiting.
on:
pull_request:
branches: [main]
push:
branches: [main]
permissions: {}
concurrency:
group: workflow-lint-${{ github.ref }}
cancel-in-progress: true
env:
ACTIONLINT_VERSION: "1.7.12"
jobs:
workflow-lint:
name: workflow-lint
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: actionlint
run: |
set -euo pipefail
base="https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}"
tarball="actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz"
curl --proto "=https" --proto-redir "=https" --tlsv1.2 -fsSLO "${base}/${tarball}"
curl --proto "=https" --proto-redir "=https" --tlsv1.2 -fsSLO "${base}/actionlint_${ACTIONLINT_VERSION}_checksums.txt"
grep " ${tarball}\$" "actionlint_${ACTIONLINT_VERSION}_checksums.txt" | sha256sum -c -
tar -xzf "${tarball}" actionlint
./actionlint -color
- name: zizmor
uses: zizmorcore/zizmor-action@45d7276c9ca790aabd705e31ca99c6185c3e76dd # v0.8.1
with:
version: "1.32.0"
advanced-security: false
annotations: true
persona: regular
+12 -6
View File
@@ -30,11 +30,11 @@ UpgradeLog*.XML
_UpgradeReport_Files/
_Pvt_Extensions/
# Rider / JetBrains (keep .idea for user, but ignore transient files)
.idea/workspace.xml
.idea/tasks.xml
.idea/shelf/
.idea/httpRequests/
# Rider / JetBrains — per-user IDE state, never committed.
.idea/
# Claude Code local state (session settings, worktrees).
.claude/
# Visual Studio Code
.vscode/
@@ -50,9 +50,15 @@ _Pvt_Extensions/
packages/
!packages/build/
# Test results
# SonarScanner for .NET working folder
.sonarqube/
# Test results / coverage / build logs
TestResults/
coverage*.xml
*.cobertura.xml
coverage-report/
*.binlog
*.trx
*.coverage
*.coveragexml
+17
View File
@@ -0,0 +1,17 @@
{
// markdownlint rules for the CI `docs` job (https://github.com/DavidAnson/markdownlint).
"config": {
"default": true,
// Prose is wrapped by hand; tables and URLs make a hard limit impractical.
"MD013": false,
// README / docs use small bits of inline HTML (badges, <details>, <br>).
"MD033": false,
// Keep a Changelog repeats "### Added/Fixed/Changed" under every release.
"MD024": { "siblings_only": true },
// Bold lead-ins ("**Heads-up:** …") are intentional, not headings.
"MD036": false,
// Pipe alignment inside tables is cosmetic and churns on every edit.
"MD060": false
},
"ignores": ["LICENSE", "**/bin/**", "**/obj/**", "artifacts/**", "TestResults/**", "node_modules/**"]
}
+261
View File
@@ -0,0 +1,261 @@
# Accessibility
CaptureImage should work for everyone who plays games on Windows. That includes people who use only
a keyboard, people who use a screen reader, magnification, a contrast theme or large display
scaling, and people who are sensitive to motion. This document describes what the app supports
today, what it does not support yet, how we test it, and how to report a barrier.
It is a statement of goals and of the current state, not a claim of conformance.
## Priorities
- **Target:** [WCAG 2.2](https://www.w3.org/TR/WCAG22/) level AA, applied to desktop software as
described in the W3C's [WCAG2ICT](https://www.w3.org/TR/wcag2ict-22/) guidance. This is a goal.
No formal audit has been made, so CaptureImage makes no conformance claim.
- **Keyboard:** everything can be done without a mouse, including region selection and the tray
icon. The one exception is listed under [known limitations](#known-limitations).
- **Screen readers:** every control has a name, and status changes and notifications are
announced. We test with Narrator.
- **Vision:** the app follows Windows contrast themes. Colour is never the only way information
is shown. Text stays sharp at any display scaling.
- **Motion and timing:** the app follows Windows' animation and notification-time settings, and
nothing flashes.
- **Stays out of your way:** notifications never take the keyboard focus away from your game or
your assistive technology.
- **Language:** the interface is available in 11 languages, and Arabic is laid out right to left.
## What works today
### Keyboard
- **Main window:** Tab and Shift+Tab move between controls. The arrow keys move within lists and
the navigation pane. Enter or Space activates the focused control.
- **Capture:** each capture mode has its own global hotkey (see the
[keyboard reference](#keyboard-reference)). The keys are registered only while CaptureImage is
armed.
- **Region selection:** the selection can be drawn, moved and resized with the keyboard. It works
on every monitor, even while a full-screen game keeps the keyboard focus.
- **Hotkey recorder:** you can record a new hotkey from the keyboard. Tab and Shift+Tab leave the
recorder without changing the hotkey.
- **Tray icon:** it can be reached with Win+B. Starting CaptureImage again from the Start menu also
brings its window back.
### Screen readers
- Buttons, toggles, lists and text fields have names. This includes buttons that show only an
icon, and each hotkey row's Clear and Reset buttons, which name their capture mode.
- **Status changes are read as they happen:**
- armed or disarmed
- the update status
- hotkey problems
- an invalid Steam App ID
- **Notifications are sent to screen readers** as UI Automation notification events. This happens
both from the main window and from the pop-up shown when the main window isn't in front. Errors
are marked as important.
- **List items are read with the details shown next to them:**
- Windows: title, process and the Steam, profile, minimized and locked badges.
- Captures: file name, game, date and HDR.
- Profiles: what the profile matches, and the auto-arm and disabled badges.
- **Headings:** page titles are level 1, sections are level 2 and the disclaimer headings on the
About page are level 3. In Narrator's scan mode (Caps Lock+Space), H jumps between them.
- The region overlay is named "Select an area", and its help text lists the keys. The size of the
selection is read when you change it with the keyboard.
### Vision
- **Themes:**
- Light, dark and high contrast are available in **Settings → Appearance**.
- **System** follows Windows, including its contrast themes.
- The region overlay draws its selection and labels in the contrast theme's colours.
- **Colour is backed by text:**
- The armed state is also shown as text on the Dashboard, in the tray icon's tooltip and in the
tray menu.
- Log levels and error messages are shown as words.
- The app is per-monitor DPI aware, so it stays sharp at any display scaling and across monitors
with different scaling.
### Motion and timing
- Page transitions are turned off when **Settings → Accessibility → Visual effects → Animation
effects** is off in Windows.
- Notification pop-ups stay up at least as long as **Dismiss notifications after this amount of
time** (same page in Windows Settings). Pointing at a pop-up keeps it open.
- Captures never depend on a time limit. The optional countdown (3, 5 or 10 seconds) is a feature
you choose, and Esc cancels a region selection at any time.
### Language
- English, Tiếng Việt, العربية, 日本語, 简体中文, 한국어, Español, Français, Deutsch, Português (Brasil)
and Русский.
- The language follows Windows on first run and can be changed in **Settings**.
## Keyboard reference
| Where | Keys | What they do |
|---|---|---|
| Anywhere, while armed | `Ctrl+Shift+F12` | Capture the window in front (or the locked window) |
| Anywhere, while armed | `Ctrl+Shift+F11` | Select a region to capture |
| Anywhere, while armed | `Ctrl+Shift+F10` | Capture the screen under the mouse pointer |
| Region selection | Arrow keys | Move the selection (the first press selects a centred area half the screen's width and height) |
| Region selection | `Shift` + arrow keys | Make the selection wider, narrower, taller or shorter |
| Region selection | `Ctrl` (with the above) | Move or resize by a single pixel |
| Region selection | `Tab` / `Shift+Tab` | Continue on the next / previous monitor |
| Region selection | `Enter` | Capture the selection, or the whole screen if nothing is selected |
| Region selection | `Esc` | Cancel |
| Preview | `Enter` / `Esc` / `Ctrl+C` | Save / discard / copy the capture |
| Settings → Hotkeys | `Enter` or `Space` on a hotkey | Start recording, then press the new combination |
| Settings → Hotkeys, recording | `Esc` / `Backspace` / `Tab` | Cancel / clear the hotkey / leave without changing it |
| Notification area | `Win+B`, arrow keys, then `Enter` | Show the CaptureImage window |
| Notification area | `Win+B`, arrow keys, then `Shift+F10` | Open the tray menu (capture, arm, settings, exit) |
The three capture hotkeys can be changed in **Settings → Hotkeys**. While the region overlay is up,
the arrow keys, Tab, Enter and Esc go to CaptureImage, and other apps get them back as soon as the
overlay closes.
## Supported environments
| Area | Status |
|---|---|
| Windows | Windows 11 22H2 or later, 64-bit (the same as the app) |
| Keyboard only | Supported and tested |
| Narrator | Supported and tested |
| NVDA, JAWS | Should work, because the app uses UI Automation; **not tested** |
| Magnifier | Should work; not tested |
| Voice access | Not tested |
| Contrast themes | Supported (Theme: System or High contrast) |
| Display scaling | Supported per monitor, including mixed scaling |
| Windows "Text size" | **Not supported** (see [known limitations](#known-limitations)) |
## Testing record
| Date | Version | Environment | Method | Result |
|---|---|---|---|---|
| 2026-11-09 | 2.0.3 | Windows 11 (Insider build 29648) | Maintainer: keyboard only with the mouse disconnected, and Narrator, across the main window's pages | No blocking problems found |
Version 2.1.0 adds keyboard region selection, the announcements and the other changes listed in
the [changelog](CHANGELOG.md). Unit tests and the UI tests cover them, but they have not yet been
checked by hand with Narrator.
On every pull request, CI checks that:
- every page opens and has its automation id;
- the hotkey buttons have distinct names that include the current binding;
- Tab leaves the hotkey recorder without saving a hotkey;
- arming the hotkeys raises a live-region announcement.
## Known limitations
| Limitation | Workaround |
|---|---|
| The app doesn't follow **Settings → Accessibility → Text size** (a WPF limitation). | Increase **Settings → System → Display → Scale**, or use Magnifier (`Win` + `+`). |
| Pinned thumbnails work only with a mouse. They never take the focus, so they can't interrupt a game. | The **Library** offers the same actions from the keyboard: open, copy, show in folder. |
| Notifications close on their own. | Everything they report is also in the **Library** (captures) and on the **Logs** page. Windows' notification-time setting makes them stay longer. |
| A capture has no text description. | **Extract text** (Preview or Library) copies the text inside a capture to the clipboard. |
| While armed, a capture hotkey doesn't reach other apps. A clash with a shortcut of your assistive technology is possible. | Change the hotkey in **Settings → Hotkeys**, or disarm. The keys are only held while armed. |
| Translations are machine-assisted, so wording or pronunciation may be off. | Please report it (see below); corrections from native speakers are welcome. |
| Screen readers other than Narrator haven't been tested. | Reports from NVDA and JAWS users are especially welcome. |
## Contributor expectations
Accessibility is part of "done" for every change to the user interface.
**Testing.** Before opening a pull request that changes the UI:
- Use every changed screen with the keyboard alone, with a visible focus at every step and no
place where the focus gets stuck.
- Check it once with Narrator (`Ctrl+Win+Enter`). Every control should be read with a name, a role
and a state, and changes should be announced.
- Check it in a Windows contrast theme and at 200 % display scaling.
- Optionally run [Accessibility Insights for Windows](https://accessibilityinsights.io/docs/windows/overview/)
FastPass on the changed window.
**User interface (XAML).**
- Give every control that shows only an icon an `AutomationProperties.Name`. Names must be unique
within a page, so add the context (the mode, the card) when the same action appears twice.
- Give list items an accessible name that includes the badges shown next to them (see
`TargetItemViewModel.AutomationName`).
- Use the `PageTitle` and `SectionHeader` styles (which set heading levels) for headings, and
`AutomationProperties.HeadingLevel` for any other heading.
- Text that changes to report a status needs `AutomationProperties.LiveSetting`,
`a11y:LiveRegion.IsEnabled="True"` and a binding with `NotifyOnTargetUpdated=True`. WPF doesn't
announce live regions on its own.
- Use theme brushes (`{DynamicResource …}`), not hard-coded colours. Never use colour alone to show
a state.
- New animations must respect `SystemParameters.ClientAreaAnimation`. Notifications and pop-ups
must not take the focus.
- Every new string goes into all 11 language files, including names and help text read only by
screen readers.
**Documentation.**
- Use headings in order, without skipping a level.
- Write link text that says where the link goes.
- Give images alt text that describes them, for example the README screenshots.
- Keep tables for tabular data, and give diagrams (such as the Mermaid diagrams in
`docs/ARCHITECTURE.md`) a text explanation next to them.
**CI.** There is no automated accessibility scanner for WPF in CI. The `ui-tests` job checks
automation ids, names and announcements through UI Automation. Reviews use the accessibility
checklist in the pull request template.
## Reporting accessibility issues
If something in CaptureImage is hard or impossible to use with your setup, please tell us:
- Open an [accessibility issue](https://github.com/poli0981/captureimg/issues/new?template=accessibility.yml).
- Or, if you'd rather not use GitHub, email `contact@poli0981.dev`.
It helps to include:
- what you were trying to do, what you expected and what happened;
- your assistive technology and its version (or "keyboard only", "contrast theme", …);
- your Windows version, the CaptureImage version (shown on the About page) and the app's
language.
Screenshots and recordings are optional. You never need to tell us about a disability or any
other personal information.
### Severity
The maintainer assigns a severity when triaging a report:
| Severity | Meaning |
|---|---|
| Critical | Blocks a core task with no workaround: capturing, arming or disarming, changing hotkeys, finding your captures, updating |
| Serious | A core task is possible only with great difficulty or a workaround |
| Moderate | Something is slower, confusing or inconsistent, but works |
| Minor | A small issue with little effect on use |
### How we respond
CaptureImage is maintained by one volunteer, so there are **no fixed response or fix times**. That
is the same as for other reports (see [`SUPPORT.md`](SUPPORT.md)). What you can expect:
- Every report is read and labelled `accessibility`.
- Questions are asked respectfully, without doubting your experience.
- Critical and Serious barriers are fixed before cosmetic work, usually in the next release.
- A workaround is suggested when one exists.
- The fix is listed in the [changelog](CHANGELOG.md). If you're willing, we'll ask you to confirm
that it works for you.
## Ownership
The maintainer, [poli0981](https://github.com/poli0981), is responsible for accessibility. That
means:
- triaging accessibility reports and keeping their issues up to date;
- running the keyboard and Narrator check before releases that change the user interface;
- keeping this document current: the features, the known limitations and the testing record.
## Feedback
Suggestions for this statement or for our practices are welcome in
[GitHub Discussions](https://github.com/poli0981/captureimg/discussions). An actual barrier is best
reported as described [above](#reporting-accessibility-issues).
This statement is based on the template of the
[Open Source Accessibility toolkit](https://github.com/open-source-accessibility/accessibility-toolkit)
and the [Open Source Guide on accessibility](https://opensource.guide/accessibility-best-practices-for-your-project/).
_Last reviewed: 2026-11-09, for CaptureImage 2.1.0._
+769 -1
View File
@@ -7,6 +7,774 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [2.1.0] - 2026-11-09
### Added
- **Region selection from the keyboard.**
- In the region overlay, the arrow keys move the selection. The first press selects a centred
area.
- Shift+arrows resize the selection. Holding Ctrl moves or resizes it one pixel at a time.
- Tab and Shift+Tab continue on the next or previous monitor, Enter captures and Esc cancels.
- The keys work even while a full-screen game keeps the keyboard focus. Holding an arrow key
repeats it. Mouse and keyboard can be combined, for example to drag an area and then
fine-tune it.
- **Screen readers hear what changes.** Narrator and other UI Automation screen readers now
announce:
- capture notifications, sent as UI Automation notification events;
- the armed status;
- the update status;
- hotkey problems and an invalid Steam App ID.
- **Tray icon from the keyboard.** After Win+B, Enter shows the CaptureImage window and Shift+F10
opens its menu.
- [`ACCESSIBILITY.md`](https://github.com/poli0981/captureimg/blob/main/ACCESSIBILITY.md) describes what CaptureImage supports for keyboard, screen
reader, contrast and motion users. It lists every key, what has been tested, the known
limitations, and how to report a barrier.
### Changed
- Page transitions are turned off when Windows' **Animation effects** setting is off.
- Notifications stay up at least as long as Windows' **Dismiss notifications after this amount of
time** setting.
- In a Windows contrast theme, the region overlay draws its selection and labels in the theme's
colours. Its hint now lists the keyboard keys.
- Screen readers read more detail:
- each hotkey button now includes its current combination;
- window, capture and profile list items include the badges shown next to them (Steam, profile,
minimized, locked, HDR, auto-arm, disabled);
- each hotkey row's Clear and Reset buttons, the About page's contact cards and repeated buttons
such as "Open folder" now say what they belong to;
- the disclaimer headings on the About page are headings.
### Fixed
- While recording a hotkey, Shift+Tab was saved as the new hotkey, and Tab left the keyboard focus
stuck on the button. Both keys now end recording without changing the hotkey and move the focus
on.
- The announcement of a notification pop-up could be lost before a screen reader read it. Pop-ups
now send their text with the notification event itself.
### Project
- New **Accessibility barrier** issue template and `accessibility` label.
- The pull request template has an accessibility checklist, and `CONTRIBUTING.md` points to the
rules for user-interface changes.
- UI tests check the live-region announcement and the hotkey buttons' names, and that Tab leaves
the recorder.
## [2.0.3] - 2026-11-09
### Changed
- The SkiaSharp image library that encodes PNG, JPEG and WebP captures is updated to 4.154.0 (Skia
milestone 154 with Chrome's upstream bug fixes).
### Project
- The InspectCode and ReportGenerator build tools, the setup-dotnet action and zizmor (1.32.0) are
updated. Dependabot can't update SkiaSharp, so `dependabot.yml` notes that it is bumped by hand.
## [2.0.2] - 2026-10-26
### Security
- CaptureImage now needs the .NET 10 Desktop Runtime **10.0.14 or later**, the .NET security update
of October 25, 2026. Setup and the in-app updater install it when your PC has an older one, so
this update may first ask to install it (Windows asks for administrator approval). With the
portable zip, install it yourself from <https://dotnet.microsoft.com/download/dotnet/10.0>.
- The Microsoft.Extensions libraries that ship with the app are updated to 10.0.14 from the same
security update.
### Project
- SonarQube Cloud analyses every pull request and `main` in CI (SonarScanner for .NET 12) instead
of automatic analysis, with test coverage and test results imported; its quality gate is a
required check.
- The dependency audit also checks the .NET tools used to build and release the app.
- Code follows the analyzer suggestions SonarQube Cloud reports: primary constructors, view-model
state as partial properties, source-generated P/Invoke.
- Builds use the .NET 10.0.403 SDK and CsWin32 0.3.367; the markdownlint, CodeQL SARIF upload and
zizmor actions are updated.
- A test keeps the third-party notices in step with the packages the app ships, and the `vpk`
release tool in step with the Velopack library.
## [2.0.1] - 2026-10-19
### Fixed
- With **Clipboard mode: copy only**, a capture that couldn't be copied (for example while another
app was holding the clipboard) was reported as a success although nothing was saved or copied.
It now shows an error.
- On HDR displays, pixels a game reported as infinitely bright came out black instead of white, and
an invalid colour value stopped the highlights next to it from rolling off smoothly.
- A Steam library folder that couldn't be read (for example on a disconnected drive) broke Steam
detection for every window until the app was restarted. That library is now skipped, and a failed
scan is tried again a minute later.
- Text without a style of its own — such as the component names and the disclaimer headings on the
About page — was drawn in a dim grey instead of the theme's text colour, which was hard to read in
the dark theme.
- The capture library lays its thumbnails out from the left edge instead of spreading wide gaps
around them.
- About: the capture notice no longer mentions the GDI fallback that 2.0.0 removed, and the
translation notice points to the folder where the language files now live.
## [2.0.0] - 2026-10-19
CaptureImage 2.0 is a rewrite of the app around the same idea: arm the hotkeys, press one in
your game, get a clean screenshot. Settings from 1.x are carried over automatically.
### Highlights
- **New interface** built with WPF and [WPF UI](https://github.com/lepoco/wpfui): Fluent design,
Mica, light / dark / high-contrast themes that follow Windows, resizable window that remembers
its position.
- **Three capture modes, each with its own hotkey** — Window (`Ctrl+Shift+F12`), Region
(`Ctrl+Shift+F11`) and Screen (`Ctrl+Shift+F10`). Region freezes every monitor and lets you drag
an area (a click takes the whole screen); Screen captures the monitor under the mouse pointer.
Works across monitors with different scaling.
- **HDR screenshots** — on HDR displays the full HDR frame is captured and tone-mapped to a normal
image; the original can be kept next to it as JPEG XR (`.jxr`).
- **Capture library** — browse every capture with thumbnails, filter by game or HDR, open, show in
folder, copy the image or its path, extract text (OCR), pin it on screen or move it to the
Recycle Bin.
- **Game profiles** — per-game output folder, format, file name template and HDR setting, matched
by executable path, executable name or Steam AppId. A profile can arm the hotkeys (and lock the
game window) as soon as the game comes to the front. Create one from the Dashboard in one click.
- **Start with Windows**, start minimized to the tray, arm on startup, export diagnostics,
import / export / reset settings.
- **11 languages** with every string translated, following the Windows display language on first
run; Arabic is laid out right to left.
### Changed
- Runs on **.NET 10 (LTS)**. The app is now framework-dependent: Setup (and the in-app updater)
installs the .NET 10 Desktop Runtime when it is missing, so the first update from 1.x may ask for
permission once. The installer shrank from about 100 MB to about 28 MB.
- **Hotkeys use the Windows `RegisterHotKey` API** and are registered only while armed. There is no
global keyboard or mouse hook any more, and while disarmed your key combinations reach other
apps untouched. Conflicts with other apps are detected and shown.
- The window list follows Windows events instead of polling WMI every two seconds.
- Settings, logs, the library index and thumbnails live in
`%LocalAppData%\poli0981\CaptureImage`, outside the installer's folder, so reinstalling never
wipes them. The 1.x `settings.json` is copied (the old file is left as it was) and migrated to
the new format.
- Notifications appear inside the window when it is in front, otherwise as a small pop-up that
never takes focus from a game and never shows up in screenshots.
- The tray icon shows a red dot while the hotkeys are armed; its menu can capture in every mode.
- The version is shown the same way everywhere, e.g. `2.0.0 (abc1234)`.
- Logs hide your user-profile path; window titles are logged only at the Debug level.
### Fixed
- Pressing Esc while selecting a region reported "Capture failed"; pressing the hotkey again during
a countdown could crash the app; an error during preview could leave it stuck.
- Captures could come out partly transparent, a new capture could overwrite an existing file, and
encoding ran on the UI thread (the window froze while saving 4K images).
- Region selection worked only on the primary monitor and was offset at scaling other than 100%.
- After a graphics-driver reset, captures failed until the app was restarted; a few native objects
leaked with every capture.
- Settings were not written atomically; a damaged file or one from a newer version was replaced by
defaults without a backup; unknown fields were dropped; importing skipped validation and accepted
network (UNC) paths.
- Notifications were invisible while the app was in the tray; the Import / Export buttons did
nothing; "Start minimized" was ignored; the app had no icon.
- A second Windows user running the app filled the log with warnings; the foreground-window
watcher could crash on exit.
- "Install update" ended the process without saving settings or removing the tray icon, and
release notes never reached the Update page.
- File names now avoid reserved device names (`CON`, `NUL`, …), invisible bidirectional and
zero-width characters, and names that are too long.
- Settings missing from the settings file — such as options added by an update — were turned off
or set to zero instead of taking their default values.
### Removed
- WinUI 3 / Windows App SDK, SharpHook, WMI, Stateless, ImageSharp and System.IO.Abstractions.
- "Auto-switch target on Alt+Tab": the Window hotkey captures the window in front unless you lock
one on the Dashboard.
- The list of social profiles in About; other channels are listed at <https://poli0981.dev/links>.
### Project
- Required pull-request checks: build and tests (with coverage), formatting, dead code, vulnerable
and incompatibly licensed dependencies, a smoke test of the published app, end-to-end UI tests,
PR title, dependency review, workflow lint and documentation links. CodeQL (extended queries), OpenSSF Scorecard and
SonarCloud also review every change.
- Releases ship a CycloneDX SBOM, SHA-256 checksums and GitHub build-provenance attestations, and are
published as drafts first.
- About and the documentation list the project contacts: `contact@poli0981.dev` and
<https://poli0981.dev/links>.
## [1.5.1] - 2026-05-11
Hotfix cycle. CI hardening, supply-chain pinning of reusable
workflows, and a small public-attribution surface in About + repo
root.
### Fixed
- **CI workflow missing permissions block.** Code Scanning flagged
`.github/workflows/ci.yml` as not declaring an explicit
`permissions:` block. Now declares `contents: read` — the
minimum required to checkout the repo and run `dotnet build` /
`dotnet test`. No package writes, no release uploads, no PR
comments.
### Changed
- **Reusable workflow refs pinned to commit SHA.** `announce-release`,
`notify-ci-failure`, and `notify-release-pipeline` callers now
reference `poli0981/.github` via full commit SHA instead of `@main`.
Dependabot bumps the SHA weekly via the existing `github-actions`
ecosystem rule in `.github/dependabot.yml`. Avoids the supply-chain
failure mode where a malicious or accidental push to ops-repo
`main` would land in our release pipeline silently.
- **Notify workflows no longer spam the Actions tab.**
`notify-ci-failure` previously listened to `workflows: ["*"]` and
fired on every workflow completion in the repo; now narrowed to
the single workflow it monitors (`"CI"`) with a job-level
conclusion gate so successful CI runs short-circuit before
pulling in the reusable. `notify-release-pipeline` narrowed to
`["Release"]` for the same reason. Roughly 50% fewer skipped
notify-* runs in the Actions history; the remaining runs all
correspond to events worth observing.
### Added
- **About → Connect with the developer** — 8 public-profile links
(X, YouTube, Discord repo + game, Steam, Bluesky, Mastodon,
Telegram) rendered as a vertical stack of `HyperlinkButton`s. Each
uses `NavigateUri` so click opens the URL via the system shell.
Email and PayPal are intentionally not surfaced here.
- **About → Support the project** — short prose + 4 donate buttons
(GitHub Sponsors accent-styled, Ko-fi, Buy Me a Coffee, Patreon).
URLs are hardcoded in `AboutViewModel` and mirror
`.github/FUNDING.yml`.
- **About → Report a bug** — single low-friction button targeting
the GitHub bug-report issue template
(`.github/ISSUE_TEMPLATE/bug_report.yml`).
- **`.github/FUNDING.yml`** — wires GitHub Sponsors, Ko-fi, Buy Me a
Coffee, and Patreon into the repo's "Sponsor" button.
- **`docs/pc_spec.md`** + **`docs/dev_env.md`** — public dev
reference covering primary hardware, mobile test fleet, toolchain
versions, IDE setup, Windows SDK, build/test/run commands, release
tooling. Vietnamese mirrors at `docs/i18n/vi/`.
- **README "Support the project" section** — preceding the License
section, mirroring the four donate destinations and pointing at
the in-app Report-a-bug button.
- **`discussion-welcome.yml` workflow** — auto-posts a brief
bilingual (Vietnamese + English) greeting the first time a
non-maintainer opens a Discussion thread. The greeting points
the poster at the right venue: bug reports → in-app
Report-a-bug button or the bug-report issue template, security
vulnerabilities → GitHub Security Advisories (not a public
discussion), Q&A / ideas → the discussion they just opened. Skips
OWNER / COLLABORATOR / MEMBER posts to avoid greeting the
maintainer's own threads.
### Smoke checklist
1. Launch v1.5.0 → Update → install v1.5.1 → app restarts and
shows "1.5.1" in the nav header.
2. About → click each of the 8 social links → opens in the default
browser.
3. About → click each of the 4 donate buttons → opens the correct
destination.
4. About → Report a bug → GitHub opens with the bug-report template
pre-filled.
5. Switch language en → vi → ar (RTL) → the 3 new section headers
(Connect, Support, Report) retranslate in place.
6. Repo home → the "Sponsor" button appears at top right (near
Watch / Fork).
## [1.5.0] - 2026-05-07
Bug-fix + feature cycle. Tackles a long-standing process-leak bug,
adds four feature toggles requested by users, four new language
packs, and ships a region-capture mode.
### Fixed
- **Process leak on every launch.** `DashboardViewModel.Dispose`
was missing a `_watcher.Stop()` call for the WMI watcher, and
`Program.Main` never disposed the DI container — together those
two gaps left a non-background WMI subscription thread alive
past app exit, so the CLR couldn't tear down and Task Manager
accumulated one zombie `CaptureImage.exe` per launch. Both holes
are now closed; a fresh dispose-chain regression test guards
against future regressions.
- **PreviewWindow theme drift.** The capture-preview modal used to
ignore the persisted theme and always inherit the OS default,
so Dark-mode users saw a Light flash on every preview. The new
`ThemeApplicator` helper is shared between MainWindow and
PreviewWindow and re-applies on every `ISettingsStore.Changed`,
so toggling theme while a preview is open updates it live.
### Added
- **Single-instance guard with restore-on-relaunch.** A second
launch of the app no longer spawns a duplicate process — instead
it pings the existing instance over a named pipe and the
original window pops to the foreground (Spotify/Slack pattern).
The named mutex is per-OS-user, and an abandoned mutex from a
crashed prior run is treated as acquired so the app can never
lock itself out.
- **Capture countdown** (Off / 3s / 5s / 10s) — useful for
capturing tooltips and menu animations that vanish when you
Alt-Tab back to the target.
- **Clipboard mode** (None / Copy only / Copy + Save) — captures
optionally land in the clipboard as a bitmap, with or without
also writing a file. Pastes correctly into Paint, Word, Slack.
- **Open output folder after save** — opt-in toggle that fires
Explorer at the saved file's directory.
- **Pinned floating thumbnail window.** Optional opt-in: every
capture spawns a small always-on-top window with a thumbnail of
the shot, handy for comparing successive captures or keeping a
reference visible while playing/working in another app. Each
capture spawns a fresh window so users can pile up several pins.
- **Built-in offline OCR** via `Windows.Media.Ocr`. The Preview
window grew an "Extract text (OCR)" button that runs the
OS-supplied recognizer on the captured frame and copies the
recognised text to the clipboard. All processing is on-device —
nothing leaves the machine. Falls back gracefully when the
user's installed OCR language packs don't cover the requested
language.
- **Region capture mode.** New Settings → Capture mode dropdown
switches between Window mode (default; existing
`Windows.Graphics.Capture` flow) and Region mode, which opens a
full-screen overlay where the user drags a rectangle. The
selection feeds into the existing Preview / Save / Clipboard /
Pinned-thumbnail pipeline unchanged. v1.5 supports the primary
monitor only — multi-monitor + per-monitor DPI lands in v1.6.
- **Four new language packs**: French (fr-FR), German (de-DE),
Brazilian Portuguese (pt-BR), Russian (ru-RU). Brings shipped
locales to 11. The About → Translations disclaimer lists every
machine-assisted pack and invites native-speaker proofreading
PRs against `src/CaptureImage.UI/Resources/Strings/`.
### Changed
- The `string`→`ElementTheme` switch lives in the new
`ThemeApplicator` helper instead of being duplicated between
windows. `MainWindow.ApplyTheme` now delegates to it.
- `IClipboardService` grew a `CopyText` overload (used by OCR);
the existing `CopyImageAsync` path is unchanged.
- Localization completeness tests now span all 11 cultures, and
both culture test classes share a serialised xUnit collection
so they can't race on the process-wide
`CultureInfo.DefaultThreadCurrent*` statics.
### Smoke checklist
When validating a v1.5 build manually:
1. Open and close the app five times in a row → Task Manager
Background processes shows zero `CaptureImage.exe` after each
close.
2. Double-click the shortcut twice in succession → only one
instance runs; the second launch flashes the existing window
to the foreground.
3. Settings → Theme → toggle Light/Dark while a Preview window
is open → the preview retints in lock-step.
4. Switch language to fr-FR / de-DE / pt-BR / ru-RU → no
`[Settings_Foo]` bracket fallbacks anywhere in the UI; tray
menu refreshes.
5. Settings → Capture countdown → 5s, then trigger the hotkey →
countdown ticks 5/4/3/2/1 in the dashboard status before the
shot fires.
6. Settings → Clipboard mode → Copy + Save, capture, paste into
Paint → image matches the saved file.
7. Settings → Open output folder after save → on, capture →
Explorer pops with the file directory.
8. Settings → Pin a floating thumbnail after each capture → on,
capture → small always-on-top window appears with the shot.
9. Preview window → Extract text (OCR) on a capture with text →
word-count toast, paste into Notepad confirms text.
10. Settings → Capture mode → Region, trigger hotkey → full-screen
dim overlay; drag a rectangle → Preview opens with the cropped
region. Esc on the overlay cancels cleanly.
## [1.4.0] - 2026-04-27
UX polish + accessibility cycle. No breaking changes; settings.json
schema unchanged.
### Added
- **Light / Dark / System theme** picker on the Settings tab. The
preference was already reserved in `AppSettings.Theme` since v1.3
but had no consumer; v1.4 wires it through to
`FrameworkElement.RequestedTheme` and re-applies on every
`ISettingsStore.Changed`. Mica retints automatically with the
resolved theme.
- **Auto-switch on Alt-Tab** (opt-in, default off). When enabled,
the dashboard's selected target follows the OS foreground window
via a `SetWinEventHook(EVENT_SYSTEM_FOREGROUND)` watcher with a
250 ms debounce. Apps not in the target list keep your current
selection. Toggle lives next to the existing capture toggles.
- **Four new language packs**: Japanese (ja-JP), Simplified Chinese
(zh-Hans), Korean (ko-KR), Spanish (es-ES). All machine-assisted —
the About → Translations disclaimer lists every machine-assisted
pack and invites native-speaker proofreading PRs.
- **Friendlier log lines** for end-user lifecycle events: `Picture
captured: {Name} ({W}×{H}, {KB} KB) at {Path} [{Format}]`,
`Picture capture cancelled by user.`, `Language switched to
{Code} ({Name}).`, `Theme switched to {Theme}.`, `Capture sound
{State}.`, `Auto-switch on Alt-Tab {State}.` Logs remain
English-only by design (file shareability + parser stability
across cultures).
### Changed
- **Window is now fixed-size** at 1200×720. Both maximize and
resize are disabled via `OverlappedPresenter.IsMaximizable` /
`IsResizable`; minimize remains enabled for the tray flow.
- **Tone shift on existing log call sites**: "Failed to X" →
"Couldn't X" across `DashboardViewModel`, `SettingsViewModel`,
`UpdateViewModel`, `AboutViewModel`, `LogViewerViewModel`.
Structured properties are unchanged so log queries and external
diagnostics still work.
## [1.3.1] - 2026-04-26
**Critical hotfix.** v1.3.0 shipped broken — the WinUI 3 publish pipeline
omitted `.xbf` (compiled XAML binary) and `CaptureImage.App.pri` (resource
manifest) files from the self-contained publish output, so the installed
app silently failed at MainWindow.InitializeComponent on every launch
(the process stayed alive zombie-style; no window ever appeared). v1.2.x
auto-update users hit this on the first launch after Velopack restart.
### Fixed
- Add a `CopyWinUIArtifactsToPublishDirectory` MSBuild target to
`CaptureImage.App.csproj` that propagates every `.xbf` and the
`CaptureImage.App.pri` from `bin/.../win-x64/` into the publish
output, preserving the cross-assembly XAML resolution subfolders
(`CaptureImage.UI/Controls/`, `CaptureImage.UI/Views/`). `dotnet
publish` for unpackaged WinUI 3 self-contained apps doesn't include
these by default — known WinAppSDK gap.
### Recovery for v1.3.0 users
If you already updated to broken v1.3.0:
- The Update tab can't help (the app's window doesn't open).
- Download `CaptureImage-win-Setup.exe` from the v1.3.1 GitHub Release
and run it — the installer detects the existing install and replaces
it cleanly. Your `settings.json` and capture folder are untouched.
## [1.3.0] - 2026-04-26
UI framework migration from Avalonia 11 to **WinUI 3 (Windows App SDK 1.8.x)**
with Fluent 2 design — Mica backdrop, Segoe UI Variable, integrated title bar,
Composition-API animations. Logic layers (Core / Infrastructure / ViewModels)
were intentionally left untouched: the entire ~5,000-line domain + capture +
hotkey + settings + logging stack carries forward unchanged. Velopack ships
on the existing `win` channel so v1.2.x users auto-update; multi-file
WindowsAppSDK self-contained payload is ~80–120 MB (vs the v1.2 single-file
~30 MB) — accepted trade for stack-Microsoft-native parity on Windows-only.
### Added
- **Sound on capture success** (`UI.SoundEnabled` setting now has a consumer
for the first time since v1.0). Plays Windows `SystemAsterisk` via Win32
`PlaySound` P/Invoke, gated on the existing checkbox.
- **Browse button** on Settings → Output folder. Opens the modern
`IFileOpenDialog` (Vista+ folder picker) seeded at the current
OutputDirectory. Win32 COM-interop fallback because
`Windows.Storage.Pickers.FolderPicker` is unreliable in unpackaged
WinUI 3.
- **Mica backdrop** on the main window — translucent Win11 wallpaper tint.
- **Borderless title bar** integrated with the Fluent 2 chrome; caption
buttons sit in a 48 px reserved drag region.
- **Composition slide animation** on the log drawer — 220 ms slide + 180 ms
fade with CubicBezier(0.4, 0, 0.2, 1) decelerate. Mirrors the v1.2
Avalonia drawer at the visual layer; uses `UIElement.Translation` (additive
on layout) instead of `Visual.Offset` (overrides layout) so the drawer
stays anchored to its Grid column under all window sizes.
- **+164 tests, total 320** (up from 156). New coverage:
- 18 converter tests (FlowDirection / BoolToVisibility / InvertedBoolToVisibility / NotNullToVisibility).
- 5 LogEntry tests (TimestampText format, FileLineText edge cases).
- 141 Theory cases for localization completeness — 47 load-bearing keys
× 3 cultures (en-US / vi-VN / ar-SA) — every shipping label asserted
non-empty + non-bracketed.
### Changed
- **UI framework**: Avalonia 11.2.3 → WinUI 3 (Windows App SDK
1.8.260416003) self-contained x64. ViewModels project still
TFM-portable (`net9.0`); UI + UI.Tests TFM bumped to
`net9.0-windows10.0.22621.0` to link WinAppSDK assemblies.
- **Tray icon**: `H.NotifyIcon.WindowsAppSDK` → `H.NotifyIcon.WinUI` (the
actual nuget.org package id; the WindowsAppSDK suffix never existed on
nuget). Tray ships with OS default glyph for v1.3.0 — proper .ico
round-trip via `System.Drawing.Bitmap.GetHicon` + `Icon.Save` deferred
to v1.4.
- **Folder picker**: Win32 `IFileOpenDialog` COM interop replaces the
unreliable `Windows.Storage.Pickers.FolderPicker` in
`CaptureImage.UI.Services.Win32FolderPicker`.
- **Tray menu commands** wired through `MenuFlyoutItem.Command` (not
`Click` event) — the latter doesn't fire reliably from H.NotifyIcon's
out-of-tree popup.
- **Sound playback** uses Win32 `PlaySound` P/Invoke instead of
`System.Media.SystemSounds` (the latter ships in
`System.Windows.Extensions` which only targets Windows TFMs, too
restrictive for the portable ViewModels project).
- **Tray-restore from minimize** uses `AppWindow.Show` +
`User32.ShowWindow(SW_RESTORE)` + `Window.Activate` +
`User32.SetForegroundWindow` — `Show` alone leaves taskbar-minimized
windows minimized + behind whatever has foreground focus.
- **Auto-refresh suppression** while a preview modal is up — Dashboard's
WMI-driven Targets refresh used to clobber the in-flight
`SelectedTarget` and disrupt the preview decision; now skipped when
state is Previewing or Saving.
- **3rd-party list** in About: drop Avalonia + Inter typeface, add
Windows App SDK / WinUI 3 + H.NotifyIcon.WinUI.
### Removed
- `Avalonia.*` packages (Avalonia, Avalonia.Desktop, Avalonia.Themes.Fluent,
Avalonia.Fonts.Inter, Avalonia.Diagnostics) and 25 .axaml files / Avalonia
service implementations (`AvaloniaTrayIconHost`, `AvaloniaPreviewPresenter`,
`AvaloniaUIDispatcher`, `BytesToBitmapConverter` for Avalonia.Bitmap,
`ToastKindToBrushConverter` for Avalonia.IBrush). All replaced with WinUI 3
equivalents.
- Inter typeface — Fluent 2's Segoe UI Variable is the explicit body font now.
- `PublishSingleFile` from the release workflow — WinAppSDK can't be
bundled into a single .exe, ships as multi-file folder packaged by
Velopack.
### Fixed
- (in v1.3 from v1.2 carry-overs) Title-bar caption buttons no longer
overlap nav rail / Page content — 48 px drag region reserved at top
via `Window.SetTitleBar(AppTitleBar)`.
### Deferred to v1.4
- Real .ico tray icon via `System.Drawing.Bitmap.GetHicon` round-trip
(currently OS default glyph). H.NotifyIcon.WinUI's IconSource pipeline
ends in `System.Drawing.Icon` which only accepts .ico file streams.
- `release.yml` upload of `CaptureImage-win-Portable.zip` (carry-over
from v1.2 — added in v1.3 release cut).
- DPI-aware initial window sizing (`AppWindow.Resize` takes physical
pixels; v1.3 hardcodes 1200×720).
## [1.2.0] - 2026-04-21
Logging overhaul. Turns a working-but-thin diagnostic surface into one you
can actually rely on when things go wrong — developer and end-user alike.
No capture-engine changes; Velopack release on the existing `win` channel
so the delta chain from v1.1.2 stays intact.
### Added
- **Runtime log-level control.** New Settings → Logging group with a
minimum-level picker (Debug / Information / Warning / Error).
Persisted in `AppSettings.LogLevel` (new field, schema bump v1 → v2,
additive) and pushed into Serilog's `LoggingLevelSwitch` live — no
restart required.
- **Log viewer min-level filter.** Dropdown in the log drawer header
narrows what's shown without touching the sink buffer, so Export
still carries the full history regardless of the filter.
- **"Open folder" button in the log drawer.** Launches Explorer at
`%LocalAppData%\CaptureImage\logs` for support-session copy-paste.
Guarded with a Toast on failure.
- **Caller context on every log entry** — each line carries `File`,
`Line`, and `Member` structured properties, captured via new
`LogInformationAt` / `LogWarningAt` / `LogErrorAt` / `LogDebugAt`
extension methods on `ILogger`. Rolling-file template now prints
`(File.cs:42)`; log viewer shows a subdued `File:Line` column; Export
includes the same. Absolute build-machine paths are stripped via
`Path.GetFileName` so shipped logs stay clean.
- **Global exception handlers.** `AppDomain.UnhandledException`,
`TaskScheduler.UnobservedTaskException`, and
`Dispatcher.UIThread.UnhandledException` all now reach Serilog before
the process dies or the UI resumes. `SetObserved()` on unobserved
task exceptions keeps the default-crash policy from ending the app on
background-thread throws.
- **Startup + shutdown banner** — Program.Main logs
`Version` / `OS` / `Culture` / `Args` on start and a
`Reason=Normal|StartupCrash` line on exit, so support sessions can
tell which build produced the log at a glance.
- **Expanded coverage** — `Windows.Graphics.Capture` engine emits Info
on session start, Debug on first frame + session dispose, Warning on
frame timeout, Error with explicit `HRESULT=0x…` on `COMException`;
`HotkeyConflictSniffer` decodes Win32 error codes by name
(`ERROR_HOTKEY_ALREADY_REGISTERED` / `ERROR_INVALID_PARAMETER` / …);
`SharpHookHotkeyService` logs when `TaskPoolGlobalHook` boots;
`VelopackUpdateService` logs before + after
`ApplyUpdatesAndRestart`; `AvaloniaTrayIconHost` logs tray
init/dispose and guards the runtime SkiaSharp icon render so a
native-asset blow-up falls back to the platform default instead of
crashing startup; `ResxLocalizationService` warns once per
`(culture, key)` pair when a resource key is missing (dedup
prevents flooding on every refresh).
### Changed
- **Window widened to 1200×720** (was 960×600) and **log drawer
widened to 480 px** (was 400 px). The drawer now slides in with a
200 ms fade + 48 px translate-X easing (`CircularEaseOut`) instead
of snapping in and out. Content area visible while the drawer is
open is now ~500 px (was ~340 px).
- **Scroll bars hidden on About + Settings tabs.** Mouse-wheel
scrolling still works; the track is just no longer drawn, so the
view reads cleanly on the fixed-size window. Horizontal scrolling
on those tabs is disabled entirely. Diagnostic surfaces (Update
log, Log viewer drawer) keep their visible bars.
- **Default minimum log level is now `Information`** (was `Debug`).
v1 users are migrated in place: `settings.json` is stamped
Version=2 on first v1.2 launch and the LogLevel field defaults to
`Information`. Flip back to Debug via Settings → Logging if you
were relying on verbose output.
- Four previously-silent `catch { /* ignore */ }` blocks now log
their exceptions: `SharpHookHotkeyService.Stop/Dispose` (Warning),
`WmiProcessWatcher.DisposeWatchers_NoLock` (Debug),
`JsonSettingsStore.Deserialize` (Warning with JSON line / byte
position), `JsonSettingsStore.TryDelete` (Debug).
### Migration
- **`settings.json` schema v1 → v2.** Automatic on first v1.2 run —
the file is re-written in canonical v2 form with `LogLevel =
"Information"` and existing values preserved. Hand-edited files
with `logLevel` already present keep their value.
### Tests
- 33 new unit tests (total 156, up from 123). Covers the
`InMemorySink` ring buffer / pause / clear / snapshot-copy
semantics, `SerilogLogLevelSwitcher` string mapping + fallback,
`CallerAwareLoggerExtensions` scope + path-stripping behaviour,
`LogViewerViewModel` hydration / filter / live-tail paths, and the
v1 → v2 settings migration with write-back.
## [1.1.2] - 2026-04-20
Localization hotfix on top of v1.1.1 — closes 13 bugs and gaps found in
a post-v1.1.1 audit plus three bugs reported during smoke testing of
the hotfix itself. No new features; no capture-engine changes. Velopack
release on the same `win` channel as v1.1.1 to keep the delta chain
intact.
### Fixed
- **Dashboard status line stale on culture switch.** `StatusMessage`
is an `[ObservableProperty]` stored backing field, so the v1.1.1
`OnPropertyChanged(nameof(Localization))` signal re-read the same
stored string. Redrive via `UpdateStatusForState()` on culture
change so the new culture's template wins.
- **Preview window hardcoded English.** `PreviewWindow.axaml` had
`Title="Preview"` and no `FlowDirection` binding, so the modal stayed
in English and rendered LTR under Arabic. Title now binds to
`Localization[Preview_Title]`; `FlowDirection` binds to
`Localization.CurrentFlowDirection`.
- **`PreviewViewModel` did not listen for culture changes.** If the
user switched language while the preview modal was open, the four
indexer bindings (`Preview_Title`, `Preview_Prompt`, `Preview_Save`,
`Preview_Discard`) stayed in the old culture. VM now implements
`IDisposable`, subscribes with a named `OnLocalizationChanged`, and
`AvaloniaPreviewPresenter` `using`-disposes it after the modal so
the subscription doesn't leak into the singleton service.
- **File picker titles hardcoded English.** `Import settings` /
`Export settings` now come from new resx keys
`Settings_ImportTitle` / `Settings_ExportTitle` (en + vi + ar).
- **Settings toast error title hardcoded English.**
`_toasts.ShowError("Error", …)` in three places now reads through
`Localization["Toast_Error"]` (new resx key).
- **About tab disclaimer body paragraphs hardcoded English.** The
three disclaimer headings were already localized; the body
paragraphs were not, leaving the tab half-translated for vi / ar
users. Added `About_TranslationDisclaimerBody`,
`About_CaptureLimitationDisclaimerBody`, and
`About_LiabilityDisclaimerBody` in all three resx files (machine-
assisted translation, matching the existing Translations
disclaimer). `AiAssistanceNotice` intentionally stays English — it
describes the development process, not the user-facing product.
- **Tray menu rebuilt 3× per culture switch.**
`AvaloniaTrayIconHost`'s `PropertyChanged` handler fired for every
notification the service raises (`Item[]` + `CurrentCulture` +
`CurrentFlowDirection`). Named handler now filters `"Item[]"` only,
and the subscription is torn down in `Dispose`.
- **`ResxLocalizationService.SetCulture` set only
`DefaultThreadCurrentUICulture`.** Date / number / currency
formatting on the UI thread kept the OS locale. The service now
also sets `CultureInfo.CurrentUICulture`, `CurrentCulture`, and
`DefaultThreadCurrentCulture` so implicit `.ToString()` follows
the chosen language.
- **Startup accepted any resolvable culture.** A hand-edited
`settings.json` with `Culture=fr-FR` would flip the app to fr and
fall through to neutral English resx while Settings still showed
"English" selected. `Program.cs` now validates the persisted
culture against `SupportedCultures` before calling `SetCulture`.
- **Log drawer toggle button did not retranslate live.** Same
compiled-indexer-binding limitation as the next item — the v1.1.1
`OnPropertyChanged(nameof(Localization))` signal does not wake
Avalonia compiled indexer bindings through an intermediate
property. Fix: expose `LogToggleLabel` and `LogToggleTooltip` as
plain computed properties on `MainWindowViewModel` and bind
MainWindow.axaml to those instead of the indexer path.
- **SettingsView did not retranslate live when the user switched
language from the Settings tab itself.** The view only refreshed
on re-navigation (DataTemplate re-instantiation). Added 18 plain
computed properties on `SettingsViewModel` and 6 on
`HotkeyBindingViewModel`, rewrote the bindings in
`SettingsView.axaml` and `HotkeyRecorder.axaml` to target them.
- **`settings.json` was never written on first run.**
`JsonSettingsStore.LoadAsync` created a fresh `AppSettings()` in
memory when the file was missing but only persisted on the first
user-triggered `Update()`. Partial / malformed / future-version
files left the on-disk form out of sync with the in-memory form.
`LoadAsync` now writes back when the file is missing, unparseable,
version-too-new, or when the canonical re-serialized form differs
from the raw JSON. Write failure is logged but non-fatal so a
read-only disk does not break Load.
### Changed
- **Handler hygiene across localization subscribers.** Anonymous
lambda subscriptions on `Localization.PropertyChanged` extracted
to named methods so they can be unsubscribed
(`DashboardViewModel`, `AboutViewModel`, `LogViewerViewModel`,
`SettingsViewModel`, `AvaloniaTrayIconHost`). `LogViewerViewModel`
and `SettingsViewModel` now implement `IDisposable` and
unsubscribe both of their event sources; runtime behavior is
unchanged because the DI container disposes singletons on
shutdown.
### Removed
- Four unused resx keys (`Settings_Theme`, `Tray_Arm`, `Tray_Disarm`,
`Log_Export`) in lockstep across en / vi / ar. None were wired to
UI; a future v1.2+ can re-add them when a theme picker, tray
arm/disarm, or log export button actually ships.
### Known limitations
- Toast title / message snapshot the localized string at the time
`ToastService.Show` is called; switching culture while a toast is
still fading out does not retranslate it. Fixing this requires
threading resx keys through `ToastService` instead of strings —
deferred to v1.2+ to keep this hotfix focused.
- `Dashboard` / `About` / `Update` / `LogViewer` tabs still use
`{Binding Localization[Key]}` indexer bindings in their
respective views. They refresh because navigation re-instantiates
them via `DataTemplate`; if a future change pins the active tab
through a culture switch, the same computed-property refactor may
be needed.
### Tests
- New `tests/CaptureImage.UI.Tests/` project covering
`ResxLocalizationService` (SetCulture thread-culture propagation,
FlowDirection mapping for ar-SA, event counts, indexer fallback
for missing keys, localized lookup for known keys, SupportedCultures
surface).
- New `tests/CaptureImage.ViewModels.Tests/Preview/PreviewViewModelTests.cs`
covering the v1.1.2 M1 fix: Localization PropertyChanged forwarding
- Dispose detachment.
## [1.1.1] - 2026-04-20
Hotfix on top of v1.1.0 — closes three bugs reported after the v1.1.0
@@ -395,7 +1163,7 @@ Major shell rewire landing everything the spec calls "polish".
- `IconExtractor` — extracts the associated icon for an executable and encodes as
PNG bytes, cached by path.
- `GameDetector` (`IProcessDetector`) — composes WindowEnumerator + IconExtractor
+ ISteamDetector into a single `EnumerateTargetsAsync()` call.
- ISteamDetector into a single `EnumerateTargetsAsync()` call.
- `WmiProcessWatcher` (`IProcessWatcher`) — WMI `__InstanceCreationEvent` /
`__InstanceDeletionEvent` subscription over `Win32_Process`, 2s poll window.
- `AvaloniaUIDispatcher` — `IUIThreadDispatcher` implementation over
+144
View File
@@ -0,0 +1,144 @@
# CLAUDE.md
Guidance for AI coding assistants (Claude Code and similar) working in this repository. Human
contributors: see [CONTRIBUTING.md](CONTRIBUTING.md).
## What this is
CaptureImage — a tray-resident, hotkey-driven Windows screenshot tool for games
(Windows.Graphics.Capture + Direct3D 11). C# on **.NET 10**, WPF + WPF UI 4.x, GPL-3.0-or-later.
Solo maintainer: poli0981, who communicates in Vietnamese.
## Build, test, run
```powershell
dotnet restore CaptureImage.sln # lock files; CI uses --locked-mode
dotnet build CaptureImage.sln -c Release # warnings are errors; src/ uses AnalysisMode=Recommended
dotnet test --solution CaptureImage.sln -c Release --no-build # Microsoft.Testing.Platform (global.json)
dotnet run --project src/CaptureImage.App -c Release -- --data-dir .\.devdata --instance-id dev
```
- SDK pinned in `global.json` (10.0.403, `latestFeature`). Tests are xunit.v3 on
Microsoft.Testing.Platform: use `--report-xunit-trx` and
`--coverage --coverage-output-format cobertura` (there is no `--logger trx`).
- **Never run a dev build against real user data.** Always pass `--data-dir <temp>` and
`--instance-id <name>`; the installed app keeps its data in `%LocalAppData%\poli0981\CaptureImage`
(1.x kept it in `%LocalAppData%\CaptureImage`).
- `--smoke-test` opens every page and exits 0; `--screenshots <dir>` also writes a PNG per page
(handy for checking UI changes without driving the mouse).
- UI tests (`tests/CaptureImage.App.UiTests`, FlaUI) move the mouse and type; they skip unless
`CAPTUREIMAGE_UI_TESTS=1`. Don't run them on the maintainer's desktop.
- Local tools (`dotnet tool restore`): `vpk`, `jb` (InspectCode), `nuget-license`,
`reportgenerator`, `dotnet-CycloneDX`, `dotnet-sonarscanner` (CI only; needs `SONAR_TOKEN`).
## Layout and layering rules
```text
src/CaptureImage.Core net10.0 — models, abstractions, settings migration, CaptureCoordinator; no Windows APIs
src/CaptureImage.Infrastructure Windows implementations (WGC/D3D11, RegisterHotKey, WinEvent, WIC/Skia, settings, Velopack, Serilog)
src/CaptureImage.ViewModels CommunityToolkit.Mvvm view models + Resources/Strings (11 languages); no UI-framework types
src/CaptureImage.UI WPF + WPF UI: App.xaml, windows, pages, overlays, toasts, tray, UI services
src/CaptureImage.App Main: Velopack hooks, single instance, Serilog, DI composition root
tests/* Core, Infrastructure, ViewModels tests + App.UiTests (FlaUI)
```
- Core and ViewModels stay free of UI-framework and `Windows.*` references; view models talk to
Core abstractions only (no `Process.Start`, file I/O or WPF types).
- Every resx key must exist in all 11 `Strings*.resx` files with the same `{0}` placeholders, and
every key must be used — `LocalizationCompletenessTests` enforces both.
- Central Package Management: versions live only in `Directory.Packages.props`; after changing
references run `dotnet restore --force-evaluate` and commit the `packages.lock.json` files.
- The version lives only in `Directory.Build.props` (`<Version>`).
## Code conventions
- Every `.cs` file starts with the SPDX header (IDE0073):
`// SPDX-License-Identifier: GPL-3.0-or-later` / `// Copyright (c) CaptureImage Contributors`.
- LF line endings (`.gitattributes` `eol=lf`), file-scoped namespaces, usings outside the namespace,
no unused members or usings (enforced at build), `[LoggerMessage]` source-generated logging.
- Run `dotnet format` only with the CI subsets: `dotnet format whitespace` and
`dotnet format style --diagnostics IDE0073 IDE0161 IDE0065 IDE0005`. A plain `dotnet format`
deletes XAML event handlers.
- Pass `CancellationToken`s through (SonarCloud S8949); tests use
`TestContext.Current.CancellationToken` (xUnit1051), and async tests await the async `File`
APIs (S6966).
- SonarQube Cloud imports the build's info-level analyzer suggestions as issues, so follow them:
primary constructors that keep `readonly` fields (IDE0290), `var` (IDE0007),
`[ObservableProperty]` on `public partial` properties rather than fields (MVVMTK0042),
`[LibraryImport]` rather than `[DllImport]` (SYSLIB1054). Fixers for one diagnostic at a time are
safe: `dotnet format style|analyzers --diagnostics <ID> --severity info`.
## Accessibility
[`ACCESSIBILITY.md`](ACCESSIBILITY.md) is the public statement (supported keys, testing record, known
limitations) — update it when UI behaviour changes. In XAML:
- Every icon-only control gets `AutomationProperties.Name`, unique per page (add the mode or card
when an action repeats); list items bind the container's name to an `AutomationName` that
includes their badges.
- Status text: `AutomationProperties.LiveSetting` + `a11y:LiveRegion.IsEnabled="True"` + a
binding with `NotifyOnTargetUpdated=True` (WPF never raises `LiveRegionChanged` itself);
notifications go through `Announcer`.
- Headings via the `PageTitle`/`SectionHeader` styles or `AutomationProperties.HeadingLevel`; theme
brushes, never colour alone; animations honour `SystemParameters.ClientAreaAnimation`; nothing
takes the focus from a game.
## Pitfalls already hit
- System.Text.Json source generation treats `init` properties as constructor parameters, so a
`[JsonExtensionData]` property must have a plain `set`.
- WPF UI: setting `Style` on a `ui:CardControl` (or `BasedOn="{StaticResource {x:Type …}}"`)
replaces its implicit style and hides header/icon — use `Margin` etc. instead. Pages need
`ScrollViewer.CanContentScroll="False"` or `NavigationView` wraps them in a ScrollViewer (lists lose
virtualization). `TitleBar.Header` replaces the title text. `NavigationViewItem` has no UIA Invoke
pattern.
- Never `Hide()`/`Close()`/`Shutdown()` from inside `Window.Closing`; defer with the dispatcher.
Exits go through `App.RequestExit()`.
- WPF projects exclude `System.IO` from implicit usings (`Path` clashes with `System.Windows.Shapes`).
## Pull requests and CI
- `main` is protected by a ruleset: PR required, signed commits, linear history, squash merge only
(PR title = commit subject, Conventional Commits), branch up to date, no bypass. Release tags `v*`
can't be moved or deleted.
- Required checks: `build`, `format`, `deadcode` (InspectCode, file-local rules), `audit`
(NuGet packages + the local tools in `.config/dotnet-tools.json`), `license` (shipped
dependencies vs `.github/license/allowed-licenses.json`), `publish-smoke` (publish +
`--smoke-test` + page screenshots artifact), `pr-title`, `dependency-review`, `workflow-lint`
(actionlint + zizmor), `docs` (markdownlint + offline lychee), `ui-tests` (FlaUI against the
built app), `sonarcloud`, plus CodeQL via the code-scanning rule.
- Never add `paths:` filters to a workflow that provides a required check. Actions are pinned to
full commit SHAs with a `# vX.Y.Z` comment.
- SonarQube Cloud (project `poli0981_captureimg`, org `poli0981`) runs as CI-based analysis in the
`sonarcloud` job (automatic analysis is off): `dotnet sonarscanner` begin → build → tests with
Cobertura coverage + TRX → end, which waits for the quality gate ("Sonar way": no new issues,
≥ 80 % coverage on new code). `CaptureImage.UI`, `CaptureImage.App` (tested out of process by
`ui-tests`/`publish-smoke`) and `.github/**` scripts are excluded from coverage. The job passes
without analysing when it can't analyse: no `SONAR_TOKEN` in fork and Dependabot PRs, and the free
plan analyses only `main` and PRs (a non-PR run on another branch fails "not allowed to access
data from non main branches"). Fix what it reports.
- Dependabot NuGet updates rely on `EnableWindowsTargeting=true` in `Directory.Build.props` (the
updater runs on Linux).
- NuGet prunes the WPF projects' Windows Desktop packages (System.Drawing.Common, EventLog, …) only
when restoring on Windows, so a Linux restore never matches the lock files. Jobs that restore run
on `windows-latest`; if a Dependabot PR fails `--locked-mode`, re-run
`dotnet restore CaptureImage.sln --force-evaluate` on Windows and push the lock files.
- README screenshots come from `--screenshots` with seeded demo data, rendered on a separate,
hidden desktop — never from a personal desktop, whose window titles show up on the Dashboard.
## Releases
1. Bump `<Version>` in `Directory.Build.props`; rename `## [Unreleased]` in `CHANGELOG.md` to
`## [x.y.z] - date` (it becomes the release and in-app update notes).
2. After the PR merges: `git tag -s vX.Y.Z -m "…"` and push the tag.
3. `release.yml` builds, tests, publishes framework-dependent, smoke-tests, packs with Velopack
(`packId CaptureImage`, `mainExe CaptureImage.App.exe`, channel `win`, `--framework
net10.0.14-x64-desktop` — never change the first three; the framework names the minimum runtime
patch, raised with .NET security releases), attaches SBOM, SHA256SUMS and provenance
attestations, and creates a **draft** release.
4. Verify the draft (see `docs/RELEASING.md`), then `gh release edit vX.Y.Z --draft=false`.
## Contacts used in docs and the About page
`contact@poli0981.dev` (general) and <https://poli0981.dev/links>; role aliases at the same domain:
security@, privacy@, legal@, copyright@, dmca@, takedown@, code@, sponsor@, games@, collab@, press@.
+18
View File
@@ -0,0 +1,18 @@
# Code of Conduct
CaptureImage follows the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
In short: be respectful and welcoming, assume good intent, give and accept constructive feedback
gracefully, and focus on what is best for the community. Harassment, insults, personal or political
attacks, sexualized language or imagery, and publishing others' private information are not
acceptable — in issues, discussions, pull requests, reviews or any other project space.
## Reporting
If you experience or witness unacceptable behavior, contact the maintainer at
`contact@poli0981.dev`. Reports are handled confidentially. The maintainer may remove, edit or
reject comments, commits, issues and other contributions that violate this code, and may
temporarily or permanently ban contributors for behavior they consider inappropriate, following the
enforcement guidelines of the Contributor Covenant.
This code applies in all project spaces and when someone represents the project in public.
+105
View File
@@ -0,0 +1,105 @@
# Contributing to CaptureImage
Thanks for wanting to help! Bug reports, translations, documentation fixes and code are all welcome.
Please follow the [Code of Conduct](CODE_OF_CONDUCT.md).
## Ways to help
- **Report a bug or suggest a feature** with the issue templates (see [`SUPPORT.md`](SUPPORT.md)).
- **Proofread a translation.** The user interface is translated into 11 languages, mostly with AI
assistance. Strings live in `src/CaptureImage.ViewModels/Resources/Strings/Strings.<language>.resx`
(English is `Strings.resx`). Keep every `{0}`-style placeholder and the names in `{Game}`-style
file-name tokens unchanged.
- **Fix a bug or build a feature.** For anything larger than a small fix, please open an issue or a
discussion first so we can agree on the approach.
- **Report or fix an accessibility barrier.** Reports from people who use a screen reader, a
contrast theme or only a keyboard are especially valuable — see
[`ACCESSIBILITY.md`](ACCESSIBILITY.md).
## Development setup
- Windows 11 22H2 or later, 64-bit.
- The .NET 10 SDK version pinned in [`global.json`](global.json).
- Any editor; JetBrains Rider and Visual Studio 2026 both work.
```bash
dotnet build CaptureImage.sln -c Release
dotnet test --solution CaptureImage.sln -c Release
dotnet run --project src/CaptureImage.App -c Release -- --data-dir ./.devdata --instance-id dev
```
Use `--data-dir` and `--instance-id` so a development copy never touches your real settings or a
copy you have installed. [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) explains how the projects fit
together.
End-to-end UI tests move the mouse and type, so they only run with `CAPTUREIMAGE_UI_TESTS=1`:
```bash
CAPTUREIMAGE_UI_TESTS=1 dotnet test --project tests/CaptureImage.App.UiTests -c Release
```
## Pull requests
Every pull request must pass the required checks before it can be merged (squash merge only):
- **build** — warnings are errors, the recommended .NET analyzers are on for `src/`, all tests pass.
- **format** — `dotnet format whitespace` and the style rules below.
- **deadcode** — JetBrains InspectCode finds no unused or redundant code.
- **audit** / **license** — no vulnerable packages or .NET tools; shipped dependencies use a
GPL-compatible license.
- **publish-smoke** — the published app starts and opens every page.
- **ui-tests** — end-to-end tests drive the built app through UI Automation (FlaUI).
- **sonarcloud** — the [SonarQube Cloud](https://sonarcloud.io/project/overview?id=poli0981_captureimg)
quality gate: no new issues and at least 80 % test coverage on new code (the WPF shell in
`CaptureImage.UI`, the `CaptureImage.App` host and the CI scripts are left out of coverage; the
UI tests cover the first two). Pull requests from forks are analysed after they are merged,
because the analysis needs a repository secret.
- **pr-title** — the title follows [Conventional Commits](https://www.conventionalcommits.org/), e.g.
`fix(capture): keep alpha opaque` or `feat(ui)!: …` for breaking changes.
- **dependency-review**, **workflow-lint**, **docs**.
Conventions:
- Every C# file starts with the SPDX header:
```csharp
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
```
- File-scoped namespaces, `using` directives outside the namespace, no unused usings.
- Logging uses source-generated `[LoggerMessage]` methods.
- Every user-visible string is a resource key with a translation in all 11 `.resx` files (a test
checks this). Add the English text and, if you can't translate, ask in the pull request.
- Packages are managed centrally in `Directory.Packages.props` with lock files; after changing a
dependency run `dotnet restore --force-evaluate` and commit the updated `packages.lock.json` files.
- Commits must be signed (GPG or SSH) — the `main` branch requires verified signatures.
- User-interface changes follow the accessibility rules in
[`ACCESSIBILITY.md`](ACCESSIBILITY.md#contributor-expectations): keyboard access, unique
accessible names, announced status text, theme brushes, reduced motion — and a quick check with
Narrator. The pull request template has a checklist.
Before pushing, the quick local check is:
```bash
dotnet build CaptureImage.sln -c Release
dotnet test --solution CaptureImage.sln -c Release
dotnet format whitespace CaptureImage.sln --verify-no-changes
dotnet format style CaptureImage.sln --verify-no-changes --diagnostics IDE0073 IDE0161 IDE0065 IDE0005
```
## AI-assisted contributions
AI tools are fine to use. Please mention it in the pull request, review everything you submit as if
you wrote it, and make sure it builds and passes the tests. Commits with meaningful AI authorship
should carry a `Co-Authored-By` trailer naming the model.
## License
By contributing you agree that your work is released under the
[GPL-3.0-or-later](LICENSE) license, and that you have the right to license it. Contributors are
listed in [`docs/CONTRIBUTORS.md`](docs/CONTRIBUTORS.md).
## Contact
Questions about contributing: `code@poli0981.dev`, or open a discussion.
+50 -33
View File
@@ -11,16 +11,20 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureImage.Infrastructure
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureImage.ViewModels", "src\CaptureImage.ViewModels\CaptureImage.ViewModels.csproj", "{0F060F46-7782-4686-8C12-56261A2876D6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureImage.UI", "src\CaptureImage.UI\CaptureImage.UI.csproj", "{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureImage.App", "src\CaptureImage.App\CaptureImage.App.csproj", "{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureImage.Core.Tests", "tests\CaptureImage.Core.Tests\CaptureImage.Core.Tests.csproj", "{41DC8750-7186-494E-80BC-845C5071DF8F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureImage.Infrastructure.Tests", "tests\CaptureImage.Infrastructure.Tests\CaptureImage.Infrastructure.Tests.csproj", "{679C3869-EE49-4A76-ADF2-431430B781E1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureImage.ViewModels.Tests", "tests\CaptureImage.ViewModels.Tests\CaptureImage.ViewModels.Tests.csproj", "{65E8FCC7-53C0-4793-925F-3AB562EFC562}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureImage.UI", "src\CaptureImage.UI\CaptureImage.UI.csproj", "{B151D050-4DEC-46A5-BB62-97578B2359BC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureImage.App", "src\CaptureImage.App\CaptureImage.App.csproj", "{7885E645-F1F9-42EC-808A-69E1433FFCC9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0AB3BF05-4346-4AA6-1389-037BE0695223}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureImage.App.UiTests", "tests\CaptureImage.App.UiTests\CaptureImage.App.UiTests.csproj", "{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -67,30 +71,6 @@ Global
{0F060F46-7782-4686-8C12-56261A2876D6}.Release|x64.Build.0 = Release|Any CPU
{0F060F46-7782-4686-8C12-56261A2876D6}.Release|x86.ActiveCfg = Release|Any CPU
{0F060F46-7782-4686-8C12-56261A2876D6}.Release|x86.Build.0 = Release|Any CPU
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}.Debug|x64.ActiveCfg = Debug|Any CPU
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}.Debug|x64.Build.0 = Debug|Any CPU
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}.Debug|x86.ActiveCfg = Debug|Any CPU
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}.Debug|x86.Build.0 = Debug|Any CPU
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}.Release|Any CPU.Build.0 = Release|Any CPU
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}.Release|x64.ActiveCfg = Release|Any CPU
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}.Release|x64.Build.0 = Release|Any CPU
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}.Release|x86.ActiveCfg = Release|Any CPU
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3}.Release|x86.Build.0 = Release|Any CPU
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}.Debug|x64.ActiveCfg = Debug|Any CPU
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}.Debug|x64.Build.0 = Debug|Any CPU
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}.Debug|x86.ActiveCfg = Debug|Any CPU
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}.Debug|x86.Build.0 = Debug|Any CPU
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}.Release|Any CPU.Build.0 = Release|Any CPU
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}.Release|x64.ActiveCfg = Release|Any CPU
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}.Release|x64.Build.0 = Release|Any CPU
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}.Release|x86.ActiveCfg = Release|Any CPU
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3}.Release|x86.Build.0 = Release|Any CPU
{41DC8750-7186-494E-80BC-845C5071DF8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41DC8750-7186-494E-80BC-845C5071DF8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41DC8750-7186-494E-80BC-845C5071DF8F}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -127,6 +107,42 @@ Global
{65E8FCC7-53C0-4793-925F-3AB562EFC562}.Release|x64.Build.0 = Release|Any CPU
{65E8FCC7-53C0-4793-925F-3AB562EFC562}.Release|x86.ActiveCfg = Release|Any CPU
{65E8FCC7-53C0-4793-925F-3AB562EFC562}.Release|x86.Build.0 = Release|Any CPU
{B151D050-4DEC-46A5-BB62-97578B2359BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B151D050-4DEC-46A5-BB62-97578B2359BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B151D050-4DEC-46A5-BB62-97578B2359BC}.Debug|x64.ActiveCfg = Debug|Any CPU
{B151D050-4DEC-46A5-BB62-97578B2359BC}.Debug|x64.Build.0 = Debug|Any CPU
{B151D050-4DEC-46A5-BB62-97578B2359BC}.Debug|x86.ActiveCfg = Debug|Any CPU
{B151D050-4DEC-46A5-BB62-97578B2359BC}.Debug|x86.Build.0 = Debug|Any CPU
{B151D050-4DEC-46A5-BB62-97578B2359BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B151D050-4DEC-46A5-BB62-97578B2359BC}.Release|Any CPU.Build.0 = Release|Any CPU
{B151D050-4DEC-46A5-BB62-97578B2359BC}.Release|x64.ActiveCfg = Release|Any CPU
{B151D050-4DEC-46A5-BB62-97578B2359BC}.Release|x64.Build.0 = Release|Any CPU
{B151D050-4DEC-46A5-BB62-97578B2359BC}.Release|x86.ActiveCfg = Release|Any CPU
{B151D050-4DEC-46A5-BB62-97578B2359BC}.Release|x86.Build.0 = Release|Any CPU
{7885E645-F1F9-42EC-808A-69E1433FFCC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7885E645-F1F9-42EC-808A-69E1433FFCC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7885E645-F1F9-42EC-808A-69E1433FFCC9}.Debug|x64.ActiveCfg = Debug|Any CPU
{7885E645-F1F9-42EC-808A-69E1433FFCC9}.Debug|x64.Build.0 = Debug|Any CPU
{7885E645-F1F9-42EC-808A-69E1433FFCC9}.Debug|x86.ActiveCfg = Debug|Any CPU
{7885E645-F1F9-42EC-808A-69E1433FFCC9}.Debug|x86.Build.0 = Debug|Any CPU
{7885E645-F1F9-42EC-808A-69E1433FFCC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7885E645-F1F9-42EC-808A-69E1433FFCC9}.Release|Any CPU.Build.0 = Release|Any CPU
{7885E645-F1F9-42EC-808A-69E1433FFCC9}.Release|x64.ActiveCfg = Release|Any CPU
{7885E645-F1F9-42EC-808A-69E1433FFCC9}.Release|x64.Build.0 = Release|Any CPU
{7885E645-F1F9-42EC-808A-69E1433FFCC9}.Release|x86.ActiveCfg = Release|Any CPU
{7885E645-F1F9-42EC-808A-69E1433FFCC9}.Release|x86.Build.0 = Release|Any CPU
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}.Debug|x64.ActiveCfg = Debug|Any CPU
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}.Debug|x64.Build.0 = Debug|Any CPU
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}.Debug|x86.ActiveCfg = Debug|Any CPU
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}.Debug|x86.Build.0 = Debug|Any CPU
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}.Release|Any CPU.Build.0 = Release|Any CPU
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}.Release|x64.ActiveCfg = Release|Any CPU
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}.Release|x64.Build.0 = Release|Any CPU
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}.Release|x86.ActiveCfg = Release|Any CPU
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -135,10 +151,11 @@ Global
{BE4B464E-F2AD-445F-A40A-1C8D9EF6CF5E} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{56963B42-4D6F-441F-9283-576526FF517A} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{0F060F46-7782-4686-8C12-56261A2876D6} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{B443C8B4-AD41-4016-BF6E-7F1C9FF4ABC3} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{19A8672D-1A5F-4120-A66E-F6BD2C8431E3} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{41DC8750-7186-494E-80BC-845C5071DF8F} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{679C3869-EE49-4A76-ADF2-431430B781E1} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{65E8FCC7-53C0-4793-925F-3AB562EFC562} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{41DC8750-7186-494E-80BC-845C5071DF8F} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{679C3869-EE49-4A76-ADF2-431430B781E1} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{65E8FCC7-53C0-4793-925F-3AB562EFC562} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{B151D050-4DEC-46A5-BB62-97578B2359BC} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{7885E645-F1F9-42EC-808A-69E1433FFCC9} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{30BE110B-1E5E-4FBB-B498-4B68D11A0D97} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
EndGlobalSection
EndGlobal
+36 -12
View File
@@ -1,36 +1,60 @@
<Project>
<PropertyGroup>
<!-- Language / compiler -->
<PropertyGroup Label="Language / compiler">
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors>nullable</WarningsAsErrors>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AnalysisLevel>latest</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<!-- Needed so IDE0005 (unnecessary using) is reported by the compiler, not only in the IDE.
CS1591 (missing XML doc on public members) stays muted below. -->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<!-- Deterministic + source link friendly -->
<PropertyGroup Label="Reproducible restore + build">
<Deterministic>true</Deterministic>
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<RestoreLockedMode Condition="'$(CI)' == 'true'">true</RestoreLockedMode>
<!-- Dependabot's NuGet updater runs on Linux. Without this, every Windows-TFM project fails
to evaluate there and every newer package version is reported "not compatible", so no
update PR is ever opened. Harmless on Windows. -->
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<!-- The app ships for win-x64 only. Declaring the RID for every project keeps each
packages.lock.json identical between a plain `dotnet restore` and the
`dotnet publish -r win-x64` restore, so locked mode works for both. -->
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
</PropertyGroup>
<!-- Assembly / product info -->
<PropertyGroup Label="Supply chain">
<NuGetAudit>true</NuGetAudit>
<NuGetAuditMode>all</NuGetAuditMode>
<NuGetAuditLevel>low</NuGetAuditLevel>
</PropertyGroup>
<PropertyGroup Label="Version (single source of truth — the release workflow checks the tag against it)">
<Version>2.1.0</Version>
<AssemblyVersion>$([System.Text.RegularExpressions.Regex]::Match('$(Version)', '^\d+\.\d+\.\d+').Value).0</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>
<PropertyGroup Label="Product metadata">
<Product>CaptureImage</Product>
<Company>CaptureImage Contributors</Company>
<Authors>poli0981 and contributors</Authors>
<Copyright>Copyright (c) CaptureImage Contributors. Licensed under GPL-3.0-or-later.</Copyright>
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<NeutralLanguage>en</NeutralLanguage>
<!-- Repository metadata — lands in the assembly manifest and the About tab. -->
<RepositoryUrl>https://github.com/poli0981/captureimg</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://github.com/poli0981/captureimg</PackageProjectUrl>
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
</PropertyGroup>
<!-- Repo-wide suppressions -->
<PropertyGroup Label="Repo-wide suppressions">
<!-- CA1014: CLSCompliant attribute is meaningless for an app. CS1591: XML docs on every
public member are not required. -->
<NoWarn>$(NoWarn);CA1014;CS1591</NoWarn>
</PropertyGroup>
+27 -58
View File
@@ -5,83 +5,52 @@
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup Label="Avalonia">
<PackageVersion Include="Avalonia" Version="11.2.3" />
<PackageVersion Include="Avalonia.Desktop" Version="11.2.3" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.2.3" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.2.3" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.2.3" />
<ItemGroup Label="WPF UI">
<PackageVersion Include="WPF-UI" Version="4.3.0" />
<PackageVersion Include="H.NotifyIcon.Wpf" Version="2.4.1" />
</ItemGroup>
<ItemGroup Label="MVVM">
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2" />
</ItemGroup>
<ItemGroup Label="DI / Hosting / Localization">
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Localization" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.0" />
</ItemGroup>
<ItemGroup Label="Tray">
<PackageVersion Include="H.NotifyIcon.WindowsAppSDK" Version="2.2.0" />
<PackageVersion Include="H.NotifyIcon" Version="2.2.0" />
</ItemGroup>
<ItemGroup Label="Hotkeys">
<PackageVersion Include="SharpHook" Version="5.3.9" />
</ItemGroup>
<ItemGroup Label="State machine">
<PackageVersion Include="Stateless" Version="5.15.0" />
<ItemGroup Label="Microsoft.Extensions">
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.14" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.14" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.14" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.14" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.14" />
</ItemGroup>
<ItemGroup Label="Logging">
<PackageVersion Include="Serilog" Version="4.2.0" />
<PackageVersion Include="Serilog.Extensions.Hosting" Version="9.0.0" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageVersion Include="Serilog" Version="4.4.0" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="10.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="7.0.0" />
<PackageVersion Include="Serilog.Sinks.Async" Version="2.1.0" />
</ItemGroup>
<ItemGroup Label="Windows interop + D3D11">
<PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.2.0" />
<PackageVersion Include="Vortice.Direct3D11" Version="3.6.2" />
<PackageVersion Include="Vortice.DXGI" Version="3.6.2" />
<PackageVersion Include="System.Management" Version="9.0.0" />
<PackageVersion Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageVersion Include="System.Drawing.Common" Version="9.0.0" />
</ItemGroup>
<ItemGroup Label="Filesystem abstractions (for tests)">
<PackageVersion Include="System.IO.Abstractions" Version="21.2.1" />
<ItemGroup Label="Windows interop: Direct3D 11, DXGI, WIC, Win32 P/Invoke">
<PackageVersion Include="Vortice.Direct3D11" Version="3.8.3" />
<PackageVersion Include="Vortice.DXGI" Version="3.8.3" />
<PackageVersion Include="Vortice.Direct2D1" Version="3.8.3" />
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.367" />
</ItemGroup>
<ItemGroup Label="Imaging">
<!-- Avalonia ships SkiaSharp transitively, but Infrastructure doesn't reference Avalonia
so we pin it explicitly here. Bumping deliberately to match Avalonia's choice. -->
<PackageVersion Include="SkiaSharp" Version="3.119.2" />
<PackageVersion Include="SkiaSharp.NativeAssets.Win32" Version="3.119.2" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.12" />
<PackageVersion Include="SkiaSharp" Version="4.154.0" />
</ItemGroup>
<ItemGroup Label="Auto-update">
<PackageVersion Include="Velopack" Version="0.0.1053" />
<ItemGroup Label="Auto-update (keep in lockstep with the vpk tool in .config/dotnet-tools.json)">
<PackageVersion Include="Velopack" Version="1.2.161" />
</ItemGroup>
<ItemGroup Label="Tests">
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="FluentAssertions" Version="6.12.2" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="21.2.1" />
<PackageVersion Include="coverlet.collector" Version="8.0.1" />
<PackageVersion Include="xunit.v3" Version="4.0.2" />
<PackageVersion Include="AwesomeAssertions" Version="9.6.0" />
<PackageVersion Include="NSubstitute" Version="6.2.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.12.0" />
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="10.11.0" />
<PackageVersion Include="FlaUI.UIA3" Version="5.0.0" />
</ItemGroup>
</Project>
+60 -38
View File
@@ -4,48 +4,70 @@ Copyright (c) CaptureImage Contributors
This product is licensed under the GNU General Public License v3.0 or later (GPL-3.0-or-later).
See LICENSE for the full license text.
Contact: contact@poli0981.dev (copyright: copyright@poli0981.dev, legal: legal@poli0981.dev)
================================================================================
Third-party components
================================================================================
This product includes software developed by third parties. The following table
lists every runtime dependency together with its upstream license. All listed
licenses are compatible with distribution under GPL-3.0-or-later.
This product includes the following third-party packages. All of them are licensed under terms
compatible with GPL-3.0-or-later. Details and project links: docs/legal/THIRD_PARTY_NOTICES.md.
Package SPDX license
--------------------------------------- -----------------
Avalonia MIT
Avalonia.Desktop MIT
Avalonia.Themes.Fluent MIT
Avalonia.Fonts.Inter MIT
Avalonia.Diagnostics MIT
CommunityToolkit.Mvvm MIT
Microsoft.Extensions.DependencyInjection MIT
Microsoft.Extensions.Hosting MIT
Microsoft.Extensions.Localization MIT
Microsoft.Extensions.Logging MIT
Microsoft.Extensions.Options MIT
H.NotifyIcon MIT
SharpHook MIT
Stateless Apache-2.0
Serilog Apache-2.0
Serilog.Extensions.Hosting Apache-2.0
Serilog.Extensions.Logging Apache-2.0
Serilog.Sinks.Console Apache-2.0
Serilog.Sinks.File Apache-2.0
Serilog.Sinks.Async Apache-2.0
Microsoft.Windows.CsWinRT MIT
Vortice.Direct3D11 MIT
Vortice.DXGI MIT
System.Management MIT
SixLabors.ImageSharp (>= 3.1) Apache-2.0
Velopack MIT
SkiaSharp (transitive via Avalonia) MIT
Inter font (transitive via Avalonia) OFL-1.1
Package SPDX license
------------------------------------------------------- ------------
CommunityToolkit.Mvvm MIT
H.GeneratedIcons.System.Drawing MIT
H.NotifyIcon MIT
H.NotifyIcon.Wpf MIT
Microsoft.Extensions.Configuration MIT
Microsoft.Extensions.Configuration.Abstractions MIT
Microsoft.Extensions.Configuration.Binder MIT
Microsoft.Extensions.Configuration.CommandLine MIT
Microsoft.Extensions.Configuration.EnvironmentVariables MIT
Microsoft.Extensions.Configuration.FileExtensions MIT
Microsoft.Extensions.Configuration.Json MIT
Microsoft.Extensions.Configuration.UserSecrets MIT
Microsoft.Extensions.DependencyInjection MIT
Microsoft.Extensions.DependencyInjection.Abstractions MIT
Microsoft.Extensions.Diagnostics MIT
Microsoft.Extensions.Diagnostics.Abstractions MIT
Microsoft.Extensions.FileProviders.Abstractions MIT
Microsoft.Extensions.FileProviders.Physical MIT
Microsoft.Extensions.FileSystemGlobbing MIT
Microsoft.Extensions.Hosting MIT
Microsoft.Extensions.Hosting.Abstractions MIT
Microsoft.Extensions.Logging MIT
Microsoft.Extensions.Logging.Abstractions MIT
Microsoft.Extensions.Logging.Configuration MIT
Microsoft.Extensions.Logging.Console MIT
Microsoft.Extensions.Logging.Debug MIT
Microsoft.Extensions.Logging.EventLog MIT
Microsoft.Extensions.Logging.EventSource MIT
Microsoft.Extensions.Options MIT
Microsoft.Extensions.Options.ConfigurationExtensions MIT
Microsoft.Extensions.Primitives MIT
Serilog Apache-2.0
Serilog.Extensions.Logging Apache-2.0
Serilog.Sinks.Async Apache-2.0
Serilog.Sinks.File Apache-2.0
SharpGen.Runtime MIT
SharpGen.Runtime.COM MIT
SkiaSharp MIT
SkiaSharp.NativeAssets.Win32 MIT
Velopack MIT
Vortice.Direct2D1 MIT
Vortice.Direct3D11 MIT
Vortice.DirectX MIT
Vortice.DXGI MIT
Vortice.Mathematics MIT
WPF-UI MIT
WPF-UI.Abstractions MIT
Test-only dependencies are not redistributed with the binary and are omitted.
Also used at runtime: the .NET 10 Desktop Runtime (MIT), the Windows SDK projection for .NET
(MIT) and the Fluent System Icons font embedded in WPF UI (MIT).
Full license texts for Apache-2.0, MIT, and OFL-1.1 can be retrieved from:
- https://www.apache.org/licenses/LICENSE-2.0.txt
- https://opensource.org/licenses/MIT
- https://openfontlicense.org/open-font-license-official-text/
Build and test tools are not redistributed with the binary and are omitted.
License texts:
- https://opensource.org/license/mit
- https://www.apache.org/licenses/LICENSE-2.0
+145 -145
View File
@@ -1,208 +1,208 @@
# CaptureImage
[![CI](https://github.com/poli0981/captureimg/actions/workflows/ci.yml/badge.svg)](https://github.com/poli0981/captureimg/actions/workflows/ci.yml)
[![Latest release](https://img.shields.io/github/v/release/poli0981/captureimg?include_prereleases&sort=semver)](https://github.com/poli0981/captureimg/releases)
[![Latest release](https://img.shields.io/github/v/release/poli0981/captureimg?sort=semver)](https://github.com/poli0981/captureimg/releases)
[![License: GPL-3.0](https://img.shields.io/badge/License-GPL--3.0--or--later-blue.svg)](LICENSE)
[![.NET 9](https://img.shields.io/badge/.NET-9.0-512BD4.svg)](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)
[![.NET 10](https://img.shields.io/badge/.NET-10.0-512BD4.svg)](https://dotnet.microsoft.com/download/dotnet/10.0)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/poli0981/captureimg/badge)](https://securityscorecards.dev/viewer/?uri=github.com/poli0981/captureimg)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=poli0981_captureimg&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=poli0981_captureimg)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=poli0981_captureimg&metric=coverage)](https://sonarcloud.io/component_measures?id=poli0981_captureimg&metric=coverage)
A lightweight Windows screen-capture tool for games that don't ship a
built-in screenshot feature. Tray-resident, hotkey-driven, fast, and
gentle on resources.
A lightweight Windows screenshot tool for games that don't have their own screenshot key.
It sits in the tray, stays out of the way, and takes a clean capture when you press a hotkey.
> **One-line pitch:** pick a target window from a list, press
> `Ctrl+Shift+F12`, and your PNG lands in `Pictures\CaptureImage\`. That's it.
> **In one line:** click **Arm**, press `Ctrl+Shift+F12` in your game, and the PNG is in
> `Pictures\CaptureImage`.
## Why
Many games — especially older ones, smaller indie titles, emulators,
and anything outside Steam — don't bundle a screenshot key. The Windows
built-in options (Snipping Tool, Xbox Game Bar, `Print Screen`) either
don't work on fullscreen DirectX surfaces or require interrupting your
session. The heavy alternatives (OBS, ShareX) are overkill when all you
want is _one frame of a specific window, now, into a file_.
Many games — older titles, small indie games, emulators, anything outside Steam — have no
screenshot key. Print Screen, the Snipping Tool and the Xbox Game Bar either miss full-screen
DirectX surfaces or pull you out of the game, and OBS or ShareX are a lot of machinery when all you
want is _one frame of one window, now, in a file_.
CaptureImage fills that gap. It uses the same `Windows.Graphics.Capture`
API that OBS Studio uses for its Game Capture source, ships as a small
tray app, and stays out of your way until you press the hotkey.
CaptureImage uses `Windows.Graphics.Capture` — the API behind OBS Studio's window capture — from a
small tray app that does nothing until you press a hotkey.
## Features
- **Windows.Graphics.Capture** engine — hardware-accelerated, works with
DX11/DX12/Vulkan windowed and borderless titles, same API OBS uses.
- **PrintWindow fallback** for legacy windowed apps that WGC refuses.
- **Live Dashboard** — every visible top-level window with an icon and
title, refreshed in real time via WMI process events.
- **Steam warning badge** — if a capture target lives under a Steam
library, a small badge reminds you that F12 screenshots are available
via the Steam Overlay, and that some anti-cheat titles may block
external capture.
- **Arm + global hotkey** — default `Ctrl+Shift+F12`, rebind in Settings
(full hotkey editor is M6+).
- **Preview gate** — optional; show each capture, click Save or Discard.
- **4 output formats** — PNG, JPEG, WebP, TIFF, with per-format quality.
- **Local, private by default** — no telemetry, no cloud, no account.
Update check is the only network call, and only when you click the
button. See [`docs/legal/PRIVACY.md`](docs/legal/PRIVACY.md).
- **Tray icon + minimize-to-tray**, runtime-generated so no binary
asset to ship yet.
- **Toasts, preview dialog, real-time log drawer** in the UI.
- **Localized** — English, Vietnamese, Arabic (with live RTL mirroring).
Translations are machine-assisted — see
[`docs/legal/DISCLAIMER.md §4`](docs/legal/DISCLAIMER.md).
- **Velopack auto-update** from GitHub Releases. Security policy below.
- **Three capture modes, three hotkeys**
- **Window** (`Ctrl+Shift+F12`) — the window in front, or the one you locked on the Dashboard.
- **Region** (`Ctrl+Shift+F11`) — freezes every screen and lets you drag an area; a click takes
the whole screen.
- **Screen** (`Ctrl+Shift+F10`) — the monitor under the mouse pointer.
- **Works on every monitor**, at any scaling, including mixed-DPI setups.
- **HDR** — on HDR displays the full HDR frame is captured and tone-mapped to a normal image; the
original can be kept as a JPEG XR (`.jxr`) file next to it.
- **Library** — every capture with thumbnails; filter by game or HDR; open, show in folder, copy
the image or path, extract text (OCR), pin on screen, move to the Recycle Bin.
- **Game profiles** — per-game folder, format, file name and HDR settings, matched by executable
path, executable name or Steam AppId. A profile can arm the hotkeys and lock the game window as
soon as the game comes to the front.
- **PNG, JPEG, WebP or TIFF**, with quality / compression settings and a file-name template
(`{Game}`, `{Process}`, `{Mode}`, date and time, `{counter}`).
- **Optional preview** before saving, countdown (3 / 5 / 10 s), copy to the clipboard, open the
folder after saving, pin a floating thumbnail.
- **Stays out of your game** — hotkeys are registered only while armed (no keyboard or mouse hook),
notifications never take focus and never appear in your screenshots, and the app drops to
Windows' efficiency mode while it idles in the tray.
- **Steam badge** on windows of Steam games (some anti-cheat titles block external capture; Steam's
own F12 screenshot works there).
- **11 languages** — English, Tiếng Việt, العربية (right to left), 日本語, 简体中文, 한국어, Español,
Français, Deutsch, Português (Brasil), Русский. Translations are machine-assisted — see
[`docs/legal/DISCLAIMER.md`](docs/legal/DISCLAIMER.md).
- **Light, dark and high-contrast themes**, following Windows by default.
- **Keyboard and screen-reader friendly** — everything works without a mouse, including region
selection with the arrow keys; Narrator reads every control, status change and notification. See
[`ACCESSIBILITY.md`](ACCESSIBILITY.md).
- **Start with Windows**, start minimized, arm on startup.
- **Private by default** — no telemetry, no account, no cloud. The only network request is the
update check. See [`docs/legal/PRIVACY.md`](docs/legal/PRIVACY.md).
- **In-app updates** from GitHub Releases (Velopack).
## Screenshots
Captured with CaptureImage itself — yes, we eat our own dog food.
| Dashboard | Settings | About |
| Dashboard | Library | Settings |
|:-:|:-:|:-:|
| ![Dashboard — target list with Steam badge](docs/screenshots/dashboard.png) | ![Settings — hotkey recorder + format + language](docs/screenshots/settings.png) | ![About — version, licenses, legal docs](docs/screenshots/about.png) |
| ![Dashboard — armed status, per-mode hotkeys and the window list](docs/screenshots/dashboard.png) | ![Library — captures with thumbnails and actions](docs/screenshots/library.png) | ![Settings — hotkeys per capture mode](docs/screenshots/settings.png) |
| Update | Log viewer | RTL (Arabic) |
| Game profiles | About | Arabic (right to left) |
|:-:|:-:|:-:|
| ![Update — Velopack check / download / install with live log](docs/screenshots/update.png) | ![Log viewer — live Serilog ring buffer](docs/screenshots/logviewer.png) | ![RTL — dashboard mirrored for Arabic culture](docs/screenshots/rtl-dashboard.png) |
| ![Profiles — per-game overrides and auto-arm](docs/screenshots/profiles.png) | ![About — version, contact, legal documents](docs/screenshots/about.png) | ![Settings in Arabic, mirrored right to left](docs/screenshots/rtl-settings.png) |
## Requirements
- **Windows 11 22H2 or later** (build 10.0.22621+). Required by the
`Windows.Graphics.Capture` API. Older Windows 10 builds will not run.
- For the Steam badge to appear: Steam installed with at least one
library. Otherwise the badge is simply absent.
- **Windows 11 22H2 or later** (build 22621+), 64-bit.
- **.NET 10 Desktop Runtime 10.0.14 or later** — installed automatically by Setup and by the in-app
updater when it is missing or older. The portable zip needs it installed
([download](https://dotnet.microsoft.com/download/dotnet/10.0)).
## Install
Download `Setup.exe` from the
[latest GitHub Release](https://github.com/poli0981/captureimg/releases).
Velopack installs the app into `%LocalAppData%\CaptureImage\` — no admin
prompt, no registry spam, no background service.
Download **`CaptureImage-win-Setup.exe`** from the
[latest release](https://github.com/poli0981/captureimg/releases/latest). It installs per user into
`%LocalAppData%\CaptureImage` — no administrator rights, no service. Prefer no installer? Use
**`CaptureImage-win-Portable.zip`**.
### Unsigned installer — SmartScreen warning
Updating from 1.x? Use **Update** inside the app (or run the new Setup). Your settings are copied to
the new data folder and migrated; the old file is left untouched.
**Heads-up:** CaptureImage is not yet code-signed (see
[`docs/legal/DISCLAIMER.md §7`](docs/legal/DISCLAIMER.md)). On first run
Windows SmartScreen will show:
### Unsigned installer — SmartScreen
> Windows protected your PC · Unknown publisher · Don't run
To proceed, click **More info** → **Run anyway**. If you want to verify
the download is unmodified, the release page includes `SHA256SUMS.txt`:
CaptureImage is not code-signed yet, so Windows SmartScreen may say _"Windows protected your PC ·
Unknown publisher"_. Click **More info → Run anyway**. To check the download first, compare its
SHA-256 with `SHA256SUMS.txt` on the release page, or verify the build provenance:
```powershell
Get-FileHash -Algorithm SHA256 .\Setup.exe
# Compare the output with the entry in SHA256SUMS.txt on the release page.
Get-FileHash -Algorithm SHA256 .\CaptureImage-win-Setup.exe
gh attestation verify .\CaptureImage-win-Setup.exe --repo poli0981/captureimg
```
## Usage
1. Launch CaptureImage — a 960×600 window opens.
2. The **Dashboard** shows every visible top-level window on your desktop
with its icon, title, and — for Steam games — a warning badge.
3. Click the target you want to capture.
4. Click **Arm**. The global hotkey listener starts.
5. Alt-Tab to the target, press **`Ctrl+Shift+F12`**.
6. If preview is enabled (Settings → Preview before save), a dialog
shows the captured frame. Click Save or Discard.
7. The PNG (or JPEG/WebP/TIFF, your choice) lands in
`%USERPROFILE%\Pictures\CaptureImage\` with a time-stamped filename.
8. A toast appears bottom-right confirming the save.
1. Start CaptureImage. The **Dashboard** shows the hotkeys and every window you can capture.
2. Click **Arm**. While armed the three hotkeys belong to CaptureImage; click **Disarm** (or use the
tray menu) to give them back. Turn on **Arm when CaptureImage starts** in Settings to skip this
step.
3. In your game press **`Ctrl+Shift+F12`** (window), **`Ctrl+Shift+F11`** (region) or
**`Ctrl+Shift+F10`** (screen). Change them in **Settings → Hotkeys**.
4. The image is saved to `Pictures\CaptureImage` (change it in Settings, or per game with a
profile) and shows up in the **Library**.
Close-to-tray is on by default — click the X, the window hides, the
tray icon stays. Quit via the tray menu's Exit item.
Tips:
- **Lock a window** on the Dashboard to capture it even when something else is in front — or let a
game profile lock it for you.
- **Create profile** on the Dashboard turns the selected game into a profile in one click.
- Closing the window keeps CaptureImage in the tray; quit from the tray menu.
- A game that swallows registered hotkeys (rare) can still be captured with **Capture region** or
**Capture screen** from the tray menu, optionally with a countdown.
- Settings, logs and the library index are kept in `%LocalAppData%\poli0981\CaptureImage`.
**Settings → Advanced → Export diagnostics** creates a zip for bug reports (user paths removed).
## Accessibility
CaptureImage aims to be fully usable with a keyboard, a screen reader (tested with Narrator), a
contrast theme and large display scaling, and it follows Windows' animation and notification-time
settings. In the region overlay the arrow keys move the selection, Shift+arrows resize it, Tab moves
to the next monitor and Enter captures. [`ACCESSIBILITY.md`](ACCESSIBILITY.md) lists every key, what
has been tested, the known limitations, and how to
[report a barrier](https://github.com/poli0981/captureimg/issues/new?template=accessibility.yml).
## Build from source
You need the **.NET 10 SDK** (the exact version is pinned in [`global.json`](global.json)) on
Windows 11.
```bash
git clone https://github.com/poli0981/captureimg.git
cd captureimg
dotnet restore
dotnet build CaptureImage.sln -c Release
dotnet test CaptureImage.sln -c Release
dotnet run --project src/CaptureImage.App -c Release
dotnet test --solution CaptureImage.sln -c Release
dotnet run --project src/CaptureImage.App -c Release -- --data-dir ./.devdata --instance-id dev
```
The build needs:
- **.NET 9 SDK** — the repo's `global.json` pins the exact version.
- **Windows 10.0.22621 SDK** (or newer) for the WinRT projections the
capture engine uses. Install via the Visual Studio Installer
("Windows 11 SDK (10.0.22621.x)") or directly from
<https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/>.
`--data-dir` and `--instance-id` keep a development copy away from your real settings and from a
copy you have installed. `--smoke-test` opens every page and exits; `--screenshots <dir>` also saves
a PNG of each page.
## Repository layout
```
```text
src/
CaptureImage.Core Pure domain (models, abstractions, state machine,
pipeline). Portable net9.0, no Windows ties.
CaptureImage.Infrastructure Windows implementations: capture engine, process
watcher, Steam detector, hotkeys, settings, logging,
Velopack updater. net9.0-windows10.0.22621.0.
CaptureImage.ViewModels MVVM layer — reusable across UI frameworks, no
Avalonia references.
CaptureImage.UI Avalonia views, custom controls (ToastHost, etc.),
converters, resx localization.
CaptureImage.App Entry point, DI composition root, Serilog setup,
Velopack startup hook.
CaptureImage.Core Capture model, settings and migration, profiles, file naming,
HDR tone mapping, the capture coordinator. net10.0, no Windows APIs.
CaptureImage.Infrastructure Windows implementations: Windows.Graphics.Capture + Direct3D 11,
RegisterHotKey, WinEvent window watcher, displays and HDR, WIC and
SkiaSharp encoders, library, settings store, OCR, Velopack, Serilog.
CaptureImage.ViewModels View models and the 11-language string resources (no UI framework).
CaptureImage.UI WPF + WPF UI: windows, pages, region overlays, toasts, tray icon.
CaptureImage.App Entry point: Velopack hooks, single instance, logging, composition.
tests/
CaptureImage.Core.Tests xUnit — 31 tests (state machine, file name
strategy, image format).
CaptureImage.Infrastructure.Tests xUnit — 37 tests (VDF parser, Steam scanner,
settings store, WGC integration).
CaptureImage.ViewModels.Tests Placeholder project for future VM tests.
docs/
CONTRIBUTORS.md Contributor list + AI-assistance policy.
RELEASING.md How to cut a release.
legal/
DISCLAIMER.md No-warranty, capture limits, AI-dev, translations.
PRIVACY.md What's read, what's written, what's on the network.
TERMS.md Plain-language restatement of GPL-3.0 obligations.
THIRD_PARTY_NOTICES.md Full dependency list + licenses.
CaptureImage.Core.Tests Domain logic, migration, coordinator (with fakes).
CaptureImage.Infrastructure.Tests Settings store, encoders, Steam, hotkeys, capture on real hardware.
CaptureImage.ViewModels.Tests View models and translation completeness.
CaptureImage.App.UiTests End-to-end UI tests (FlaUI), run in CI.
docs/ Architecture, releasing, legal documents, screenshots.
```
## Architecture
See [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) for a one-page-per-layer
tour — layer rules, state-machine diagram, WGC capture pipeline sequence,
DI composition sketch, i18n + RTL flow, and Velopack update flow (all with
Mermaid diagrams rendered inline on GitHub).
See [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) for the design, with diagrams.
## Contributing
See [`docs/CONTRIBUTORS.md`](docs/CONTRIBUTORS.md) for the full
contribution flow. The short version:
1. Open an issue first for anything non-trivial.
2. Follow conventional-commits style (`feat(...)`, `fix(...)`, `docs(...)`).
3. Run `dotnet build` and `dotnet test` locally before opening the PR.
4. Disclose AI-assisted changes in the PR description (not required, but
helpful for reviewers).
**Translation help wanted.** The Vietnamese and Arabic language packs
are machine-assisted — native speakers who can proofread the `.resx`
files are warmly welcomed.
Bug reports, translations and pull requests are welcome — see [`CONTRIBUTING.md`](CONTRIBUTING.md).
Native speakers who can proofread a language file are especially appreciated.
## Security
Report vulnerabilities privately via
[GitHub Security Advisories](https://github.com/poli0981/captureimg/security/advisories/new).
See [`SECURITY.md`](SECURITY.md) for the full policy, scope, and
response-time expectations.
Please report vulnerabilities privately through
[GitHub Security Advisories](https://github.com/poli0981/captureimg/security/advisories/new) or
`security@poli0981.dev`. See [`SECURITY.md`](SECURITY.md).
## Contact
- General: `contact@poli0981.dev`
- Other channels: <https://poli0981.dev/links>
- Collaboration: `collab@poli0981.dev` · Press: `press@poli0981.dev`
- Help and questions: [`SUPPORT.md`](SUPPORT.md)
## AI assistance
CaptureImage was developed with significant assistance from the
**Claude Opus 4.6** large language model, used through Claude Code,
during the 2026 development cycle. Every change was reviewed, accepted,
and tested by the human maintainer before landing. Commits with
meaningful AI authorship carry a `Co-Authored-By` trailer naming the
model. Full details in [`docs/CONTRIBUTORS.md`](docs/CONTRIBUTORS.md)
and [`docs/legal/DISCLAIMER.md §3`](docs/legal/DISCLAIMER.md).
CaptureImage is developed with substantial help from an AI coding assistant — Claude (Anthropic),
used through Claude Code — for code, tests and documentation. The maintainer reviews and tests every
change before it ships; commits with meaningful AI authorship carry a `Co-Authored-By` trailer.
Details in [`docs/CONTRIBUTORS.md`](docs/CONTRIBUTORS.md).
## Support the project
CaptureImage is free and developed by one person. If it helps you:
[GitHub Sponsors](https://github.com/sponsors/poli0981) ·
[Ko-fi](https://ko-fi.com/skullmute) ·
[Buy Me a Coffee](https://buymeacoffee.com/skullmute) ·
[Patreon](https://patreon.com/skullmute). For sponsorship enquiries: `sponsor@poli0981.dev`.
## License
CaptureImage is distributed under the **GNU General Public License
v3.0 or later** (SPDX: `GPL-3.0-or-later`). See
[`LICENSE`](LICENSE) for the full text and
[`docs/legal/THIRD_PARTY_NOTICES.md`](docs/legal/THIRD_PARTY_NOTICES.md)
for attributions.
[GNU General Public License v3.0 or later](LICENSE) (SPDX: `GPL-3.0-or-later`). Third-party
components and their licenses are listed in
[`docs/legal/THIRD_PARTY_NOTICES.md`](docs/legal/THIRD_PARTY_NOTICES.md).
+53 -65
View File
@@ -1,90 +1,78 @@
# Security Policy
_Last updated: 2026-04-15_
_Last updated: 2026-10-19_
## Supported versions
CaptureImage has a single release line. Only the latest tagged release
on the `main` branch receives security updates.
Only the latest release receives security fixes.
| Version | Supported |
|---|---|
| Latest tagged release | ✅ |
| Older releases | ❌ |
| `main` branch (untagged) | ❌ |
| 2.x (latest release) | ✅ |
| 1.x and older | ❌ — update from inside the app or install the latest release |
| Unreleased `main` | ❌ |
## Reporting a vulnerability
**Please do not open a public issue for security problems.** Instead,
report privately via GitHub Security Advisories:
**Please don't open a public issue for security problems.** Report privately, either:
<https://github.com/poli0981/captureimg/security/advisories/new>
- through GitHub's private vulnerability reporting:
<https://github.com/poli0981/captureimg/security/advisories/new>, or
- by email to `security@poli0981.dev`.
Include as much of the following as you can:
Please include what you can of:
- Affected version(s) (tag name or commit hash).
- A description of the issue and the security impact (arbitrary code
execution, local privilege escalation, data exfiltration, etc.).
- Reproduction steps or a proof-of-concept.
- Your suggested fix, if any.
- Whether you want public credit in the advisory.
- the affected version (release tag or commit),
- what the issue is and its impact (code execution, privilege escalation, data leaving the
computer, …),
- steps or a proof of concept to reproduce it,
- a suggested fix, if you have one,
- whether and how you would like to be credited.
You should expect an acknowledgement within **7 days** and a triage
decision (fix plan + rough timeline) within **14 days**. CaptureImage
is a volunteer-run project — these are good-faith targets, not
guaranteed SLAs.
You can expect an acknowledgement within **7 days** and a triage decision (fix plan and rough
timeline) within **14 days**. CaptureImage is maintained by a volunteer, so these are good-faith
targets rather than guarantees.
## Scope — what counts as a security vulnerability
## In scope
- Arbitrary code execution triggered by opening a crafted settings file,
image, or update payload.
- Privilege escalation (anything that causes CaptureImage to acquire
more privileges than the user that launched it).
- Bypass of the capture-target selection (e.g. a way to make the app
capture a window the user did not select).
- Data exfiltration (anything that causes captured images, process
names, or settings to leave the user's machine without consent).
- Remote code execution via the Velopack update path (e.g. an attacker
who can MITM the GitHub Releases fetch and inject a malicious package).
- Memory safety issues in the Win32 / WinRT interop code that could be
exploited.
- Code execution triggered by a crafted settings file, image, library index or update package.
- CaptureImage gaining more privileges than the user who started it.
- Capturing a window or screen without the user's action, or captures, settings or logs leaving
the computer without consent.
- The update path: tampering with releases or the update feed, or installing a package that wasn't
published by this repository.
- The single-instance pipe or other local interfaces being usable by another user or process to
control the app.
- Memory-safety problems in the Win32 / WinRT / Direct3D interop code.
## Out of scope
## Out of scope (please file a normal bug report)
These are bugs, not security issues — please file them via a regular
bug report instead:
- A particular game can't be captured — see
[`docs/legal/DISCLAIMER.md`](docs/legal/DISCLAIMER.md), section 2.
- SmartScreen shows "unknown publisher" — the installer isn't code-signed yet; verify downloads as
described in the [README](README.md#unsigned-installer--smartscreen).
- An anti-cheat system flags the app — CaptureImage doesn't inject into or read from games, but we
can't control how anti-cheat software classifies capture tools.
- Translation or documentation issues, and feature requests.
- Accessibility barriers — please use the accessibility issue template described in
[`ACCESSIBILITY.md`](ACCESSIBILITY.md#reporting-accessibility-issues).
- A specific game cannot be captured (this is an expected limitation —
see [`docs/legal/DISCLAIMER.md §2`](docs/legal/DISCLAIMER.md)).
- The app crashes during startup on an unsupported Windows version.
- SmartScreen warns "Unknown publisher" on the installer (the binary is
intentionally not signed yet — see
[`docs/RELEASING.md`](docs/RELEASING.md) §5).
- Third-party anti-cheat software flags the app as untrusted. CaptureImage
does not inject into or read from game memory, but we cannot control
how any particular anti-cheat engine classifies capture tools.
- Missing localization, machine-translated strings, or other documentation
issues — these are tracked as normal bugs.
- Feature requests, even if they would improve user privacy.
## After you report
## What happens after you report
1. The maintainer acknowledges receipt of the advisory.
2. We reproduce the issue, identify the root cause, and draft a fix.
3. For non-trivial issues the fix lands on a private branch and is
reviewed before merging to `main`.
4. A new release is cut with the fix.
5. The advisory is made public, crediting the reporter (if they want
credit). CVE assignment may be requested for high-severity issues.
1. The report is acknowledged.
2. The issue is reproduced, the cause found and a fix prepared (privately for non-trivial issues).
3. A release with the fix is published.
4. The advisory is published, crediting you if you wish; a CVE may be requested for serious issues.
## Supply chain
CaptureImage depends on a large tree of open-source libraries (see
[`docs/legal/THIRD_PARTY_NOTICES.md`](docs/legal/THIRD_PARTY_NOTICES.md)).
Dependabot runs weekly to pick up upstream security advisories, and
pinned package versions in `Directory.Packages.props` are bumped as
needed.
- Dependencies are pinned centrally with lock files; Dependabot proposes updates after a cooldown,
and every pull request is checked for known-vulnerable packages and build tools and for
incompatibly licensed packages.
- GitHub Actions are pinned to full commit SHAs and linted with actionlint and zizmor; CodeQL,
OpenSSF Scorecard and SonarCloud review the code.
- Releases are built by GitHub Actions from signed tags and ship with SHA-256 checksums, a CycloneDX
SBOM and a build-provenance attestation (`gh attestation verify`).
If you find a vulnerability in one of CaptureImage's dependencies,
please report it upstream first. We will pick it up once the upstream
fix is released.
Vulnerabilities in a dependency should be reported upstream first; we will pick up the fixed
version once it is released.
+28
View File
@@ -0,0 +1,28 @@
# Getting help
CaptureImage is maintained by one volunteer. Here is where to go:
| You want to… | Go to |
|---|---|
| Ask a question or share an idea | [GitHub Discussions](https://github.com/poli0981/captureimg/discussions) |
| Report a bug | [Bug report](https://github.com/poli0981/captureimg/issues/new?template=bug_report.yml) — or **About → Report a bug** in the app |
| Suggest a feature | [Feature request](https://github.com/poli0981/captureimg/issues/new?template=feature_request.yml) |
| Report an accessibility barrier | [Accessibility barrier](https://github.com/poli0981/captureimg/issues/new?template=accessibility.yml) or `contact@poli0981.dev` — see [`ACCESSIBILITY.md`](ACCESSIBILITY.md) |
| Report a security problem | Privately — see [`SECURITY.md`](SECURITY.md) (`security@poli0981.dev`) |
| Ask about privacy | `privacy@poli0981.dev` — see [`docs/legal/PRIVACY.md`](docs/legal/PRIVACY.md) |
| Raise a game-compatibility or anti-cheat concern (publishers, vendors) | `games@poli0981.dev` |
| Copyright, DMCA or takedown requests | `dmca@poli0981.dev` · `takedown@poli0981.dev` |
| Sponsor the project | `sponsor@poli0981.dev` or the links in the [README](README.md#support-the-project) |
| Anything else | `contact@poli0981.dev` · <https://poli0981.dev/links> |
## Before reporting a bug
1. Update to the [latest release](https://github.com/poli0981/captureimg/releases/latest) — it may
already be fixed.
2. In the app, open **Settings → Advanced**, set the log level to **Debug**, reproduce the problem,
then use **Export diagnostics**. The zip contains logs, settings and system information with your
user paths removed; attach it to the issue if you're comfortable with that.
3. For capture problems, say which game, whether it runs windowed, borderless or full screen, and
whether you use HDR or several monitors.
There is no paid support or guaranteed response time, but every report is read.
+183 -323
View File
@@ -1,349 +1,209 @@
# Architecture
This document is a one-page-per-layer tour of CaptureImage for people who
want to contribute, audit, or port the code. It is **not** the design
intent record — that lives in the per-milestone plan files under
`.claude/plans/`. This is the shape of the code as it stands on `main`.
CaptureImage 2.x is a .NET 10 WPF tray app. This page describes how it is put together; the
[README](../README.md) covers what it does.
Diagrams are Mermaid so GitHub renders them inline. Source paths are
clickable; line numbers drift, so I link to files rather than lines.
## 1. Layer rules
Five projects, four rules:
- **`CaptureImage.Core`** (net9.0) — pure domain. Models, abstractions,
state machine, pipeline. No platform references. **Depends on nothing.**
- **`CaptureImage.Infrastructure`** (net9.0-windows10.0.22621.0) — every
Windows-specific implementation: WGC capture, D3D11 interop, WMI
process watch, `RegisterHotKey` sniff, Velopack updater, Serilog sinks,
JSON settings. **Depends on Core.**
- **`CaptureImage.ViewModels`** (net9.0) — MVVM layer using
CommunityToolkit.Mvvm source generators. Platform-agnostic — these
types exist so the UI logic is testable without Avalonia.
**Depends on Core only.**
- **`CaptureImage.UI`** (net9.0) — Avalonia views, custom controls,
converters, resx localization. **Depends on Core + ViewModels.**
- **`CaptureImage.App`** (net9.0-windows10.0.22621.0) — the composition
root. `Program.cs` + [`CompositionRoot.cs`](../src/CaptureImage.App/CompositionRoot.cs).
Single point of DI wiring. **Depends on all four projects.**
## Layers
```mermaid
graph LR
App[CaptureImage.App<br/>net9.0-windows]
UI[CaptureImage.UI<br/>net9.0 · Avalonia]
VM[CaptureImage.ViewModels<br/>net9.0 · MVVM]
Infra[CaptureImage.Infrastructure<br/>net9.0-windows · P/Invoke]
Core[CaptureImage.Core<br/>net9.0 · pure domain]
App --> UI
App --> Infra
App --> VM
App --> Core
UI --> VM
UI --> Core
VM --> Core
Infra --> Core
flowchart TD
App["CaptureImage.App<br/>entry point · composition root"]
UI["CaptureImage.UI<br/>WPF + WPF UI windows, pages, tray"]
VM["CaptureImage.ViewModels<br/>view models · string resources"]
Core["CaptureImage.Core<br/>models · abstractions · coordinator"]
Infra["CaptureImage.Infrastructure<br/>Win32 · WinRT · Direct3D · WIC · Serilog · Velopack"]
App --> UI
App --> Infra
UI --> VM
VM --> Core
Infra --> Core
```
**Why this shape:**
| Project | Target | Rules |
|---|---|---|
| Core | `net10.0` | No Windows APIs, no UI types. Everything Windows-specific is an interface here. |
| Infrastructure | `net10.0-windows10.0.22621.0` | Implements Core interfaces. P/Invoke through CsWin32 (`NativeMethods.txt`). |
| ViewModels | `net10.0` | CommunityToolkit.Mvvm. Talks only to Core abstractions; no WPF, no `Process.Start`, no file I/O. |
| UI | `net10.0-windows10.0.22621.0` | WPF + WPF UI. Implements the interactive abstractions (toasts, overlays, dialogs, clipboard). |
| App | `net10.0-windows10.0.22621.0` | `Main`, Velopack hooks, single instance, logging, dependency injection. |
- `Core` stays portable so the domain logic is trivially testable. The
Core test project runs on plain `net9.0`, no Windows 11 SDK needed.
- `ViewModels` stays off `net9.0-windows` so Avalonia's designer +
hot-reload tooling work without dragging in WinRT projections.
- `Infrastructure` is the only project that touches `Windows.*`. If a
future milestone ports to another desktop platform, that's the project
that gets replaced.
All services are singletons registered in `CaptureImage.App/Composition/ServiceRegistration.cs`
(Core + Infrastructure) and `CaptureImage.UI/UiServiceCollectionExtensions.cs` (UI, view models,
pages). The container validates the whole graph when it is built.
## 2. Capture state machine
## Startup and shutdown
Every screenshot flows through a single
[`CaptureStateMachine`](../src/CaptureImage.Core/StateMachine/CaptureStateMachine.cs)
backed by the `Stateless` library. `DashboardViewModel` fires triggers;
the machine decides whether the preview step is visited based on a
live-checked `Func<bool> previewEnabled`.
1. `VelopackApp.Build().Run()` — install / update / uninstall hooks run before anything else; the
uninstall hook removes the "Start with Windows" entry.
2. Command line: `--data-dir`, `--instance-id`, `--minimized`, `--smoke-test`, `--screenshots`.
3. Single instance per Windows session, user and instance id: a named mutex plus a
`CurrentUserOnly` pipe. A second launch asks the first copy to show its window and exits.
4. Serilog: an async rolling file in `<data>\logs` and an in-memory ring buffer for the Logs page;
user-profile paths are replaced by `%USERPROFILE%`.
5. Settings are loaded (and migrated), the host starts the WinEvent window watcher, and the WPF
`App` applies language and theme, creates the main window and the tray icon, and arms the
hotkeys if the user asked for that.
6. On exit the tray icon is removed, the hotkeys are released, the host stops, pending settings are
written and the log is flushed — including when an update restarts the app.
## Data
Everything the app writes lives in `%LocalAppData%\poli0981\CaptureImage` (or `--data-dir`):
| Path | Content |
|---|---|
| `settings.json` | Settings, schema version 3. Written atomically (temp file + replace); damaged files and files from a newer version are backed up before defaults are used; unknown fields are kept. |
| `library.json` | Index of saved captures (newest first, at most 2,000). |
| `thumbnails\` | JPEG thumbnails for the Library, named by a hash of the image path. |
| `logs\` | `captureimage-<date>.log`, 14 days, 10 MB per file. |
The 1.x settings file (`%LocalAppData%\CaptureImage\settings.json`, inside the Velopack install
folder) is copied on first start and migrated: the old single hotkey goes to the capture mode that
was in use, the other modes get their defaults, and options that no longer exist are dropped.
## Capturing
```mermaid
sequenceDiagram
participant Hotkey as Win32HotkeyService
participant Coord as CaptureCoordinator
participant Engine as WgcCaptureEngine
participant UI as Overlays / preview
participant Writer as CaptureFileWriter
Hotkey->>Coord: Triggered(mode)
Coord->>Coord: resolve target and profile, countdown
Coord->>Engine: CaptureAsync(window or monitor)
Engine-->>Coord: frame (BGRA8 or FP16 HDR)
opt Region
Coord->>UI: SelectAsync(frozen monitors)
UI-->>Coord: rectangle or cancel
end
opt Preview before save
Coord->>UI: ShowAsync(frame)
UI-->>Coord: save or discard
end
Coord->>Writer: SaveAsync(frame, HDR original)
Writer-->>Coord: CaptureRecord
Coord->>Coord: library, clipboard, sound, toast, pin
```
### Hotkeys and arming
- `Win32HotkeyService` registers one hotkey per capture mode with `RegisterHotKey` (window handle
`NULL`, `MOD_NOREPEAT`) on its own message-loop thread. Keys are registered **only while armed**,
because a registered combination never reaches any other application.
- Registration results (registered, conflict, invalid) are shown on the Dashboard and in Settings.
- While the hotkey recorder in Settings is listening, the coordinator suspends the hotkeys so the
current combination can be pressed again.
- During region selection the overlay's keys (`RegionKeyboard` in Core: Esc, Enter, Tab,
Shift+Tab, and the arrow keys with Shift / Ctrl) are registered temporarily, so they work even
when a full-screen game keeps the keyboard focus. The arrow keys auto-repeat; temporary-key
callbacks run off the hotkey thread one at a time, in the order the keys were pressed.
### Coordinator
`CaptureCoordinator` (Core) runs one capture at a time; a second request while one is running is
ignored. Every request ends in exactly one outcome — saved, copied, cancelled, discarded, busy or
failed — and failures are always reported with a localized message.
```mermaid
stateDiagram-v2
[*] --> Idle
Idle --> TargetsSelected: SelectTargets
TargetsSelected --> Idle: ClearTargets
TargetsSelected --> Armed: Arm
Armed --> TargetsSelected: Disarm
Armed --> Idle: ClearTargets
Armed --> Capturing: HotkeyPressed
Capturing --> Previewing: FrameCaptured\n(previewEnabled=true)
Capturing --> Saving: FrameCaptured\n(previewEnabled=false)
Capturing --> Failed: ErrorOccurred
Previewing --> Saving: PreviewAccepted
Previewing --> Armed: PreviewRejected
Saving --> Complete: Saved
Saving --> Failed: ErrorOccurred
Complete --> Armed: Reset
Complete --> Idle: ClearTargets
Failed --> Armed: Reset
Failed --> Idle: ClearTargets
[*] --> Idle
Idle --> Countdown: countdown set
Idle --> Capturing
Countdown --> Capturing
Capturing --> Selecting: region
Selecting --> Capturing: area chosen
Capturing --> Previewing: preview on
Capturing --> Saving
Previewing --> Saving: save
Countdown --> Idle: cancel
Selecting --> Idle: Esc / right click
Previewing --> Idle: discard
Saving --> Idle
```
**Rules of the road:**
- **Window**: the locked window, otherwise the foreground window. A game profile with auto-arm arms
the hotkeys (and locks its window) when the game comes to the front.
- **Screen**: the monitor under the mouse pointer.
- **Region**: every monitor is captured first; the overlays show those frozen frames, so the result
is exactly what was on screen when the key was pressed.
- Transitions are driven by explicit triggers, never by timers. The
viewmodel is the only thing allowed to call `Fire`.
- `Capturing → Saving/Previewing` uses `PermitDynamic` so the preview
toggle is consulted at transition time. Changing the toggle while
armed affects the *next* capture, not any in-flight one.
- `Failed` and `Complete` both route back to `Armed` on `Reset` so the
user can fire another shot without re-selecting a target.
- `StateChanged` fires on whatever thread drove the trigger.
`DashboardViewModel` marshals to the UI thread before touching
bindings.
### Windows.Graphics.Capture
Tests cover every legal transition and assert illegal ones throw —
[`CaptureStateMachineTests`](../tests/CaptureImage.Core.Tests/StateMachine/CaptureStateMachineTests.cs).
- One Direct3D 11 device (hardware, WARP as fallback) is shared by all captures and recreated once
when the driver reports a lost device.
- Frames are read back through a staging texture; window captures are cropped to the client area
unless the window frame is wanted, and alpha is forced opaque.
- On an HDR display the frame pool uses `R16G16B16A16Float` (scRGB). `HdrToneMapper` maps it to
sRGB using the display's SDR white level (knee at 0.8 of white, exponential shoulder), and the
untouched HDR frame can be saved as JPEG XR.
- Monitors, DPI and HDR state come from `EnumDisplayMonitors`, DXGI (`IDXGIOutput6`) and
`DisplayConfigGetDeviceInfo`.
## 3. WGC capture pipeline
### Saving
The primary engine is
[`WindowsGraphicsCaptureEngine`](../src/CaptureImage.Infrastructure/Capture/WindowsGraphicsCaptureEngine.cs),
an on-demand single-frame pipeline. It uses the same
`Windows.Graphics.Capture` API that OBS Studio uses for Game Capture.
Hardware-accelerated, works with DX11/DX12/Vulkan windowed and
borderless-fullscreen titles.
- PNG (zlib level by "PNG compression"), JPEG and WebP are encoded with SkiaSharp; TIFF and JPEG XR
with Windows Imaging Component.
- File names come from the template (`FileNameStrategy`): invalid, control and invisible
formatting characters are replaced, reserved device names are avoided, names are capped at 120
characters.
- The image is written to a temporary file and moved into place **without overwriting**; on a name
collision the next counter is tried.
## User interface
- `MainWindow` is a WPF UI `FluentWindow` with a `NavigationView`; pages come from the container
and only the visible page refreshes in the background (window list, logs, library).
- Strings are bound with `{loc:Tr Key}`, a live binding to the resource service; switching language
updates every window in place, including right-to-left layout for Arabic. Keys and placeholders
are checked against all 11 languages by tests.
- Notifications use a snackbar while the main window is in front, otherwise a small topmost window
that is never activated and is excluded from screen capture (`WDA_EXCLUDEFROMCAPTURE`) — the same
applies to region overlays, the preview and pinned thumbnails.
- Region overlays are placed over each monitor in physical pixels and show the frozen frame at the
monitor's DPI, so one image pixel is one screen pixel; the selection is converted back to physical
pixels.
- The tray icon (H.NotifyIcon) shows a red dot while armed and is re-added after Explorer restarts;
Enter and Shift+F10 on it (after Win+B) show the window and open the menu.
- Accessibility (see [`ACCESSIBILITY.md`](../ACCESSIBILITY.md)): pages expose themselves through
`PageAutomationPeer`, and every control has an automation id and name. Status text uses
`LiveRegion` (`CaptureImage.UI/Accessibility`) to raise `LiveRegionChanged`, which WPF never
does on its own. Notifications are read through `Announcer` (UI Automation notification events)
and stay up at least as long as Windows' notification-time setting. Page transitions follow
`SystemParameters.ClientAreaAnimation`, and region overlays use system colours in contrast
themes.
- The main window hides to the tray while it idles and the process then runs in Windows' efficiency
mode (EcoQoS), lifted during captures.
## Updates
```mermaid
sequenceDiagram
participant VM as DashboardViewModel
participant Eng as WindowsGraphicsCaptureEngine
participant Interop as CaptureItemInterop
participant D3D as D3D11DeviceManager
participant WGC as Windows.Graphics.Capture
participant Tex as Staging Texture
VM->>Eng: CaptureAsync(target, ct)
Eng->>Interop: CreateForWindow(HWND)
Interop-->>Eng: GraphicsCaptureItem
Eng->>D3D: Get()
D3D-->>Eng: (ID3D11Device, context)
Eng->>WGC: CreateFreeThreaded(framePool)
Eng->>WGC: CreateCaptureSession(item)
Note over Eng,WGC: IsBorderRequired=false<br/>IsCursorCaptureEnabled=false
Eng->>WGC: StartCapture()
WGC-->>Eng: FrameArrived (async)
Eng->>Tex: CreateTexture2D(STAGING + CPU_READ)
Eng->>Tex: CopyResource(gpu → staging)
Eng->>Tex: Map(READ)
Eng-->>VM: CapturedFrame(w, h, stride, bytes)
Note over Eng: Dispose session<br/>Dispose framePool<br/>Dispose staging + gpu texture
participant User
participant App as CaptureImage
participant GH as GitHub Releases
participant Up as Velopack Update.exe
User->>App: Update → Check
App->>GH: releases.win.json
GH-->>App: newer version + notes
User->>App: Download, then Install and restart
App->>Up: WaitExitThenApplyUpdates
App->>App: normal shutdown (settings, tray, logs)
Up->>Up: install runtime if missing, apply package
Up->>App: restart new version
```
**Invariants:**
The package id (`CaptureImage`), executable name (`CaptureImage.App.exe`), channel (`win`) and
shortcuts never change, so installed copies keep updating. See [RELEASING.md](RELEASING.md).
- Exactly one frame per call. The framepool is `numberOfBuffers: 1` and
the session is disposed as soon as the first frame arrives.
- 2-second `FrameTimeout`. Games that never render (minimized, stalled)
surface as `CaptureError.NoFrameArrived`.
- BGRA8 only — pixel format is pinned so the encoder layer doesn't need
a format negotiation step. The Skia/ImageSharp wrappers accept BGRA
directly.
- Win11 22H2+ only. That's the minimum OS for the
`IsBorderRequired = false` flag to actually hide the yellow capture
frame. Older builds still work but show the frame.
## Quality gates
**Fallback path:** if WGC itself fails (legacy GDI-only apps, some
emulators), the orchestrator retries with
[`PrintWindowFallback`](../src/CaptureImage.Infrastructure/Capture/PrintWindowFallback.cs)
which calls `PrintWindow(hwnd, hdc, PW_RENDERFULLCONTENT)`. Slower,
subject to HDCP, but wide compatibility.
## 4. DI composition
[`CompositionRoot.BuildServices`](../src/CaptureImage.App/CompositionRoot.cs)
is the only place DI registrations live. No scanning, no convention, no
assembly-level attributes — everything the runtime sees is explicit in
one file.
```mermaid
graph LR
subgraph "Cross-cutting"
Log[ILogger*]
FS[IFileSystem]
Dispatcher[IUIThreadDispatcher]
Loc[ILocalizationService]
end
subgraph "Domain services"
Settings[ISettingsStore]
Steam[ISteamDetector]
Procs[IProcessWatcher<br/>IProcessDetector]
Cap[ICaptureEngine]
Encoders[IImageEncoder × 2]
Hotkey[IHotkeyService<br/>IHotkeyConflictSniffer]
Update[IUpdateService]
Orch[CaptureOrchestrator]
end
subgraph "UI services"
Toast[IToastService]
Preview[IPreviewPresenter]
Tray[ITrayIconHost]
Nav[INavigationService]
end
subgraph "ViewModels (singletons)"
Main[MainWindowViewModel]
Dash[DashboardViewModel]
Set[SettingsViewModel]
Hk[HotkeyBindingViewModel]
About[AboutViewModel]
Upd[UpdateViewModel]
LogVM[LogViewerViewModel]
end
Dash --> Settings
Dash --> Procs
Dash --> Orch
Dash --> Hotkey
Orch --> Cap
Orch --> Encoders
Orch --> FS
Set --> Settings
Set --> Loc
Set --> Hk
Hk --> Settings
Hk --> Hotkey
```
**Lifetimes:** every service and every viewmodel is a singleton. There
is no request scope — the app is one long-running desktop process with
a single window. `validateScopes: true` is on so DI misuse fails loudly
at startup.
**Startup order:**
1. `VelopackApp.Build().Run()` — must be the first line of `Main` so
Velopack can handle `--squirrel-install`, `--squirrel-firstrun`, etc.
before Avalonia spins up.
2. Serilog configured (file sink + in-memory ring buffer for the log
drawer).
3. `BuildServices(inMemorySink)` — container built.
4. `ISettingsStore.LoadAsync()` — settings file read before any VM that
depends on them is resolved.
5. Avalonia `BuildAvaloniaApp().StartWithClassicDesktopLifetime(args)`.
## 5. i18n + RTL
Resources live as three sibling `.resx` files under
[`src/CaptureImage.UI/Resources/Strings/`](../src/CaptureImage.UI/Resources/Strings):
`Strings.resx` (en-US, neutral), `Strings.vi.resx`, `Strings.ar.resx`.
MSBuild compiles them to satellite assemblies at build time. No
Designer-generated wrapper — we use `ResourceManager` directly.
```mermaid
sequenceDiagram
participant User
participant Settings as SettingsViewModel
participant Loc as ResxLocalizationService
participant RM as ResourceManager
participant XAML as Avalonia bindings
User->>Settings: Pick "العربية" in Language dropdown
Settings->>Loc: SetCulture(ar-SA)
Loc->>Loc: CurrentCulture = ar-SA<br/>CurrentFlowDirection = RightToLeft
Loc-->>XAML: PropertyChanged("Item[]")
XAML->>Loc: this["Settings_Hotkey"]
Loc->>RM: GetString(key, ar-SA)
RM-->>Loc: "مفتاح اختصار الالتقاط"
Loc-->>XAML: string
XAML-->>User: window mirrors + text flips
```
**Key properties:**
- `PropertyChanged("Item[]")` is the magic indexer-binding refresh
signal for Avalonia. Firing it once after a culture change refreshes
every `{Binding Localization[...]}` in the tree.
- `MainWindow.axaml` binds `FlowDirection` to
`Localization.CurrentFlowDirection`. Arabic, Hebrew, Farsi, Urdu —
any two-letter language code in the RTL set — mirrors the whole tree.
- No app restart required. Every VM that stores localized text holds
only the key, looks up via the indexer, and refreshes on the
`PropertyChanged` broadcast.
- Translations for VI and AR are machine-assisted today — see
[`docs/legal/DISCLAIMER.md §4`](legal/DISCLAIMER.md). Native-speaker
review is the next milestone's ask.
## 6. Update flow (Velopack)
[`VelopackUpdateService`](../src/CaptureImage.Infrastructure/Update/VelopackUpdateService.cs)
wraps Velopack's `UpdateManager` pointed at the GitHub Releases source.
Everything is explicit — no background timer, no silent upgrades. The
user clicks **Check for updates**, optionally **Download**, optionally
**Install and restart**.
```mermaid
sequenceDiagram
participant Main as Program.Main
participant Velo as VelopackApp
participant User
participant UI as UpdateView
participant VM as UpdateViewModel
participant Svc as VelopackUpdateService
participant GH as GitHub Releases
participant Mgr as UpdateManager
Main->>Velo: Build().Run(args)
Note over Velo: Handles --squirrel-install,<br/>--squirrel-firstrun etc.<br/>then returns to caller
Main->>Main: BuildAvaloniaApp()
User->>UI: Click "Check for updates"
UI->>VM: CheckCommand
VM->>Svc: CheckAsync()
Svc->>Mgr: CheckForUpdatesAsync()
Mgr->>GH: GET /releases/latest
GH-->>Mgr: UpdateInfo (or null)
Mgr-->>Svc: UpdateInfo
Svc-->>VM: UpdateCheckResult
VM-->>UI: Status + version + release notes
User->>UI: Click "Download"
UI->>VM: DownloadCommand
VM->>Svc: DownloadAsync(progress)
Svc->>Mgr: DownloadUpdatesAsync(IProgress<int>)
Mgr->>GH: GET /releases/.../CaptureImage-full.nupkg
GH-->>Mgr: stream
Mgr-->>Svc: done
Svc-->>VM: Status=ReadyToInstall
User->>UI: Click "Install & restart"
UI->>VM: InstallCommand
VM->>Svc: ApplyAndRestart()
Svc->>Mgr: ApplyUpdatesAndRestart()
Note over Mgr: Velopack spawns Update.exe,<br/>kills current process,<br/>swaps files, relaunches
```
**Development-mode caveat:** when the app is launched via
`dotnet run` (not from a Velopack-installed location), `UpdateManager`
reports `IsInstalled = false` and the service returns
`UpdateStatus.Unavailable`. The update tab still renders, it just tells
you updates are disabled and why. Release builds installed via `Setup.exe`
have `IsInstalled = true` and the full flow works.
**Unsigned installer today.** Velopack can sign the installer if given a
cert; CaptureImage doesn't have one yet (SignPath application was
declined for v1.0). Users see Windows SmartScreen's "Unknown publisher"
warning on first run. Integrity is still verifiable via the
`SHA256SUMS.txt` published alongside every release.
---
## See also
- [`docs/RELEASING.md`](RELEASING.md) — how releases are cut and
published.
- [`docs/CONTRIBUTORS.md`](CONTRIBUTORS.md) — contribution flow, AI
assistance policy, translation hand-off.
- [`docs/legal/`](legal) — disclaimers, privacy, third-party notices.
- The `Co-Authored-By` commit trailers naming Claude Opus 4.7 — see
the git log for per-milestone design notes that influenced this
architecture.
Every pull request runs: build with warnings as errors and the recommended .NET analyzers; unit,
view-model and integration tests with coverage; formatting and SPDX headers; JetBrains InspectCode
(dead and redundant code); vulnerable dependencies and .NET tools, and incompatibly licensed
dependencies; a publish of the app followed by a smoke test that opens every page; end-to-end UI
tests (FlaUI); the SonarQube Cloud quality gate (CI-based analysis with test coverage: no new
issues, at least 80 % coverage on new code outside the WPF shell, the host and the CI scripts); PR
title; dependency review; workflow lint (actionlint, zizmor); Markdown lint and link check. CodeQL
and OpenSSF Scorecard run as well.
+32 -64
View File
@@ -1,86 +1,54 @@
# Contributors
_Last updated: 2026-04-15_
_Last updated: 2026-10-19_
## Maintainer
- **poli0981** — project owner, design decisions, code review, release
management. All commits are signed off by the maintainer before landing
in the default branch.
- **poli0981** — project owner: design decisions, code review, releases. Every change is reviewed and
accepted by the maintainer before it lands on `main`.
## AI assistance
Development of CaptureImage was carried out with significant assistance
from the **Claude Opus 4.6** large language model (Anthropic), used
through Claude Code, during the 2026 development cycle. This assistance
was pair-programming-style: the maintainer drove requirements, chose
trade-offs, and reviewed every change, while the model generated code,
unit tests, XAML layouts, P/Invoke signatures, commit messages, and
documentation (including the file you are reading now).
CaptureImage is developed with substantial help from an AI coding assistant — **Claude
(Anthropic), used through Claude Code**. The work is pair-programming style: the maintainer sets the
requirements, chooses the trade-offs and reviews every change, while the assistant drafts code,
tests, Windows interop, user-interface layouts, translations, commit messages and documentation
(including this file).
Commits where AI authored significant portions of the diff carry the
trailer:
Commits where the assistant wrote a significant part of the change carry a trailer such as:
```
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
```text
Co-Authored-By: Claude <model name> <noreply@anthropic.com>
```
This follows the git convention documented at
<https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors>.
The co-author trailer is an attribution mechanism; it does not give the
model any copyright over the output — per Anthropic's usage terms and
current US Copyright Office guidance, AI-generated material is not
copyrightable by the model itself. The resulting project is licensed
under **GPL-3.0-or-later** by the human maintainer and contributors.
If this distinction matters for your use case (for example, your
organization prohibits shipping AI-assisted code in production), please
audit the git history. Every commit's full diff is available via
`git show` and the co-author trailer is visible in the commit message.
following GitHub's
[multiple-authors convention](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors).
The trailer is attribution only; the project is licensed under **GPL-3.0-or-later** by its human
maintainer and contributors. If AI-assisted code matters for your use (for example, a policy against
shipping it), the full history is available with `git log` and `git show`.
## How to contribute
Contributions are welcome. The general flow is:
1. Open an issue describing the bug or feature before starting work on
anything non-trivial. A short discussion avoids duplicated effort.
2. Fork the repository and create a feature branch from `main`.
3. Keep commits small and focused. Use conventional-commits style:
`feat(m5): …`, `fix(capture): …`, `docs(legal): …`, etc.
4. Run `dotnet build CaptureImage.sln` and `dotnet test CaptureImage.sln`
locally. Every PR must ship with the full suite passing.
5. For UI changes, include before/after screenshots or a short video.
6. If your change was AI-assisted, say so in the PR description — it
helps reviewers focus their attention.
7. Open a pull request.
By submitting a contribution, you agree that it can be distributed under
GPL-3.0-or-later as part of CaptureImage (see [TERMS.md](legal/TERMS.md)
§5).
See [`CONTRIBUTING.md`](../CONTRIBUTING.md) for the development setup, the required checks and the
conventions. By contributing you agree that your work is distributed under GPL-3.0-or-later as part
of CaptureImage (see [`legal/TERMS.md`](legal/TERMS.md), section 5).
## Translation help wanted
The Vietnamese (`vi-VN`) and Arabic (`ar-SA`) language packs were
produced with machine assistance. Native speakers who can review the
shipped strings are warmly invited to open a PR against
`src/CaptureImage.UI/Resources/Strings/Strings.*.resx`. Small
improvements are welcome — please submit the smallest possible diff and
explain the reasoning for each string change in the PR body.
All 11 languages were produced or completed with AI assistance. Native speakers who can review the
strings in `src/CaptureImage.ViewModels/Resources/Strings/Strings.*.resx` are warmly invited to
open a pull request — small, focused changes with a short reason per string are easiest to review.
## Acknowledgements
CaptureImage stands on the shoulders of several open-source projects.
See [`THIRD_PARTY_NOTICES.md`](legal/THIRD_PARTY_NOTICES.md) for the full
list with licenses. Special thanks to:
CaptureImage is built on open-source work; the full list with licenses is in
[`legal/THIRD_PARTY_NOTICES.md`](legal/THIRD_PARTY_NOTICES.md). Special thanks to:
- The **Avalonia UI** team for a modern, cross-platform XAML framework
that also happens to run beautifully on Windows.
- The **OBS Studio** team for blazing the trail on Windows Graphics
Capture integration — their public source code was a useful reference
while wiring up `IGraphicsCaptureItemInterop`.
- The **Velopack** team for making installer + updater flow for desktop
.NET apps genuinely easy.
- The **Vortice.Windows** team for high-quality, actively-maintained
Direct3D/DXGI bindings.
- The **SharpHook** team for cross-platform global keyboard hooks that
"just work" on .NET.
- **WPF UI** (lepo.co) for the Fluent controls the 2.x interface is built with.
- **H.NotifyIcon** for the tray icon.
- **OBS Studio**, whose public Windows Graphics Capture code was a useful reference.
- **Velopack** for the installer and updater.
- **Vortice.Windows** for Direct3D, DXGI and WIC bindings, and **SkiaSharp** for image encoding.
- **Serilog** and **CommunityToolkit.Mvvm**.
- **Avalonia UI** (versions 1.0–1.2) and **WinUI 3 / Windows App SDK** (1.3–1.5), the frameworks
earlier versions of CaptureImage were built on.
+70 -154
View File
@@ -1,176 +1,92 @@
# Releasing CaptureImage
_Last updated: 2026-04-15_
_Last updated: 2026-10-19 (CaptureImage 2.0)_
This document describes how to cut a new release of CaptureImage end to
end: tagging, CI/CD, verifying the installer, and what to tell users
about the unsigned-binary warning.
Releases are built by [`.github/workflows/release.yml`](../.github/workflows/release.yml) from a
signed tag and published as a **draft** first. Nothing reaches users until a maintainer publishes
the draft.
## 1. Prerequisites
## 1. Prepare the release pull request
You need:
1. Make sure `main` is green.
2. On a branch (e.g. `chore/release-2.1.0`):
- set `<Version>` in [`Directory.Build.props`](../Directory.Build.props) — the single source of
the version; the release workflow refuses a tag that doesn't match it;
- rename `## [Unreleased]` in [`CHANGELOG.md`](../CHANGELOG.md) to `## [2.1.0] - YYYY-MM-DD` and
add a new empty `## [Unreleased]` above it. The workflow uses this section as the release notes
shown in the app and on GitHub.
3. Open the pull request, let the required checks pass, squash-merge.
- Push access to <https://github.com/poli0981/captureimg>.
- The working tree on `main` is clean and all tests pass locally:
```powershell
dotnet build CaptureImage.sln -c Release /p:TreatWarningsAsErrors=true
dotnet test CaptureImage.sln -c Release
```
- `CHANGELOG.md` has an entry for the release under `[Unreleased]`.
Move the entries into a new `## [1.0.0] - 2026-MM-DD` section before
tagging — the CI release workflow does not rewrite the file.
## 2. Tag
## 2. Cutting a release
Tags must be signed (the `main` branch and `v*` tags are protected by rulesets; tags can't be moved
or deleted once pushed).
Releases are cut by pushing a tag. The tag triggers
[`.github/workflows/release.yml`](../.github/workflows/release.yml) which
builds, tests, publishes a single-file self-contained Win64 build, wraps
it with Velopack, computes SHA256 checksums, and uploads everything as a
GitHub Release.
```powershell
# Update the version number in the source metadata.
# (Directory.Build.props already sets <Version> to the target release.)
# Commit the CHANGELOG bump.
git add CHANGELOG.md
git commit -m "chore(release): CaptureImage v1.0.0"
# Create and push the tag. Use an annotated tag with a release message.
git tag -a v1.0.0 -m "CaptureImage v1.0.0"
git push origin main
git push origin v1.0.0
```bash
git switch main
git pull --ff-only
git tag -s v2.1.0 -m "CaptureImage v2.1.0"
git push origin v2.1.0
```
Within a minute or two, GitHub Actions should show a `Release` workflow
running. Total build time is about 8–12 minutes on a `windows-latest`
runner.
The workflow then:
When the workflow finishes:
1. checks the tag is SemVer and equals `<Version>`;
2. restores with lock files, builds, runs all tests;
3. publishes the app (framework-dependent, `win-x64`) and runs it with `--smoke-test`;
4. packs it with Velopack (`vpk`, same version as the library): package id `CaptureImage`, main
executable `CaptureImage.App.exe`, channel `win`, shortcuts on the desktop and Start menu, the
.NET 10 Desktop Runtime (minimum patch from `RUNTIME`) as a prerequisite, full packages only;
5. adds a CycloneDX SBOM and `SHA256SUMS.txt`, attests build provenance, and creates or updates a
**draft** release with all assets.
- A new GitHub Release appears under
<https://github.com/poli0981/captureimg/releases>.
- It contains `Setup.exe`, the Velopack `.nupkg`, the `RELEASES`
manifest, and `SHA256SUMS.txt`.
- A workflow artifact bundle is also uploaded as a backup.
> Never change the package id, executable name, channel or shortcut set — installed copies would
> stop updating or end up with duplicate shortcuts.
## 3. If the workflow fails mid-run
## 3. Verify the draft
Do NOT manually create a release with the broken artifacts. Instead:
- [ ] Assets: `CaptureImage-win-Setup.exe`, `CaptureImage-win-Portable.zip`,
`CaptureImage-<version>-full.nupkg`, `releases.win.json`, `assets.win.json`, `RELEASES`,
`SHA256SUMS.txt`, `CaptureImage-<version>-sbom.cdx.json`.
- [ ] `gh attestation verify CaptureImage-win-Setup.exe --repo poli0981/captureimg` succeeds.
- [ ] On a clean machine or Windows Sandbox: Setup installs (and installs the .NET runtime if
missing), the app starts, About shows the new version.
- [ ] Update path: install the previous release, then apply the new package
(`Update.exe apply --package <full.nupkg>` in the install folder, or the in-app updater once
published) — settings are kept and migrated.
- [ ] The portable zip starts with `--smoke-test --data-dir <temp>` and exits 0.
- [ ] If the release changes the user interface: a quick pass with the keyboard alone and with
Narrator over the changed screens (see [`ACCESSIBILITY.md`](../ACCESSIBILITY.md)); add the
result to its testing record.
1. Investigate the failure in the Actions tab.
2. Delete the broken tag both locally and on GitHub:
```powershell
git tag -d v1.0.0
git push --delete origin v1.0.0
```
3. Fix the underlying problem on `main`.
4. Re-tag and re-push.
## 4. Publish
This keeps the GitHub Releases page as a trustworthy source of truth —
every release there was produced by a clean, green workflow run.
## 4. Post-release checklist
After the release publishes, verify by hand:
- [ ] `Setup.exe` downloads from the Release page.
- [ ] `Setup.exe` installs to `%LocalAppData%\CaptureImage\app-<version>\`
(Velopack default).
- [ ] First launch opens the main window without crashing.
- [ ] `About` tab shows the new version number.
- [ ] The `Update` tab can hit GitHub and reports the installed version
matches the latest release.
- [ ] `%LocalAppData%\CaptureImage\logs\captureimg-<today>.log` contains
`"Velopack update service initialized: installed=True"`.
Also update `docs/CONTRIBUTORS.md` if new contributors landed during the
cycle, and post a short release note in GitHub Discussions if the user
community wants one.
## 5. Unsigned installer — Windows SmartScreen
**CaptureImage is currently NOT code-signed.** The project applied to
<https://signpath.io>'s free OSS program and was declined in the first
round. Until a signing certificate is available, every download will
trigger Windows SmartScreen:
> Windows protected your PC
> Microsoft Defender SmartScreen prevented an unrecognized app from
> starting. Running this app might put your PC at risk.
Users can proceed via **More info** → **Run anyway**, but many will
reasonably refuse. To mitigate:
1. The GitHub Release description links to the `SHA256SUMS.txt` file
and explains how to verify the download:
```powershell
Get-FileHash -Algorithm SHA256 Setup.exe
# Compare the output with the hash listed in SHA256SUMS.txt
```
2. [`docs/legal/DISCLAIMER.md §7`](legal/DISCLAIMER.md) explicitly
documents the unsigned state and the SmartScreen warning so users
know it is expected, not a compromise.
3. When SmartScreen "Unknown publisher" warnings decrease over time
(SmartScreen learns reputation from download volume + age), we
re-evaluate whether manual signing is worth the cost.
### When signing becomes available
- [ ] Re-apply to SignPath.io with a more polished project description,
public download count, and signed commits history.
- [ ] Alternatively, purchase an Azure Trusted Signing subscription
(~$10/month) or a cheap EV cert from a CA that issues to individuals.
- [ ] Add a `SIGN_EXE` step to `.github/workflows/release.yml` after
`vpk pack` that calls `signtool sign` on `Setup.exe` and every
intermediate `.nupkg` contents.
- [ ] Re-run `vpk pack` with the signed binaries so the installer embeds
the signed files.
- [ ] Update `docs/legal/DISCLAIMER.md §7` to remove the unsigned note.
- [ ] Update this file's §5 to describe the signing step.
## 6. Manual release (emergency only)
If CI is down and you must cut a release by hand, run locally:
```powershell
dotnet publish src/CaptureImage.App/CaptureImage.App.csproj `
-c Release -r win-x64 --self-contained `
/p:PublishSingleFile=true `
/p:IncludeNativeLibrariesForSelfExtract=true `
/p:EnableCompressionInSingleFile=true `
/p:Version=1.0.0 `
-o .\publish
dotnet tool install --global vpk
vpk pack `
--packId CaptureImage `
--packVersion 1.0.0 `
--packDir .\publish `
--mainExe CaptureImage.App.exe `
--outputDir .\releases
Get-ChildItem .\releases -File | ForEach-Object {
(Get-FileHash $_ -Algorithm SHA256).Hash.ToLower() + " " + $_.Name
} | Out-File .\releases\SHA256SUMS.txt -Encoding utf8
# Create the Release manually via the GitHub web UI and attach every
# file from .\releases\ including SHA256SUMS.txt.
```bash
gh release edit v2.1.0 --draft=false
```
Prefer CI over manual releases — every manual release is one more
build environment to audit.
Publishing with your own token triggers `release: published`, which runs the announcement workflow.
Installed copies see the update on their next check.
## 7. Version policy
## 5. When something goes wrong
CaptureImage uses [Semantic Versioning](https://semver.org) with one
practical twist: as long as the app is pre-1.0 internally (i.e. the
user community is tiny), breaking changes between 1.x.y releases are
still avoided, and API changes in the plugin surface (once that exists)
are flagged in `CHANGELOG.md` as **BREAKING**.
- **The workflow failed** — fix the problem on `main`, then re-run it for the same tag with
**Actions → Release → Run workflow** (`tag: v2.1.0`, `dry_run: false`). It checks out the tag with
the workflow from `main`, so a broken tag doesn't need to be moved. Use `dry_run: true` to build
and pack without touching the release.
- **A bad release was published** — publish a fixed patch release; don't delete the old one (users
may be mid-update). Mark the bad one as pre-release or edit its notes if needed.
- `MAJOR` bumps when the capture engine gains or loses a backend.
- `MINOR` bumps for new user-visible features.
- `PATCH` bumps for bug fixes and security updates.
## 6. Code signing
Velopack deltas are generated automatically by `vpk pack` — users on an
older version will get a diff download instead of the full installer.
The installer isn't Authenticode-signed yet (the SignPath application was declined), so SmartScreen
warns about an unknown publisher. Users can verify downloads with `SHA256SUMS.txt` or the
build-provenance attestation — see [`legal/DISCLAIMER.md`](legal/DISCLAIMER.md), section 7. When a
certificate becomes available (SignPath, Azure Artifact Signing or a CA), sign with `vpk pack
--signTemplate` / `--azureTrustedSignFile` and update the disclaimer.
## 7. Versioning
[Semantic Versioning](https://semver.org): **major** for breaking changes to behavior, settings or
supported systems; **minor** for new features; **patch** for fixes. Pre-releases use a suffix
(`v2.1.0-beta.1`) and are marked as pre-releases automatically; the in-app updater ignores them.
+53
View File
@@ -0,0 +1,53 @@
# Development environment
The toolchain used to build, test and release CaptureImage. Hardware reference:
[`pc_spec.md`](pc_spec.md). Vietnamese version: [`i18n/vi/dev_env.md`](i18n/vi/dev_env.md).
## Toolchain
| Tool | Version | Purpose |
|---|---|---|
| **.NET SDK** | 10.0 (exact feature band pinned in [`global.json`](../global.json)) | Build, test, run |
| **Windows** | 11 22H2 or later | Required by the WPF app and `Windows.Graphics.Capture` |
| **Git** | 2.40 or later | Source control |
| **GPG** | with Ed25519 support | Signed commits and tags (required on `main` and for release tags) |
| **GitHub CLI** (`gh`) | recent | Pull requests, releases, attestation checks |
| **Node.js** | 22 LTS or later | `markdownlint-cli2` for the docs check (optional locally) |
The Windows SDK projections come from NuGet with the target framework
(`net10.0-windows10.0.22621.0`); no separate Windows SDK install is needed. CI uses
`actions/setup-dotnet` with `global-json-file: global.json`, so local and CI SDKs match.
.NET tools used by CI are pinned in [`.config/dotnet-tools.json`](../.config/dotnet-tools.json) and
installed with `dotnet tool restore`: `vpk` (Velopack), JetBrains InspectCode, `nuget-license`,
ReportGenerator and CycloneDX.
## Editors
- **JetBrains Rider** (primary) — the ReSharper inspections match the `deadcode` CI check.
- **Visual Studio 2026** or **Visual Studio Code** with the C# Dev Kit also work.
## Build, test, run
```powershell
git clone https://github.com/poli0981/captureimg.git
cd captureimg
dotnet build CaptureImage.sln -c Release
dotnet test --solution CaptureImage.sln -c Release
dotnet run --project src/CaptureImage.App -c Release -- --data-dir .\.devdata --instance-id dev
```
Warnings are errors and `src/` uses the recommended .NET analyzers, so a clean local build means the
CI build will compile too. See [`CONTRIBUTING.md`](../CONTRIBUTING.md) for the formatting commands
and the full list of required checks.
## Release tooling
Releases are produced by GitHub Actions from signed tags — see [`RELEASING.md`](RELEASING.md).
## Related documents
- [`pc_spec.md`](pc_spec.md) — hardware reference.
- [`ARCHITECTURE.md`](ARCHITECTURE.md) — how the app is built.
- [`CONTRIBUTORS.md`](CONTRIBUTORS.md) — contributors and AI-assistance policy.
- [`../README.md`](../README.md) — project overview.
+54
View File
@@ -0,0 +1,54 @@
# Môi trường phát triển
Bộ công cụ dùng để build, test và phát hành CaptureImage. Tham chiếu phần cứng:
[`pc_spec.md`](pc_spec.md). Bản tiếng Anh: [`dev_env.md`](../../dev_env.md).
## Công cụ
| Công cụ | Phiên bản | Mục đích |
|---|---|---|
| **.NET SDK** | 10.0 (feature band cụ thể được pin trong [`global.json`](../../../global.json)) | Build, test, chạy |
| **Windows** | 11 22H2 trở lên | Bắt buộc cho app WPF và `Windows.Graphics.Capture` |
| **Git** | 2.40 trở lên | Quản lý mã nguồn |
| **GPG** | có hỗ trợ Ed25519 | Ký commit và tag (bắt buộc trên `main` và cho tag phát hành) |
| **GitHub CLI** (`gh`) | bản mới | Pull request, phát hành, kiểm tra attestation |
| **Node.js** | 22 LTS trở lên | `markdownlint-cli2` cho bước kiểm tra docs (không bắt buộc khi làm local) |
Các projection của Windows SDK được lấy từ NuGet theo target framework
(`net10.0-windows10.0.22621.0`); không cần cài Windows SDK riêng. CI dùng `actions/setup-dotnet` với
`global-json-file: global.json`, nên SDK ở máy local và CI luôn khớp nhau.
Các .NET tool mà CI dùng được pin trong
[`.config/dotnet-tools.json`](../../../.config/dotnet-tools.json) và cài bằng `dotnet tool restore`:
`vpk` (Velopack), JetBrains InspectCode, `nuget-license`, ReportGenerator và CycloneDX.
## Trình soạn thảo
- **JetBrains Rider** (chính) — các inspection của ReSharper khớp với bước kiểm tra `deadcode`
trên CI.
- **Visual Studio 2026** hoặc **Visual Studio Code** với C# Dev Kit cũng dùng được.
## Build, test, chạy
```powershell
git clone https://github.com/poli0981/captureimg.git
cd captureimg
dotnet build CaptureImage.sln -c Release
dotnet test --solution CaptureImage.sln -c Release
dotnet run --project src/CaptureImage.App -c Release -- --data-dir .\.devdata --instance-id dev
```
Warning được coi là lỗi và `src/` bật bộ analyzer khuyến nghị của .NET, nên build sạch ở local nghĩa
là bước build trên CI cũng biên dịch được. Xem [`CONTRIBUTING.md`](../../../CONTRIBUTING.md) để biết
các lệnh format và toàn bộ danh sách check bắt buộc.
## Công cụ phát hành
Bản phát hành được GitHub Actions tạo từ tag đã ký — xem [`RELEASING.md`](../../RELEASING.md).
## Tài liệu liên quan
- [`pc_spec.md`](pc_spec.md) — cấu hình phần cứng.
- [`ARCHITECTURE.md`](../../ARCHITECTURE.md) — kiến trúc của app.
- [`CONTRIBUTORS.md`](../../CONTRIBUTORS.md) — người đóng góp và chính sách hỗ trợ AI.
- [`README.md`](../../../README.md) — tổng quan dự án.
+52
View File
@@ -0,0 +1,52 @@
# Cấu hình máy phát triển
Tài liệu này mô tả phần cứng tham chiếu mà CaptureImage được phát
triển và kiểm thử trên đó. Đây là snapshot của máy chính của
maintainer — **không** phải yêu cầu runtime cho end-user. Yêu cầu
cho người dùng cuối nằm trong
[README § Requirements](../../../README.md#requirements).
Bản tiếng Anh: [`docs/pc_spec.md`](../../pc_spec.md).
## Máy phát triển chính
| Component | Details |
|-------------|-------------------------------------------------------------------|
| **OS** | Windows 11 Pro Insider Preview, build 29648 |
| **CPU** | Intel Core i7-14700KF |
| **GPU** | NVIDIA GeForce RTX 5080 (16 GB VRAM) |
| **RAM** | 32 GB DDR5 |
| **Storage** | 1 TB SSD |
| **IDE** | JetBrains 2026.x paid lineup (Rider cho repo này; PyCharm / WebStorm / RustRover cho các project anh em) + Visual Studio Code |
Việc dùng bản Windows Insider là có chủ đích — CaptureImage
khai thác bề mặt API mới nhất của `Windows.Graphics.Capture` và
hưởng lợi khi chạy trên build đi trước stable, nhờ vậy regression
trên các phiên bản public sắp tới được phát hiện sớm.
## Thiết bị test mobile
Một số project lân cận / tương lai sẽ ship một web companion nhỏ.
Khi phần đó được triển khai, browser test trên mobile sẽ chạy trên:
- **iPhone 14 Pro** (iOS 26.x)
- **iPhone 13 Pro Max** (iOS 26.x)
Browser test trên iOS: **Chrome**, **Brave**.
> **Ghi chú.** Bản thân CaptureImage là một desktop application
> Windows 11 (WPF trên .NET 10), không có build iOS / web.
> Các thiết bị mobile ở trên được liệt kê để minh bạch về test fleet
> tổng thể của maintainer; không dùng để validate CaptureImage.
## Tài liệu liên quan
- [`dev_env.md`](dev_env.md) — phiên bản toolchain (.NET SDK, Git,
GPG, Node.js) và cấu hình IDE (bản VI).
- [`README.md` § Requirements](../../../README.md#requirements) —
yêu cầu runtime cho người dùng cuối (Windows 11 22H2+, không yêu
cầu GPU cụ thể).
- [`docs/ARCHITECTURE.md`](../../ARCHITECTURE.md) — kiến trúc phần
mềm (EN, chưa có bản VI).
- [`docs/RELEASING.md`](../../RELEASING.md) — quy trình release
(EN, chưa có bản VI).
+78 -121
View File
@@ -1,157 +1,114 @@
# Disclaimer
_Last updated: 2026-04-15_
_Last updated: 2026-10-19 (CaptureImage 2.0)_
This document describes the known limitations of **CaptureImage** and the
caveats that apply to its development, translations, and licensing. Please
read it before using the application in any production or archival setting.
This document describes the known limitations of **CaptureImage** and the caveats that apply to its
development, translations and licensing. Please read it before relying on the application.
## 1. No warranty
CaptureImage is licensed under the **GNU General Public License v3.0 or
later** (see [`LICENSE`](../../LICENSE)). Under Sections 15 and 16 of that
license, the software is provided **"AS IS"**, without warranty of any kind,
express or implied, including but not limited to the warranties of
merchantability, fitness for a particular purpose, and non-infringement.
CaptureImage is licensed under the **GNU General Public License v3.0 or later** (see
[`LICENSE`](../../LICENSE)). Under sections 15 and 16 of that license the software is provided
**"AS IS"**, without warranty of any kind, express or implied, including the warranties of
merchantability, fitness for a particular purpose and non-infringement.
The author(s) and contributors shall not be held liable for any claim,
damages, or other liability, whether in an action of contract, tort, or
otherwise, arising from, out of, or in connection with the software or the
use or other dealings in the software — including, without limitation:
The authors and contributors are not liable for any claim, damages or other liability arising from
the software or its use — including, without limitation:
- lost or corrupted screenshots,
- game crashes, anti-cheat bans, or account suspensions caused by third-party
software interacting with a title's process,
- data loss resulting from disk full errors, abrupt shutdowns, or failed
atomic file writes, or
- any consequence of running an unsigned binary, a self-built binary, or a
binary downloaded from an unofficial source.
- game crashes, anti-cheat actions or account suspensions involving third-party software that
interacts with a game,
- data loss from full disks or abrupt shutdowns, or
- any consequence of running an unsigned, self-built or unofficially distributed binary.
**Use at your own risk.**
## 2. Capture support is not universal
CaptureImage is designed to capture the visible surface of a target window
using the Windows `Windows.Graphics.Capture` API, with an optional GDI
`PrintWindow` fallback for legacy windowed applications. **It does not, and
by design cannot, capture every application or game.** Known limitations
include, without limitation:
CaptureImage captures windows and screens with the Windows `Windows.Graphics.Capture` API. **It
does not, and by design cannot, capture every application or game.** Known limitations include:
1. **DRM / protected content.** Applications that mark their swap chain as
protected (DRM movie players, secure conferencing, some banking apps) will
produce either an all-black frame or a `ProtectedContent` error. This is a
Windows-level restriction, not a bug in CaptureImage.
2. **Exclusive-fullscreen Direct3D 9 titles.** Some older games that refuse
to register with the Desktop Window Manager cannot be captured by
Windows.Graphics.Capture. The GDI fallback may return a black frame for
these as well.
3. **Anti-cheat protected titles.** Games protected by kernel-mode anti-cheat
systems (VAC, EAC, BattlEye, Vanguard, etc.) may block external capture
tools, or — in rare cases — treat such tools as untrusted and apply
account sanctions. CaptureImage is **not** a cheat and does not read game
memory or inject code, but anti-cheat heuristics are outside our control.
If a given title's anti-cheat flags this tool, **stop using it with that
title immediately** and report the incident via the project's issue
tracker.
4. **High-DPI / multi-monitor mismatches.** When a target window spans two
monitors with different scale factors, the captured frame may include
scaling artifacts at the monitor boundary.
5. **Layered / transparent windows.** Capture fidelity for windows that rely
heavily on layered composition (e.g. some overlays, screen reader
highlights) is best-effort and may omit overlay effects.
6. **Minimized or occluded windows.** A minimized window has no live surface
to capture. Windows.Graphics.Capture may deliver a stale cached frame,
the last-rendered bitmap, or time out with `NoFrameArrived`.
1. **Protected content.** Windows that mark their content as protected (DRM video, some
conferencing and banking apps) produce a black image or a "protected content" error. This is a
Windows restriction.
2. **Exclusive full-screen games.** Some older games that bypass the desktop compositor cannot be
captured, and the region overlays and notifications cannot appear above them. Borderless or
windowed mode usually works.
3. **Anti-cheat.** Games protected by kernel-level anti-cheat (VAC, EAC, BattlEye, Vanguard and
others) may block external capture. CaptureImage does not read game memory or inject code, but
anti-cheat decisions are outside our control. If a game's anti-cheat objects to CaptureImage,
**stop using it with that game** and tell us (§8).
4. **Hotkeys.** While armed, the capture hotkeys are registered with Windows, so the game and other
apps do not receive those key combinations; disarm to give them back. A few games read the
keyboard in a way that bypasses registered hotkeys — use the tray menu's region or screen capture
there.
5. **HDR.** HDR captures are tone-mapped to a standard image using the display's SDR white level.
Colors and highlights are an approximation of what an HDR display shows; keep the JPEG XR original
if exact HDR data matters.
6. **Minimized windows** have nothing to capture; restore the window first.
7. **Mixed-DPI setups.** A window spanning monitors with different scaling may show scaling seams in
its capture.
If a specific title does not work, please file an issue describing the game,
its graphics API, whether it runs windowed / borderless / fullscreen, and
whether the `PrintWindow` fallback was also unable to capture it.
If a game does not work, please open an issue with the game, its graphics API, and whether it runs
windowed, borderless or full screen.
## 3. Development was AI-assisted
## 3. Development is AI-assisted
The implementation of CaptureImage was carried out with significant
assistance from the **Claude Opus 4.6** large language model (Anthropic),
used through Claude Code, during the 2026 development cycle. AI assistance
included — but was not limited to — code generation, unit test drafting,
architectural design proposals, Win32 / WinRT interop troubleshooting,
P/Invoke signature authoring, XAML layout, commit message drafting, and
documentation writing (including this disclaimer).
CaptureImage is developed with substantial help from an AI coding assistant — Claude (Anthropic),
used through Claude Code — for code, tests, Windows interop, user-interface layout, translations,
commit messages and documentation (including this disclaimer).
Every change was reviewed, accepted, and tested by a human maintainer
before landing in version control. However, AI-assisted code may still
contain subtle errors, non-idiomatic patterns, or references to APIs that
behave differently than the model expected. Users and downstream
distributors should treat the source as they would any other community
contribution: **read it, audit it, and run the tests before shipping.**
Commits authored with AI assistance carry a `Co-Authored-By` trailer that
names the model. Git history is the authoritative record.
The maintainer reviews, tests and accepts every change before it is released. AI-assisted code can
still contain subtle mistakes, so treat the source as you would any community contribution: read
it, audit it and run the tests before you depend on it. Commits with meaningful AI authorship carry
a `Co-Authored-By` trailer; the git history is the authoritative record.
## 4. Translations are machine-assisted
CaptureImage ships with localized strings for English (`en-US`),
Vietnamese (`vi-VN`), and Arabic (`ar-SA`). The Arabic translation in
particular was produced with assistance from the same AI model; the
Vietnamese strings were reviewed by a native speaker but still pass
through an automated generation step.
Consequences:
- Terminology may not match native conventions in every locale.
- Some technical jargon (e.g. "hotkey", "toast", "frame") is deliberately
kept in English because it is more recognizable to developers than any
localized equivalent.
- Right-to-left layouts (Arabic) are verified for structural mirroring but
copy may still sound machine-translated.
Native speakers willing to proofread any shipped language are warmly
invited to open a pull request — see [`CONTRIBUTORS.md`](../CONTRIBUTORS.md).
The user interface is available in English, Vietnamese, Arabic, Japanese, Simplified Chinese,
Korean, Spanish, French, German, Brazilian Portuguese and Russian. Except where a native speaker has
reviewed them, the translations were produced with AI assistance. Terminology may not match native
conventions everywhere, and some technical words (for example "hotkey") are kept as users commonly
know them. Native speakers who can proofread a language are very welcome — see
[`CONTRIBUTING.md`](../../CONTRIBUTING.md).
## 5. Trademarks
"Steam", "Dota", "Counter-Strike", "Windows", "DirectX",
"Microsoft .NET", "Avalonia", "Velopack", "SkiaSharp", "ImageSharp",
"Serilog", "SharpHook", and any other third-party names that appear in the
source, documentation, or UI strings are trademarks or registered
trademarks of their respective owners. Their use in this project is for
identification purposes only and does not imply any affiliation with, or
endorsement by, the respective trademark holders.
Microsoft, Windows, DirectX, .NET, Steam, Valve, GitHub, WPF UI, Velopack, SkiaSharp, Serilog and
other names that appear in the source code, documentation or user interface are trademarks of their
respective owners, used only to identify them. No affiliation or endorsement is implied.
## 6. No legal advice
This disclaimer summarizes the project's intent in plain language and is
**not** a substitute for the actual license text. Where this document
conflicts with [`LICENSE`](../../LICENSE), the license text controls. If
you need legal certainty about your use of CaptureImage — for example
because you intend to redistribute it, bundle it with another product, or
integrate it into a commercial offering — consult a qualified attorney in
your jurisdiction.
This disclaimer summarizes the project's intent in plain language and does not replace the license.
Where it conflicts with [`LICENSE`](../../LICENSE), the license controls. If you need legal certainty
— for example to redistribute or bundle CaptureImage — consult a lawyer in your jurisdiction.
## 7. Unsigned installer — SmartScreen warning
## 7. Unsigned installer — SmartScreen
Until a code-signing certificate is available, the installer (`Setup.exe`
produced by Velopack) is **not Authenticode-signed**. Windows SmartScreen
will show the "Unknown publisher" warning on first run:
Until a code-signing certificate is available, the installer `CaptureImage-win-Setup.exe` is **not
Authenticode-signed**, and Windows SmartScreen shows an "unknown publisher" warning on first run.
That alone does not mean the file was altered. To verify a download:
> Windows protected your PC · Microsoft Defender SmartScreen prevented
> an unrecognized app from starting.
1. Download `SHA256SUMS.txt` from the same release page.
2. Compute the hash of your download and compare:
This is expected, not a sign that the binary has been tampered with. To
verify the download is authentic:
1. Download `SHA256SUMS.txt` from the same GitHub Release page.
2. Compute the hash of your downloaded `Setup.exe`:
```powershell
Get-FileHash -Algorithm SHA256 .\Setup.exe
Get-FileHash -Algorithm SHA256 .\CaptureImage-win-Setup.exe
```
3. Compare the output against the entry in `SHA256SUMS.txt`.
Only then click **More info** → **Run anyway** in SmartScreen. If the
hashes do not match, **do not run the installer** and report the
discrepancy via a GitHub Security Advisory.
3. Or verify the GitHub build-provenance attestation:
The project's application to <https://signpath.io> (free OSS code
signing) was declined in the first round. Until it is accepted or an
alternative signing path becomes available, every release ships under
these terms. Re-signing old releases is not planned — each release is
the authoritative artifact at its point in time.
```powershell
gh attestation verify .\CaptureImage-win-Setup.exe --repo poli0981/captureimg
```
Only then choose **More info → Run anyway**. If the hashes don't match, **do not run the file** and
report it to `security@poli0981.dev` or through a GitHub security advisory.
## 8. Contact
- Game publishers and anti-cheat vendors with concerns about CaptureImage: `games@poli0981.dev`.
- Copyright, DMCA or takedown requests: `dmca@poli0981.dev` (or `takedown@poli0981.dev`).
- Other legal questions: `legal@poli0981.dev`.
- Everything else: `contact@poli0981.dev` · <https://poli0981.dev/links>.
+75 -87
View File
@@ -1,114 +1,102 @@
# Privacy Policy
_Last updated: 2026-04-15_
_Last updated: 2026-10-26 (CaptureImage 2.0.2)_
This policy describes what data **CaptureImage** reads from your computer,
what it stores, and what it sends over the network. It applies to the
official builds distributed from the project's GitHub Releases page.
This policy describes what **CaptureImage** reads on your computer, what it stores, and what it
sends over the network. It applies to the official builds published on the project's
[GitHub Releases](https://github.com/poli0981/captureimg/releases) page.
## Summary
- CaptureImage is a **local, offline-first** desktop application.
- It **does not** collect telemetry, analytics, usage metrics, crash
reports, or any personal information.
- It does not create an account, ask for credentials, or authenticate you
with any service.
- The only network access the app performs is the **update check** against
a configured GitHub repository's Releases API (see §3), and only when you
explicitly enable auto-check in Settings or click "Check for updates".
- Optional cloud upload providers (Google Drive, Dropbox) are **post-1.0
stretch features** and are not present in this release.
- CaptureImage is a **local, offline** desktop application.
- It collects **no telemetry, analytics, usage statistics or crash reports**, and has no account
or sign-in.
- The only network access is the **update check and download** against GitHub Releases (§3).
- Captures stay on your computer unless you move them yourself.
## 1. Data the app reads from your machine
To build the list of capture targets and to save your settings, the app
reads the following on each launch or when you refresh the Dashboard:
## 1. What the app reads
| Source | What is read | Why |
|---|---|---|
| Running processes | Process IDs, process names, executable paths, main window handles and titles | Populate the Dashboard list; resolve a target HWND for capture |
| Executable icons | The associated icon of each target's `.exe` | Display next to each target in the Dashboard |
| Windows registry | `HKLM\SOFTWARE\Valve\Steam\InstallPath` (32- and 64-bit views) | Locate the Steam install directory |
| File system | `steamapps\libraryfolders.vdf` and `steamapps\appmanifest_*.acf` under every detected Steam library | Attribute capture targets to Steam games so the warning badge can be shown |
| File system | `%LocalAppData%\CaptureImage\settings.json` | Load your persisted preferences |
| File system | The captured window's pixel buffer via Direct3D11 / GDI | Produce the output image |
| Open windows | Window handles, titles, process ids, process names and executable paths, from Windows window events (`SetWinEventHook`) and process queries | The Dashboard window list, game profiles and auto-arm |
| Executable icons | The icon of each listed program | Shown next to each window |
| Displays | Monitor positions, scaling (DPI), HDR state and SDR white level | Multi-monitor capture and HDR tone mapping |
| Screen contents | The pixels of the window, monitor or area being captured — **only when you press a capture hotkey or click a capture button** | To produce the screenshot |
| Steam | `HKCU\Software\Valve\Steam\SteamPath` or `HKLM\SOFTWARE\Valve\Steam\InstallPath`, then `libraryfolders.vdf` and `appmanifest_*.acf` | The Steam badge and Steam AppId matching in profiles |
| Image files | Pictures in your capture output folders | The Library index and its thumbnails |
| Settings | `settings.json` in the data folder (§2); on the first start of 2.x, the 1.x file in `%LocalAppData%\CaptureImage` is copied | Your preferences |
None of this data leaves your machine. Everything is kept in memory for the
duration of the process, except settings and the captures you explicitly
save.
Keyboard input is **not** monitored. The capture hotkeys are registered with Windows
(`RegisterHotKey`) only while you have them armed; Windows then tells the app when one of those
exact combinations is pressed. While the hotkey recorder in Settings is open, it reads the keys you
press in that field.
## 2. Data the app writes to your machine
**Text recognition (OCR)** runs on your device with the Windows OCR engine, only when you click
**Extract text**; the recognized text is copied to your clipboard and is not stored.
| Location | What is written | Retention |
## 2. What the app writes
| Location | Content | Kept until |
|---|---|---|
| `%LocalAppData%\CaptureImage\settings.json` | Your preferences (language, hotkey, format, quality sliders, output folder, toggles) | Until you delete the file or uninstall the app |
| `%LocalAppData%\CaptureImage\logs\captureimg-YYYYMMDD.log` | Diagnostic log: process list, capture events, errors, settings changes | Rolling daily; max 14 files, 10 MB each |
| Your chosen output folder (default: `%USERPROFILE%\Pictures\CaptureImage\`) | The PNG / JPEG / WebP / TIFF files you capture | Until you delete them |
| `%LocalAppData%\poli0981\CaptureImage\settings.json` (and `settings.*.bak.json` backups made before a reset or when a file can't be read) | Your preferences and game profiles | You reset them or delete the folder |
| `%LocalAppData%\poli0981\CaptureImage\library.json` | Path, time, size, format and game name of each capture | The capture is deleted or the folder is removed |
| `%LocalAppData%\poli0981\CaptureImage\thumbnails\` | Small JPEG previews for the Library | You delete the folder |
| `%LocalAppData%\poli0981\CaptureImage\logs\` | Diagnostic log (§2.1) | 14 daily files, at most 10 MB each |
| Your output folder (default `Pictures\CaptureImage`) | Your captures, and the `.jxr` HDR original when that option is on | You delete them |
| Clipboard | A capture, a file path or recognized text — when you choose to copy, or when the clipboard mode is on | The next thing you copy |
| `HKCU\Software\Microsoft\Windows\CurrentVersion\Run` → `CaptureImage` | The command that starts the app with Windows — only when **Start with Windows** is on | You turn the option off or uninstall |
Logs are written in plain text and contain only information the app
already knows about your local environment (process names, window titles,
file paths, error stacks). They do **not** contain window contents, pixel
data, or personal information from your documents.
Deleting a capture in the Library moves it (and its HDR original) to the **Recycle Bin**.
### 2.1 Logs
Logs contain what the app does: settings changes, capture results with file names and sizes,
hotkey registrations, errors. Your user-profile path is replaced by `%USERPROFILE%`, and window
titles are only logged at the **Debug** level. Logs never contain pixels or the content of your
documents.
### 2.2 Diagnostics export
**Settings → Advanced → Export diagnostics** creates a zip with recent logs, your settings and
system information (Windows and .NET versions, graphics adapter, monitors, scaling and HDR state),
with user paths removed. It is saved where you choose and is never sent anywhere by the app —
attach it to a bug report only if you want to.
### 2.3 Local communication
A second copy of the app talks to the first through a local named pipe that only your Windows
account can open, to bring the existing window forward. Nothing leaves the computer.
## 3. Network access
The only built-in network access is the **update check**, and only when
both of the following are true:
The app connects to the internet only to **check for and download updates**:
1. `UiSettings.AutoCheck` is enabled (off by default) **or** you click the
"Check for updates" button manually.
2. You are connected to the internet.
- when you open the **Update** page (one check per session) or click **Check for updates**, it
downloads the release list (`releases.win.json`) from this project's GitHub Releases over HTTPS;
- when you click **Download**, it downloads the update package from GitHub.
The update check performs an HTTPS GET against the GitHub Releases API for
the configured repository. No cookies, headers, or identifiers are sent
beyond the standard `User-Agent` that the .NET HTTP client adds, and
Velopack's default metadata. GitHub may log the request in its own access
logs under GitHub's privacy policy — CaptureImage does not control or
receive those logs.
No identifiers, cookies or system information are sent beyond what any HTTPS request carries (your
IP address and a standard user agent). GitHub may log these requests under
[its own privacy statement](https://docs.github.com/site-policy/privacy-policies/github-general-privacy-statement).
If an update is available, clicking **Download** issues a second HTTPS
request to GitHub's Releases CDN for the package bytes. Download progress
is kept entirely in memory.
When the .NET Desktop Runtime is missing or older than the app needs, Setup and the updater
download it from Microsoft.
Links in the About page open in your browser; the app itself does not fetch them.
CaptureImage does **not**:
CaptureImage does **not** send crash reports, contact analytics or license servers, upload
captures, or collect hardware identifiers.
- Send crash reports.
- Ping any analytics or metrics endpoint.
- Upload any captured image anywhere automatically.
- Check in with a license server.
- Phone home with system information, hardware fingerprints, or GUIDs.
## 4. Your choices
## 4. Optional cloud upload (future)
- Disarm the hotkeys at any time; nothing is captured without your action.
- Delete `%LocalAppData%\poli0981\CaptureImage` to remove settings, the library index, thumbnails
and logs. Uninstalling removes the program and the "Start with Windows" entry; your captures and
the data folder stay until you delete them.
- The source code is public under GPL-3.0, so every behavior above can be checked.
The project plan includes optional cloud upload providers (Google Drive,
Dropbox) as a post-1.0 stretch feature. If/when those land, they will be
**off by default**, documented separately in this file, and require the
user to:
Changes to this policy are listed in [`CHANGELOG.md`](../../CHANGELOG.md) and in the date above.
1. Explicitly enable the provider in Settings.
2. Complete an OAuth authorization flow that grants the app access to a
single folder.
3. Opt in per-capture or via a global toggle.
## 5. Contact
No cloud upload code is present or compiled into the binary in this
release.
## 5. Your rights
Because no data leaves your machine, there is nothing for the project to
delete, export, or access on request. You can:
- Delete `%LocalAppData%\CaptureImage\` to clear all settings and logs.
- Uninstall the app via its installer or by deleting its folder.
- Review the source code on GitHub — the project is licensed under
GPL-3.0 so every network call is auditable.
If a future release changes this policy, the changes will be noted in
[`CHANGELOG.md`](../../CHANGELOG.md) and in the `Last updated` field at the
top of this file.
## 6. Contact
CaptureImage is a volunteer-run open-source project. Privacy questions can
be raised as GitHub issues on the repository. There is no dedicated
privacy officer, data processing agreement, or paid support channel.
Privacy questions: `privacy@poli0981.dev`. Other channels: <https://poli0981.dev/links>.
CaptureImage is a volunteer open-source project with no paid support.
+48 -72
View File
@@ -1,106 +1,82 @@
# Terms of Use
_Last updated: 2026-04-15_
_Last updated: 2026-10-19 (CaptureImage 2.0)_
These terms describe the relationship between the CaptureImage project and
the people who download, run, and redistribute the software. They are
written in plain English for readability. The authoritative legal text is
the **GNU General Public License v3.0 or later**; these terms do not add
obligations beyond it.
These terms describe the relationship between the CaptureImage project and the people who download,
run and redistribute the software. They are written in plain language; the authoritative legal text
is the **GNU General Public License v3.0 or later**, and these terms add no obligations beyond it.
## 1. The software is free software
CaptureImage is free software as defined by the Free Software Foundation.
You have the four essential freedoms:
CaptureImage is free software as defined by the Free Software Foundation. You have the four
essential freedoms:
1. The freedom to **run** the program, for any purpose.
2. The freedom to **study** how the program works, and **adapt** it to
your needs. Access to the source code is a precondition for this.
3. The freedom to **redistribute** copies so you can help others.
4. The freedom to **distribute modified versions** to others. By doing
this you can give the whole community a chance to benefit from your
changes. Access to the source code is a precondition for this.
1. to **run** the program, for any purpose;
2. to **study** how it works and **adapt** it to your needs;
3. to **redistribute** copies;
4. to **distribute modified versions**.
These freedoms come with the obligations described in the
[GPL-3.0-or-later license text](../../LICENSE). The most important
obligation for downstream users and distributors is: **if you distribute
the software, whether modified or not, you must make the complete
corresponding source code available under the same license.**
These freedoms come with the obligations in the [GPL-3.0-or-later license text](../../LICENSE). The
most important one for distributors: **if you distribute the software, modified or not, you must
make the complete corresponding source code available under the same license.**
## 2. By running CaptureImage, you agree that
- You have read and understood the [DISCLAIMER](DISCLAIMER.md) and the
[PRIVACY POLICY](PRIVACY.md).
- You will **not** use the software to violate the Terms of Service of any
third-party game, application, platform, or service. In particular:
- You will not use it to produce content that violates another party's
copyright, trademark, or other intellectual property rights.
- You will not use it as a component of a cheat, exploit, or similar
tool that breaks anti-cheat rules on an online service.
- You will not capture or distribute images of other people without
their consent where such consent is required by the laws of your
jurisdiction.
- You understand that the software is provided **"AS IS"** under the
GPL-3.0, without warranty of any kind, and that the authors and
contributors are not liable for damages resulting from its use.
- You will not hold the project, its contributors, or the AI systems that
assisted in its development responsible for outcomes caused by your own
use of the software.
- You have read the [Disclaimer](DISCLAIMER.md) and the [Privacy Policy](PRIVACY.md).
- You will **not** use the software to break the terms of service of any game, application,
platform or service — in particular you will not:
- produce or distribute content that infringes someone else's copyright, trademark or other
rights;
- use it as part of a cheat, exploit or tool that circumvents anti-cheat rules;
- capture or share images of other people without the consent your local law requires.
- The software is provided **"AS IS"** under the GPL-3.0, without warranty of any kind, and the
authors and contributors are not liable for damages resulting from its use.
- You will not hold the project, its contributors or the AI systems that assisted its development
responsible for the outcomes of your own use of the software.
If you do not agree with any of the above, please do not install or run
the software.
If you do not agree, please do not install or run the software.
## 3. Trademarks
"CaptureImage" is used as the project's internal name. No trademark
registration is claimed. You may fork the project and rename your fork
freely, subject to the GPL's attribution requirements.
"CaptureImage" is the project's name; no trademark registration is claimed. You may fork the project
and rename your fork, subject to the GPL's attribution requirements.
Third-party trademarks that appear in the source code, documentation,
user interface, or release notes (including but not limited to Microsoft,
Windows, DirectX, Steam, Valve, Avalonia, Velopack, SkiaSharp, ImageSharp,
Serilog, SharpHook, GitHub) are property of their respective owners. They
are referenced for identification and interoperability only. No
Third-party names that appear in the source code, documentation, user interface or release notes
(including Microsoft, Windows, DirectX, .NET, Steam, Valve, GitHub, WPF UI, Velopack, SkiaSharp and
Serilog) belong to their owners and are used only for identification and interoperability. No
endorsement is implied.
## 4. No support obligation
CaptureImage is maintained by volunteers. Nothing in these terms obliges
any contributor to respond to issues, fix bugs, answer questions, merge
pull requests, or ship updates on any particular schedule. Paid support,
commercial licensing, or service-level agreements are **not** offered.
CaptureImage is maintained by volunteers. Nothing in these terms obliges any contributor to answer
questions, fix bugs, merge pull requests or ship updates on any schedule. Paid support, commercial
licensing and service-level agreements are not offered.
## 5. Contributions
Contributions submitted via pull requests are accepted under the same
license as the project itself. By submitting a contribution you represent
that:
Contributions are accepted under the project's license. By submitting one you confirm that:
1. You have the right to license your contribution under GPL-3.0-or-later.
2. Your contribution does not knowingly infringe on any third party's
intellectual property rights.
3. You are comfortable with your contribution being listed in
[`CONTRIBUTORS.md`](../CONTRIBUTORS.md) and in git history.
1. you have the right to license it under GPL-3.0-or-later;
2. it does not knowingly infringe anyone's intellectual property; and
3. you are fine with being credited in [`CONTRIBUTORS.md`](../CONTRIBUTORS.md) and the git history.
If your contribution was generated with AI assistance, please say so in
the pull request description so it can be reviewed with that context in
mind.
If AI tools helped you write a contribution, please say so in the pull request. See
[`CONTRIBUTING.md`](../../CONTRIBUTING.md).
## 6. Termination
Your rights under the GPL-3.0 license terminate automatically if you fail
to comply with the license (see GPL-3.0 Section 8). These terms do not
add additional termination conditions.
Your rights under the GPL-3.0 end automatically if you do not comply with it (GPL-3.0 section 8).
These terms add no other termination conditions.
## 7. Governing law
These terms, the GPL-3.0 license, and any dispute arising from them are
interpreted under the law of the jurisdiction of the downstream user —
there is no central governing jurisdiction imposed by the project because
the project does not sell, transfer, or control distribution.
The project does not sell or control distribution and imposes no governing jurisdiction; these
terms and the license are interpreted under the law that applies to you.
## 8. Contact
The project's primary contact point is its GitHub repository's issue
tracker. Security-sensitive reports that should not be disclosed publicly
may be sent by opening a private security advisory on GitHub.
- Legal questions about these terms: `legal@poli0981.dev`
- Copyright and DMCA notices: `copyright@poli0981.dev` · `dmca@poli0981.dev`
- Takedown requests for content in this repository: `takedown@poli0981.dev`
- Security issues: see [`SECURITY.md`](../../SECURITY.md)
- Anything else: `contact@poli0981.dev` · <https://poli0981.dev/links>
+88 -94
View File
@@ -1,106 +1,100 @@
# Third-party Notices
_Last updated: 2026-04-15_
_Last updated: 2026-11-09 (CaptureImage 2.1.0)_
CaptureImage is built on top of several open-source components. This file
lists every runtime and build dependency together with its upstream license
and project URL. A shorter version is in the repository root [`NOTICE`](../../NOTICE) file.
CaptureImage is built on open-source components. This file lists every package that ships with
the app, with its license and upstream project; the short form is the repository root
[`NOTICE`](../../NOTICE). The list is generated from the app's dependency graph with
[nuget-license](https://github.com/sensslen/nuget-license), and the `license` CI check keeps it
within licenses compatible with **GPL-3.0-or-later**.
All listed licenses are **compatible with distribution under the
GNU General Public License v3.0 or later**, which is the license the
CaptureImage binary is distributed under.
## User interface
## Runtime dependencies
| Package | Version | License | Project |
|---|---|---|---|
| CommunityToolkit.Mvvm | 8.4.2 | MIT | <https://github.com/CommunityToolkit/dotnet> |
| H.GeneratedIcons.System.Drawing | 2.4.1 | MIT | <https://github.com/HavenDV/H.NotifyIcon> |
| H.NotifyIcon | 2.4.1 | MIT | <https://github.com/HavenDV/H.NotifyIcon> |
| H.NotifyIcon.Wpf | 2.4.1 | MIT | <https://github.com/HavenDV/H.NotifyIcon> |
| WPF-UI | 4.3.0 | MIT | <https://github.com/lepoco/wpfui> |
| WPF-UI.Abstractions | 4.3.0 | MIT | <https://github.com/lepoco/wpfui> |
### UI framework
## Capture, imaging and Windows interop
| Package | License | Upstream |
| Package | Version | License | Project |
|---|---|---|---|
| SharpGen.Runtime | 2.4.2-beta | MIT | <https://github.com/SharpGenTools/SharpGenTools> |
| SharpGen.Runtime.COM | 2.4.2-beta | MIT | <https://github.com/SharpGenTools/SharpGenTools> |
| SkiaSharp | 4.154.0 | MIT | <https://github.com/mono/SkiaSharp> |
| SkiaSharp.NativeAssets.Win32 | 4.154.0 | MIT | <https://github.com/mono/SkiaSharp> |
| Vortice.Direct2D1 | 3.8.3 | MIT | <https://github.com/amerkoleci/Vortice.Windows> |
| Vortice.Direct3D11 | 3.8.3 | MIT | <https://github.com/amerkoleci/Vortice.Windows> |
| Vortice.DirectX | 3.8.3 | MIT | <https://github.com/amerkoleci/Vortice.Windows> |
| Vortice.DXGI | 3.8.3 | MIT | <https://github.com/amerkoleci/Vortice.Windows> |
| Vortice.Mathematics | 2.1.0 | MIT | <https://github.com/amerkoleci/Vortice.Mathematics> |
## Hosting, dependency injection and configuration
| Package | Version | License | Project |
|---|---|---|---|
| Microsoft.Extensions.Configuration | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.Abstractions | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.Binder | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.CommandLine | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.EnvironmentVariables | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.FileExtensions | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.Json | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.UserSecrets | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.DependencyInjection | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.DependencyInjection.Abstractions | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Diagnostics | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Diagnostics.Abstractions | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.FileProviders.Abstractions | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.FileProviders.Physical | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.FileSystemGlobbing | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Hosting | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Hosting.Abstractions | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging.Abstractions | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging.Configuration | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging.Console | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging.Debug | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging.EventLog | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging.EventSource | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Options | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Options.ConfigurationExtensions | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Primitives | 10.0.14 | MIT | <https://github.com/dotnet/runtime> |
## Logging
| Package | Version | License | Project |
|---|---|---|---|
| Serilog | 4.4.0 | Apache-2.0 | <https://serilog.net/> |
| Serilog.Extensions.Logging | 10.0.0 | Apache-2.0 | <https://github.com/serilog/serilog-extensions-logging> |
| Serilog.Sinks.Async | 2.1.0 | Apache-2.0 | <https://serilog.net/> |
| Serilog.Sinks.File | 7.0.0 | Apache-2.0 | <https://github.com/serilog/serilog-sinks-file> |
## Updates
| Package | Version | License | Project |
|---|---|---|---|
| Velopack | 1.2.161 | MIT | <https://github.com/velopack/velopack> |
## Platform components
| Component | License | Project |
|---|---|---|
| Avalonia | MIT | <https://github.com/AvaloniaUI/Avalonia> |
| Avalonia.Desktop | MIT | <https://github.com/AvaloniaUI/Avalonia> |
| Avalonia.Themes.Fluent | MIT | <https://github.com/AvaloniaUI/Avalonia> |
| Avalonia.Fonts.Inter | MIT | <https://github.com/AvaloniaUI/Avalonia> |
| Avalonia.Diagnostics | MIT | <https://github.com/AvaloniaUI/Avalonia> |
| Inter typeface | SIL Open Font License 1.1 | <https://github.com/rsms/inter> |
| SkiaSharp | MIT | <https://github.com/mono/SkiaSharp> |
| SkiaSharp.NativeAssets.Win32 | MIT | <https://github.com/mono/SkiaSharp> |
| .NET 10 Desktop Runtime, 10.0.14 or later (installed separately by Setup when missing) | MIT | <https://github.com/dotnet/runtime> |
| Windows SDK projection for .NET (`Microsoft.Windows.SDK.NET`, C#/WinRT) | MIT | <https://github.com/microsoft/CsWinRT> |
| Fluent System Icons (font embedded in WPF UI) | MIT | <https://github.com/microsoft/fluentui-system-icons> |
### MVVM + DI + logging
Build and test tools (CsWin32, xUnit, AwesomeAssertions, NSubstitute, FlaUI, JetBrains
InspectCode, ReportGenerator, CycloneDX, Velopack's `vpk`) are not distributed with the app.
| Package | License | Upstream |
|---|---|---|
| CommunityToolkit.Mvvm | MIT | <https://github.com/CommunityToolkit/dotnet> |
| Microsoft.Extensions.DependencyInjection | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Hosting | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Localization | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Options | MIT | <https://github.com/dotnet/runtime> |
| Serilog | Apache 2.0 | <https://github.com/serilog/serilog> |
| Serilog.Extensions.Hosting | Apache 2.0 | <https://github.com/serilog/serilog-extensions-hosting> |
| Serilog.Extensions.Logging | Apache 2.0 | <https://github.com/serilog/serilog-extensions-logging> |
| Serilog.Sinks.Console | Apache 2.0 | <https://github.com/serilog/serilog-sinks-console> |
| Serilog.Sinks.File | Apache 2.0 | <https://github.com/serilog/serilog-sinks-file> |
| Serilog.Sinks.Async | Apache 2.0 | <https://github.com/serilog/serilog-sinks-async> |
## License texts
### Capture pipeline (Windows)
- MIT: <https://opensource.org/license/mit>
- Apache-2.0: <https://www.apache.org/licenses/LICENSE-2.0>
| Package | License | Upstream |
|---|---|---|
| Vortice.Direct3D11 | MIT | <https://github.com/amerkoleci/Vortice.Windows> |
| Vortice.DXGI | MIT | <https://github.com/amerkoleci/Vortice.Windows> |
| Microsoft.Windows.CsWinRT (runtime only) | MIT | <https://github.com/microsoft/CsWinRT> |
| SixLabors.ImageSharp (>= 3.1) | Apache 2.0 | <https://github.com/SixLabors/ImageSharp> |
| System.Drawing.Common | MIT | <https://github.com/dotnet/runtime> |
| System.Management | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Win32.Registry | MIT | <https://github.com/dotnet/runtime> |
| System.IO.Abstractions | MIT | <https://github.com/TestableIO/System.IO.Abstractions> |
### Hotkeys + state machine + updater
| Package | License | Upstream |
|---|---|---|
| SharpHook | MIT | <https://github.com/TolikPylypchuk/SharpHook> |
| libuiohook (bundled with SharpHook) | GPL-3.0 / LGPL-3.0 | <https://github.com/kwhat/libuiohook> |
| Stateless | Apache 2.0 | <https://github.com/dotnet-state-machine/stateless> |
| Velopack | MIT | <https://github.com/velopack/velopack> |
### Test-only (not redistributed)
| Package | License |
|---|---|
| xUnit | Apache 2.0 |
| xunit.runner.visualstudio | Apache 2.0 |
| Microsoft.NET.Test.Sdk | MIT |
| FluentAssertions (version 6.x) | Apache 2.0 |
| NSubstitute | BSD-3-Clause |
| System.IO.Abstractions.TestingHelpers | MIT |
| coverlet.collector | MIT |
## libuiohook + GPL compatibility note
SharpHook wraps the native `libuiohook` library, which is dual-licensed
under GPL-3.0 and LGPL-3.0. CaptureImage is itself distributed under
GPL-3.0-or-later, so this is compatible. Downstream redistributors of
CaptureImage must therefore also respect the libuiohook license terms
when redistributing the compiled binary.
## Full license texts
The full text of every license referenced above is available from:
- GNU GPL v3.0: <https://www.gnu.org/licenses/gpl-3.0.txt> — shipped as [`LICENSE`](../../LICENSE) in this repository.
- GNU LGPL v3.0: <https://www.gnu.org/licenses/lgpl-3.0.txt>
- Apache License 2.0: <https://www.apache.org/licenses/LICENSE-2.0.txt>
- MIT License: <https://opensource.org/licenses/MIT>
- BSD 3-Clause: <https://opensource.org/licenses/BSD-3-Clause>
- SIL Open Font License 1.1: <https://openfontlicense.org/open-font-license-official-text/>
Per the Apache 2.0 license terms (Section 4), this file serves as the
required notice for Apache-licensed components.
## Reporting a missing attribution
If you ship a downstream copy of CaptureImage and discover that a
dependency is missing from this list, please open a pull request or issue
with the package name, version, and upstream license. We aim to keep this
list complete at every tagged release.
Each package's own license file and copyright notice are available from its project page and
inside the NuGet package.
+49
View File
@@ -0,0 +1,49 @@
# Developer machine specification
This document describes the reference hardware CaptureImage is
developed and validated against. It is a snapshot of the maintainer's
primary development box — not a runtime requirement. End-user
requirements are listed in the project [README](../README.md#requirements).
A Vietnamese mirror of this document lives at
[docs/i18n/vi/pc_spec.md](i18n/vi/pc_spec.md).
## Primary development machine
| Component | Details |
|-------------|-------------------------------------------------------------------|
| **OS** | Windows 11 Pro Insider Preview, build 29648 |
| **CPU** | Intel Core i7-14700KF |
| **GPU** | NVIDIA GeForce RTX 5080 (16 GB VRAM) |
| **RAM** | 32 GB DDR5 |
| **Storage** | 1 TB SSD |
| **IDE** | JetBrains 2026.x paid lineup (Rider for this repo; PyCharm / WebStorm / RustRover for sibling projects) + Visual Studio Code |
The Windows Insider build is intentional — CaptureImage
exercises the latest `Windows.Graphics.Capture` surface area and
benefits from running on builds ahead of stable so regressions on
upcoming public releases are caught early.
## Mobile test devices
Some adjacent / future projects ship a small web companion. When that
work lands, mobile browser testing is performed on:
- **iPhone 14 Pro** (iOS 26.x)
- **iPhone 13 Pro Max** (iOS 26.x)
Browsers under test on iOS: **Chrome**, **Brave**.
> **Note.** CaptureImage itself is a Windows 11 desktop application
> (WPF on .NET 10) and has no iOS / web build. The mobile
> devices above are listed for transparency about the maintainer's
> overall test fleet; they are not used to validate CaptureImage.
## Related documents
- [`docs/dev_env.md`](dev_env.md) — toolchain versions (.NET SDK, Git,
GPG, Node.js) and IDE configuration.
- [`README.md` § Requirements](../README.md#requirements) — end-user
runtime requirements (Windows 11 22H2+, no specific GPU needed).
- [`docs/ARCHITECTURE.md`](ARCHITECTURE.md) — software architecture.
- [`docs/RELEASING.md`](RELEASING.md) — release process.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

+5 -2
View File
@@ -1,7 +1,10 @@
{
"sdk": {
"version": "9.0.312",
"rollForward": "latestPatch",
"version": "10.0.403",
"rollForward": "latestFeature",
"allowPrerelease": false
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
+5
View File
@@ -0,0 +1,5 @@
# lychee link-checker settings for the CI `docs` job.
# Build output (bin/obj) contains copies of the legal docs whose relative links only
# resolve in the repository layout.
exclude_path = ["bin", "obj", "artifacts", "TestResults", "node_modules"]
include_fragments = "full"
+35 -18
View File
@@ -2,32 +2,33 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
<TargetFramework>net10.0-windows10.0.22621.0</TargetFramework>
<SupportedOSPlatformVersion>10.0.22621.0</SupportedOSPlatformVersion>
<UseWPF>true</UseWPF>
<EnableDefaultApplicationDefinition>false</EnableDefaultApplicationDefinition>
<RootNamespace>CaptureImage.App</RootNamespace>
<!-- Keep the v1 executable name: Velopack updates and shortcuts point at it. -->
<AssemblyName>CaptureImage.App</AssemblyName>
<UseWindowsForms>false</UseWindowsForms>
<UseWpf>false</UseWpf>
<!-- App icon + manifest are added in M4 -->
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<!-- Release value for v1.1.1; release.yml still overrides via /p:Version=<git-tag>
for tag-driven builds. Bump to the next -dev suffix after the release lands. -->
<Version>1.1.1</Version>
<StartupObject>CaptureImage.App.Program</StartupObject>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>..\CaptureImage.UI\Assets\CaptureImage.ico</ApplicationIcon>
<!-- [LibraryImport] (AllowSetForegroundWindow) generates unsafe marshalling code. -->
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- Only ship satellite assemblies for the UI languages we translate. -->
<SatelliteResourceLanguages>en;vi;ar;ja;zh-Hans;ko;es;fr;de;pt-BR;ru</SatelliteResourceLanguages>
<!-- XML docs are for the IDE, not the installed app. -->
<PublishDocumentationFiles>false</PublishDocumentationFiles>
<PublishReferencesDocumentationFiles>false</PublishReferencesDocumentationFiles>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia.Desktop" />
<PackageReference Include="Avalonia.Diagnostics" Condition="'$(Configuration)' == 'Debug'" />
<PackageReference Include="CommunityToolkit.Mvvm" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Serilog" />
<PackageReference Include="Serilog.Extensions.Hosting" />
<PackageReference Include="Serilog.Extensions.Logging" />
<PackageReference Include="Serilog.Sinks.Console" />
<PackageReference Include="Serilog.Sinks.File" />
<PackageReference Include="Serilog.Sinks.Async" />
<PackageReference Include="Serilog.Sinks.File" />
<PackageReference Include="Velopack" />
</ItemGroup>
<ItemGroup>
@@ -37,9 +38,7 @@
<ProjectReference Include="..\CaptureImage.UI\CaptureImage.UI.csproj" />
</ItemGroup>
<!-- Ship the legal and docs files next to the binary so the About tab can open them
with Process.Start. Links to the repo-root docs/ folder so there's a single source
of truth; content is copied into bin/.../docs/... at build time. -->
<!-- Legal documents ship next to the executable; About opens them (publish-smoke checks they exist). -->
<ItemGroup>
<Content Include="..\..\docs\legal\DISCLAIMER.md" Link="docs\legal\DISCLAIMER.md" CopyToOutputDirectory="PreserveNewest" />
<Content Include="..\..\docs\legal\PRIVACY.md" Link="docs\legal\PRIVACY.md" CopyToOutputDirectory="PreserveNewest" />
@@ -50,4 +49,22 @@
<Content Include="..\..\NOTICE" Link="NOTICE" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<!-- Packages' debug symbols stay out of the installer (SkiaSharp alone adds a 90 MB native .pdb);
our own .pdb files ship so crash logs have line numbers. -->
<Target Name="DropPackageSymbolsFromPublish" AfterTargets="ComputeResolvedFilesToPublishList">
<ItemGroup>
<ResolvedFileToPublish Remove="@(ResolvedFileToPublish)" Condition="'%(Extension)' == '.pdb' And '%(ResolvedFileToPublish.NuGetPackageId)' != ''" />
</ItemGroup>
</Target>
<!-- Record the commit (SourceLink fills SourceRevisionId) so About and diagnostics show "2.0.0 (abc1234)". -->
<Target Name="EmbedSourceRevision" BeforeTargets="GetAssemblyAttributes" DependsOnTargets="InitializeSourceControlInformation">
<ItemGroup Condition="'$(SourceRevisionId)' != ''">
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>SourceRevisionId</_Parameter1>
<_Parameter2>$(SourceRevisionId)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
</Target>
</Project>
@@ -0,0 +1,97 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using System.IO;
using CaptureImage.Core.Abstractions;
using CaptureImage.Core.Paths;
using CaptureImage.Core.Pipeline;
using CaptureImage.Infrastructure.Capture;
using CaptureImage.Infrastructure.Diagnostics;
using CaptureImage.Infrastructure.Imaging;
using CaptureImage.Infrastructure.Library;
using CaptureImage.Infrastructure.Logging;
using CaptureImage.Infrastructure.Ocr;
using CaptureImage.Infrastructure.Platform;
using CaptureImage.Infrastructure.Settings;
using CaptureImage.Infrastructure.Steam;
using CaptureImage.Infrastructure.Update;
using CaptureImage.Infrastructure.Win32;
using CaptureImage.Infrastructure.Windowing;
using CaptureImage.ViewModels.Localization;
using CaptureImage.ViewModels.Services;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Serilog.Core;
namespace CaptureImage.App.Composition;
/// <summary>Core and Infrastructure services (the UI layer registers its own in CaptureImage.UI).</summary>
internal static class ServiceRegistration
{
public static IServiceCollection AddCaptureImageCore(
this IServiceCollection services,
AppPaths paths,
LoggingLevelSwitch levelSwitch,
InMemorySink logBuffer)
{
services.AddSingleton(paths);
services.AddSingleton(TimeProvider.System);
services.AddSingleton(AppInfo.FromAssembly(typeof(Program).Assembly));
services.AddSingleton<IMessenger>(WeakReferenceMessenger.Default);
services.AddSingleton<ILocalizationService, ResxLocalizationService>();
services.AddSingleton<ILogBufferSource>(logBuffer);
services.AddSingleton<ILogLevelSwitcher>(new SerilogLogLevelSwitcher(levelSwitch));
// A --data-dir run (tests, CI smoke) never adopts the real v1 settings.
services.AddSingleton<ISettingsStore>(sp => new JsonSettingsStore(
paths,
sp.GetRequiredService<ILogger<JsonSettingsStore>>(),
paths.IsOverridden ? null : AppPaths.LegacySettingsFile));
services.AddSingleton<IHotkeyService, Win32HotkeyService>();
services.AddSingleton<IWindowWatcher, WinEventWindowWatcher>();
services.AddSingleton<IconExtractor>();
services.AddSingleton<ISteamDetector>(sp => new SteamLibraryScanner(sp.GetRequiredService<ILogger<SteamLibraryScanner>>()));
services.AddSingleton<ITargetCatalog, TargetCatalog>();
services.AddSingleton<IDisplayService, DisplayService>();
services.AddSingleton<D3D11DeviceManager>();
services.AddSingleton<ICaptureEngine, WgcCaptureEngine>();
services.AddSingleton<IImageEncoder, SkiaImageEncoder>();
services.AddSingleton<IImageEncoder, WicImageEncoder>();
services.AddSingleton<IImageDecoder, WicImageDecoder>();
services.AddSingleton(new FileNameStrategy(File.Exists));
services.AddSingleton<CaptureFileWriter>();
services.AddSingleton<ICaptureLibrary, CaptureLibraryService>();
services.AddSingleton<IShellService, ShellService>();
services.AddSingleton<ISoundService, SoundService>();
services.AddSingleton<IPerformanceModeService, PerformanceModeService>();
services.AddSingleton<IAutostartService, AutostartService>();
services.AddSingleton<IDiagnosticsExporter, DiagnosticsExporter>();
services.AddSingleton<IUpdateService, VelopackUpdateService>();
services.AddSingleton<IOcrService, WindowsOcrService>();
services.AddSingleton<CaptureCoordinator>();
services.AddHostedService<WindowWatcherService>();
return services;
}
}
/// <summary>Starts the WinEvent window watcher with the host and stops it on shutdown.</summary>
internal sealed class WindowWatcherService(IWindowWatcher watcher) : IHostedService
{
public Task StartAsync(CancellationToken cancellationToken)
{
watcher.Start();
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken cancellationToken)
{
watcher.Stop();
return Task.CompletedTask;
}
}
-105
View File
@@ -1,105 +0,0 @@
using System;
using System.IO.Abstractions;
using CaptureImage.Core.Abstractions;
using CaptureImage.Core.Pipeline;
using CaptureImage.Infrastructure.Capture;
using CaptureImage.Infrastructure.Hotkeys;
using CaptureImage.Infrastructure.Imaging;
using CaptureImage.Infrastructure.Logging;
using CaptureImage.Infrastructure.Processes;
using CaptureImage.Infrastructure.Settings;
using CaptureImage.Infrastructure.Steam;
using CaptureImage.Infrastructure.Update;
using CaptureImage.UI.Localization;
using CaptureImage.UI.Services;
using CaptureImage.ViewModels;
using CaptureImage.ViewModels.About;
using CaptureImage.ViewModels.Dashboard;
using CaptureImage.ViewModels.Logs;
using CaptureImage.ViewModels.Navigation;
using CaptureImage.ViewModels.Settings;
using CaptureImage.ViewModels.Update;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog;
using Serilog.Extensions.Logging;
namespace CaptureImage.App;
/// <summary>
/// Builds the DI container for the app. Kept as a single file so it's easy to see every binding.
/// </summary>
internal static class CompositionRoot
{
public static IServiceProvider BuildServices(InMemorySink inMemorySink)
{
var services = new ServiceCollection();
// --- Logging ------------------------------------------------------------
services.AddLogging(builder =>
{
builder.ClearProviders();
builder.AddProvider(new SerilogLoggerProvider(Log.Logger, dispose: false));
builder.SetMinimumLevel(LogLevel.Debug);
});
// The same InMemorySink instance is both the Serilog sink AND the log buffer source
// used by the log viewer VM.
services.AddSingleton(inMemorySink);
services.AddSingleton<ILogBufferSource>(inMemorySink);
// --- Cross-cutting -----------------------------------------------------
services.AddSingleton<IFileSystem, FileSystem>();
services.AddSingleton<IUIThreadDispatcher, AvaloniaUIDispatcher>();
services.AddSingleton<ILocalizationService, ResxLocalizationService>();
// --- Settings ----------------------------------------------------------
services.AddSingleton<ISettingsStore, JsonSettingsStore>();
// --- Steam detection ---------------------------------------------------
services.AddSingleton<ISteamRootLocator, RegistrySteamRootLocator>();
services.AddSingleton<ISteamDetector, SteamLibraryScanner>();
// --- Process / window enumeration --------------------------------------
services.AddSingleton<WindowEnumerator>();
services.AddSingleton<IconExtractor>();
services.AddSingleton<IProcessDetector, GameDetector>();
services.AddSingleton<IProcessWatcher, WmiProcessWatcher>();
// --- Capture engine + encoders -----------------------------------------
services.AddSingleton<D3D11DeviceManager>();
services.AddSingleton<ICaptureEngine, WindowsGraphicsCaptureEngine>();
services.AddSingleton<PrintWindowFallback>();
services.AddSingleton<IImageEncoder, SkiaImageEncoder>();
services.AddSingleton<IImageEncoder, ImageSharpTiffEncoder>();
services.AddSingleton<FileNameStrategy>(_ =>
new FileNameStrategy(System.IO.File.Exists));
services.AddSingleton<CaptureOrchestrator>();
// --- Hotkeys -----------------------------------------------------------
services.AddSingleton<IHotkeyService, SharpHookHotkeyService>();
services.AddSingleton<IHotkeyConflictSniffer, HotkeyConflictSniffer>();
// --- Updates -----------------------------------------------------------
services.AddSingleton<IUpdateService, VelopackUpdateService>();
// --- UI-side services (toasts, preview, tray) --------------------------
services.AddSingleton<IToastService, ToastService>();
services.AddSingleton<IPreviewPresenter, AvaloniaPreviewPresenter>();
services.AddSingleton<ITrayIconHost, AvaloniaTrayIconHost>();
// --- Navigation --------------------------------------------------------
services.AddSingleton<INavigationService, NavigationService>();
// --- View models -------------------------------------------------------
services.AddSingleton<MainWindowViewModel>();
services.AddSingleton<DashboardViewModel>();
services.AddSingleton<UpdateViewModel>();
services.AddSingleton<HotkeyBindingViewModel>();
services.AddSingleton<SettingsViewModel>();
services.AddSingleton<AboutViewModel>();
services.AddSingleton<LogViewerViewModel>();
return services.BuildServiceProvider(validateScopes: true);
}
}
-61
View File
@@ -1,61 +0,0 @@
using System;
using System.IO;
using CaptureImage.Infrastructure.Logging;
using Serilog;
using Serilog.Events;
namespace CaptureImage.App;
/// <summary>
/// Central Serilog configuration. Creates the in-memory ring buffer sink once, exposes it
/// so the DI container can hand it to the log viewer, and wires console + rolling file.
/// </summary>
internal static class LoggingSetup
{
/// <summary>
/// Returns the root directory under <c>%LocalAppData%\CaptureImage</c>, creating it if needed.
/// </summary>
public static string GetAppDataDir()
{
var dir = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"CaptureImage");
Directory.CreateDirectory(dir);
return dir;
}
public static string GetLogsDir()
{
var dir = Path.Combine(GetAppDataDir(), "logs");
Directory.CreateDirectory(dir);
return dir;
}
/// <summary>
/// Build the Serilog root logger together with the in-memory sink, and assign it to
/// <see cref="Log.Logger"/>. Returns the sink so the DI container can register it.
/// </summary>
public static InMemorySink Initialize()
{
var logPath = Path.Combine(GetLogsDir(), "captureimg-.log");
var sink = new InMemorySink();
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.WithProperty("App", "CaptureImage")
.WriteTo.Console()
.WriteTo.Sink(sink)
.WriteTo.Async(a => a.File(
path: logPath,
rollingInterval: RollingInterval.Day,
retainedFileCountLimit: 14,
fileSizeLimitBytes: 10L * 1024 * 1024,
rollOnFileSizeLimit: true,
shared: false,
outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}"))
.CreateLogger();
return sink;
}
}
+107 -75
View File
@@ -1,98 +1,130 @@
using System;
using System.Threading.Tasks;
using Avalonia;
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using System.Globalization;
using System.IO;
using System.Windows.Threading;
using CaptureImage.App.Composition;
using CaptureImage.Core.Abstractions;
using CaptureImage.Core.Paths;
using CaptureImage.Infrastructure.Logging;
using CaptureImage.Infrastructure.Platform;
using CaptureImage.UI;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Serilog;
using Serilog.Core;
using Serilog.Events;
using Velopack;
namespace CaptureImage.App;
internal static class Program
/// <summary>Entry point: Velopack hooks, single instance, logging, container, then the WPF app.</summary>
public static class Program
{
/// <summary>
/// Entry point.
/// </summary>
/// <remarks>
/// <see cref="VelopackApp.Build"/> MUST be the very first thing <see cref="Main"/> does.
/// The Velopack installer passes command-line arguments like <c>--squirrel-install</c>,
/// <c>--squirrel-firstrun</c>, and <c>--squirrel-uninstall</c> on the first launch after an
/// install/update/uninstall event; these need to be handled before Avalonia boots,
/// otherwise the installer will hang waiting for the previous instance to exit.
/// </remarks>
private static readonly TimeSpan ShutdownTimeout = TimeSpan.FromSeconds(5);
[STAThread]
public static int Main(string[] args)
{
// Velopack first — runs hooks for install/firstrun/update/uninstall and returns only
// when the launch is a normal one.
VelopackApp.Build().Run();
// Velopack's install / update / uninstall hooks must run before anything else.
VelopackApp.Build()
.OnBeforeUninstallFastCallback(_ => AutostartService.RemoveForUninstall())
.Run();
// Bootstrap Serilog early (and keep the in-memory sink reference for DI).
var inMemorySink = LoggingSetup.Initialize();
var options = StartupOptions.Parse(args);
var paths = AppPaths.FromCommandLine(args);
paths.EnsureCreated();
using var instance = new SingleInstance(options.InstanceId);
if (!instance.TryAcquire())
{
instance.SignalExisting();
return 0;
}
var levelSwitch = new LoggingLevelSwitch(LogEventLevel.Information);
var logBuffer = new InMemorySink();
Log.Logger = CreateLogger(paths, levelSwitch, logBuffer);
var log = Log.ForContext(typeof(Program));
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
log.Fatal(e.ExceptionObject as Exception, "Unhandled exception; CaptureImage is terminating.");
TaskScheduler.UnobservedTaskException += (_, e) =>
{
log.Error(e.Exception, "Unobserved task exception.");
e.SetObserved();
};
try
{
Log.Information("CaptureImage starting. Args: {Args}", args);
var services = CompositionRoot.BuildServices(inMemorySink);
UI.App.Services = services;
// Load persisted settings before the UI binds to them.
var settingsStore = services.GetRequiredService<ISettingsStore>();
settingsStore.LoadAsync().GetAwaiter().GetResult();
// Apply persisted culture before the first window is constructed so nav labels etc.
// render in the right language from frame zero.
var localization = services.GetRequiredService<ILocalizationService>();
var cultureName = settingsStore.Current.Culture;
if (!string.IsNullOrWhiteSpace(cultureName))
{
try
{
localization.SetCulture(System.Globalization.CultureInfo.GetCultureInfo(cultureName));
}
catch (System.Globalization.CultureNotFoundException)
{
Log.Warning("Persisted culture {Culture} is unknown; falling back to default.", cultureName);
}
}
return BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
}
catch (Exception ex)
{
Log.Fatal(ex, "CaptureImage crashed during startup.");
return -1;
log.Information("CaptureImage {Version} starting (data: {DataDir}).", AppVersion(), paths.DataDirectory);
return Run(args, options, paths, levelSwitch, logBuffer, instance);
}
finally
{
// Flush any pending settings writes and close the logger.
try
{
if (UI.App.Services is not null)
{
var store = UI.App.Services.GetService<ISettingsStore>();
if (store is not null)
{
store.FlushAsync().GetAwaiter().GetResult();
}
}
}
catch (Exception ex)
{
Log.Warning(ex, "Failed to flush settings on shutdown.");
}
log.Information("CaptureImage exited.");
Log.CloseAndFlush();
}
}
/// <summary>
/// Avalonia AppBuilder. Also used by the Avalonia designer — do not do expensive work here.
/// </summary>
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<UI.App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace();
private static int Run(
string[] args,
StartupOptions options,
AppPaths paths,
LoggingLevelSwitch levelSwitch,
InMemorySink logBuffer,
SingleInstance instance)
{
var builder = Host.CreateEmptyApplicationBuilder(new HostApplicationBuilderSettings
{
Args = args,
ContentRootPath = AppContext.BaseDirectory,
});
builder.Logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
builder.Logging.AddSerilog(Log.Logger, dispose: false);
builder.Services.AddCaptureImageCore(paths, levelSwitch, logBuffer);
builder.Services.AddCaptureImageUi(Dispatcher.CurrentDispatcher);
builder.ConfigureContainer(new DefaultServiceProviderFactory(new ServiceProviderOptions
{
ValidateOnBuild = true,
ValidateScopes = true,
}));
using var host = builder.Build();
var settings = host.Services.GetRequiredService<ISettingsStore>();
settings.LoadAsync().GetAwaiter().GetResult();
levelSwitch.MinimumLevel = SerilogLogLevelSwitcher.Parse(settings.Current.LogLevel);
host.StartAsync().GetAwaiter().GetResult();
var app = new UI.App(host.Services, new UiStartupOptions(options.StartMinimized, options.SmokeTest, options.ScreenshotDirectory));
instance.ShowRequested += (_, _) => app.Dispatcher.BeginInvoke(app.ShowMainWindow);
instance.StartListening();
var exitCode = app.Run();
host.StopAsync(ShutdownTimeout).GetAwaiter().GetResult();
settings.FlushAsync().GetAwaiter().GetResult();
return exitCode;
}
private static Logger CreateLogger(AppPaths paths, LoggingLevelSwitch levelSwitch, InMemorySink logBuffer) =>
new LoggerConfiguration()
.MinimumLevel.ControlledBy(levelSwitch)
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("System", LogEventLevel.Warning)
.Enrich.FromLogContext()
.Enrich.With(new UserPathRedactionEnricher())
.WriteTo.Async(sink => sink.File(
Path.Combine(paths.LogsDirectory, "captureimage-.log"),
formatProvider: CultureInfo.InvariantCulture,
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {SourceContext}: {Message:l}{NewLine}{Exception}",
fileSizeLimitBytes: 10L * 1024 * 1024,
rollingInterval: RollingInterval.Day,
rollOnFileSizeLimit: true,
retainedFileCountLimit: 14))
.WriteTo.Sink(logBuffer)
.CreateLogger();
private static string AppVersion() => ViewModels.Services.AppInfo.FromAssembly(typeof(Program).Assembly).DisplayVersion;
}
+123
View File
@@ -0,0 +1,123 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using System.Diagnostics;
using System.IO;
using System.IO.Pipes;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Security.Principal;
using System.Text;
namespace CaptureImage.App;
/// <summary>
/// One running copy per user session and instance id. A second launch asks the first, over a
/// pipe only the same user can open, to show its window, then exits. The names differ from
/// v1, so a v1 copy that is still running doesn't swallow the request.
/// </summary>
internal sealed partial class SingleInstance : IDisposable
{
private const byte ShowCommand = 0x01;
private const int AsfwAny = -1;
private readonly string _name;
private Mutex? _mutex;
private CancellationTokenSource? _listening;
public SingleInstance(string instanceId)
{
using var identity = WindowsIdentity.GetCurrent();
using var process = Process.GetCurrentProcess();
var user = identity.User?.Value ?? Environment.UserName;
var hash = Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(user)))[..12];
_name = $"CaptureImage.v2.{instanceId}.{process.SessionId}.{hash}";
}
/// <summary>Raised on a background thread when another launch asks for the window.</summary>
public event EventHandler? ShowRequested;
/// <summary>True when this is the first copy.</summary>
public bool TryAcquire()
{
var mutex = new Mutex(initiallyOwned: true, @"Local\" + _name, out var createdNew);
if (!createdNew)
{
mutex.Dispose();
return false;
}
_mutex = mutex;
return true;
}
/// <summary>Ask the first copy to show its window (best effort).</summary>
public void SignalExisting()
{
// The first copy is a background process; let it take the foreground for this request.
AllowSetForegroundWindow(AsfwAny);
try
{
using var client = new NamedPipeClientStream(".", _name, PipeDirection.Out, PipeOptions.CurrentUserOnly);
client.Connect(TimeSpan.FromSeconds(2));
client.WriteByte(ShowCommand);
client.Flush();
}
catch (Exception ex) when (ex is TimeoutException or IOException or UnauthorizedAccessException)
{
// The other copy is starting up or shutting down; nothing more to do.
}
}
public void StartListening()
{
_listening = new CancellationTokenSource();
var token = _listening.Token;
_ = Task.Run(() => ListenAsync(token), token);
}
public void Dispose()
{
_listening?.Cancel();
_listening?.Dispose();
if (_mutex is not null)
{
_mutex.ReleaseMutex();
_mutex.Dispose();
}
}
private async Task ListenAsync(CancellationToken cancellationToken)
{
var buffer = new byte[1];
while (!cancellationToken.IsCancellationRequested)
{
try
{
await using var server = new NamedPipeServerStream(
_name,
PipeDirection.In,
maxNumberOfServerInstances: 1,
PipeTransmissionMode.Byte,
PipeOptions.Asynchronous | PipeOptions.CurrentUserOnly);
await server.WaitForConnectionAsync(cancellationToken).ConfigureAwait(false);
if (await server.ReadAsync(buffer, cancellationToken).ConfigureAwait(false) == 1 && buffer[0] == ShowCommand)
{
ShowRequested?.Invoke(this, EventArgs.Empty);
}
}
catch (OperationCanceledException)
{
return;
}
catch (IOException)
{
// A client disconnected mid-message; wait a moment and listen again.
await Task.Delay(TimeSpan.FromMilliseconds(250), cancellationToken).ConfigureAwait(false);
}
}
}
// The BOOL result is ignored: when the call isn't allowed the window simply flashes instead.
[LibraryImport("user32.dll")]
private static partial void AllowSetForegroundWindow(int processId);
}
+47
View File
@@ -0,0 +1,47 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using System.IO;
namespace CaptureImage.App;
/// <summary>
/// Command-line switches: <c>--minimized</c> (start in the tray; "Start with Windows" uses it),
/// <c>--smoke-test</c> (open every page and exit 0 — CI), <c>--instance-id &lt;id&gt;</c>
/// (separate single-instance scope, so tests never talk to a copy the user is running) and
/// <c>--data-dir &lt;path&gt;</c> (read by <c>AppPaths</c>). <c>--screenshots &lt;dir&gt;</c> runs the
/// smoke test and saves a PNG of every page (docs, visual review in CI).
/// </summary>
internal sealed record StartupOptions(bool StartMinimized, bool SmokeTest, string InstanceId, string? ScreenshotDirectory)
{
private const int MaxInstanceIdLength = 32;
public static StartupOptions Parse(IReadOnlyList<string> args)
{
ArgumentNullException.ThrowIfNull(args);
var minimized = args.Any(a => string.Equals(a, "--minimized", StringComparison.OrdinalIgnoreCase));
var smokeTest = args.Any(a => string.Equals(a, "--smoke-test", StringComparison.OrdinalIgnoreCase));
var instanceId = "default";
string? screenshots = null;
for (var i = 0; i < args.Count - 1; i++)
{
if (string.Equals(args[i], "--instance-id", StringComparison.OrdinalIgnoreCase))
{
instanceId = Sanitize(args[i + 1]);
}
else if (string.Equals(args[i], "--screenshots", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(args[i + 1]))
{
screenshots = Path.GetFullPath(args[i + 1]);
}
}
return new StartupOptions(minimized, smokeTest || screenshots is not null, instanceId, screenshots);
}
/// <summary>Letters, digits, '-' and '_' only — the id becomes part of a mutex and pipe name.</summary>
private static string Sanitize(string value)
{
var clean = new string([.. value.Where(c => char.IsAsciiLetterOrDigit(c) || c is '-' or '_').Take(MaxInstanceIdLength)]);
return clean.Length == 0 ? "default" : clean;
}
}
+41
View File
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="CaptureImage.App" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 and 11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!-- Per-monitor DPI v2: crisp UI on mixed-DPI setups; region overlays map 1:1 to screen pixels. -->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
<!-- Output folders and game paths can exceed MAX_PATH. -->
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*" />
</dependentAssembly>
</dependency>
</assembly>
+491
View File
@@ -0,0 +1,491 @@
{
"version": 2,
"dependencies": {
"net10.0-windows10.0.22621": {
"CommunityToolkit.Mvvm": {
"type": "Direct",
"requested": "[8.4.2, )",
"resolved": "8.4.2",
"contentHash": "WadCzGEc2U+3e20avRLng4qNtt4zoOGWrdUISqJWrHe3/FSnrYjuM5Sb4yQb09LhkBXrrI4Zt3dLKgRMbItsrg=="
},
"Microsoft.Extensions.Hosting": {
"type": "Direct",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "q3f2GLZebtxWG/pDtckPrgIWV22pVmSLSLEkncdmbUz7Z6atwF2wn9ag5cZCc/ndcGe7ffHJom98scauFG+oNQ==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.14",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14",
"Microsoft.Extensions.Configuration.Binder": "10.0.14",
"Microsoft.Extensions.Configuration.CommandLine": "10.0.14",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "10.0.14",
"Microsoft.Extensions.Configuration.FileExtensions": "10.0.14",
"Microsoft.Extensions.Configuration.Json": "10.0.14",
"Microsoft.Extensions.Configuration.UserSecrets": "10.0.14",
"Microsoft.Extensions.DependencyInjection": "10.0.14",
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14",
"Microsoft.Extensions.Diagnostics": "10.0.14",
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.14",
"Microsoft.Extensions.FileProviders.Physical": "10.0.14",
"Microsoft.Extensions.Hosting.Abstractions": "10.0.14",
"Microsoft.Extensions.Logging": "10.0.14",
"Microsoft.Extensions.Logging.Abstractions": "10.0.14",
"Microsoft.Extensions.Logging.Configuration": "10.0.14",
"Microsoft.Extensions.Logging.Console": "10.0.14",
"Microsoft.Extensions.Logging.Debug": "10.0.14",
"Microsoft.Extensions.Logging.EventLog": "10.0.14",
"Microsoft.Extensions.Logging.EventSource": "10.0.14",
"Microsoft.Extensions.Options": "10.0.14"
}
},
"Serilog": {
"type": "Direct",
"requested": "[4.4.0, )",
"resolved": "4.4.0",
"contentHash": "ZC6Le3rr4TVJJjS4KsQAesxeF1EhW9qcZmmG7eP5Y2G3+gTGkJEUXkq4+tZNPtyp05I0wWOxnIjwtxFweJsObw=="
},
"Serilog.Extensions.Logging": {
"type": "Direct",
"requested": "[10.0.0, )",
"resolved": "10.0.0",
"contentHash": "vx0kABKl2dWbBhhqAfTOk53/i8aV/5VaT3a6il9gn72Wqs2pM7EK2OB6No6xdqK2IaY6Zf9gdjLuK9BVa2rT+Q==",
"dependencies": {
"Microsoft.Extensions.Logging": "10.0.0",
"Serilog": "4.2.0"
}
},
"Serilog.Sinks.Async": {
"type": "Direct",
"requested": "[2.1.0, )",
"resolved": "2.1.0",
"contentHash": "SnmRknWsSMgyo9wDXeZZCqSp48kkQYy44taSM6vcpxfiRICzSf09oLKEmVr0RCwQnfd8mJQ2WNN6nvhqf0RowQ==",
"dependencies": {
"Serilog": "4.1.0"
}
},
"Serilog.Sinks.File": {
"type": "Direct",
"requested": "[7.0.0, )",
"resolved": "7.0.0",
"contentHash": "fKL7mXv7qaiNBUC71ssvn/dU0k9t0o45+qm2XgKAlSt19xF+ijjxyA3R6HmCgfKEKwfcfkwWjayuQtRueZFkYw==",
"dependencies": {
"Serilog": "4.2.0"
}
},
"Velopack": {
"type": "Direct",
"requested": "[1.2.161, )",
"resolved": "1.2.161",
"contentHash": "OpHNacIumnkhaaX3ZlQ/TCR4YPOJvud2/PAOoWb6o+mIrLwIVA275I5wAgt4q/1O2VrJeDwR1qFQyqzG4lUArg=="
},
"H.GeneratedIcons.System.Drawing": {
"type": "Transitive",
"resolved": "2.4.1",
"contentHash": "gjYhuwHQzISqKhcNYaRdDhzKCoqLZii+6TTHP0MQf4Q9+H6z4f4A5Xu/j8B8XpFPQ1grCMlQYREvNyNJT9Q/Bg=="
},
"H.NotifyIcon": {
"type": "Transitive",
"resolved": "2.4.1",
"contentHash": "nNPgNzo5UHcWYpVLO3AsRlH8fKE9shBA7/WLpZrFZUFbzpKGcLnz15Kmg0pQ851aboAfm3YuHjYFsYQges/pyw==",
"dependencies": {
"H.GeneratedIcons.System.Drawing": "2.4.1"
}
},
"Microsoft.Extensions.Configuration": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "UcnvaEaMvRckDDhyqY1OZkFwBqpZArkHFKB6dWaQWT9XTuNttNNX8Cqsb/Sic2LfJxsMLJUXnYrxY3iX5LN9pQ==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14",
"Microsoft.Extensions.Primitives": "10.0.14"
}
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "4YdfvaoWn3tB1xQQHGrhRTFWJ8fGOqxThxduynSZy9ZFTiSaUi3vX4EK/kj8h2HQMwTlks9MWV1fv2WRBv5/1w==",
"dependencies": {
"Microsoft.Extensions.Primitives": "10.0.14"
}
},
"Microsoft.Extensions.Configuration.Binder": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "brDb5kgle2iY2lWHgeV/KOqnBEpVnlMFigGJ/WW7KP9Nj6C/t53f/h5boYyVXB0bEhgpL+ctbewDJMI+zAMj1w==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.14",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14"
}
},
"Microsoft.Extensions.Configuration.CommandLine": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "/9IqkBeB7mE1enbN4Cfeu4HFPU9uR1JSJh2qwXfwr7SYBxETkTKRht/LoPfajmmlh+BJlH3jm79CLhQPFb9ovw==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.14",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14"
}
},
"Microsoft.Extensions.Configuration.EnvironmentVariables": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "jB0UiYjpnneoBH1ZeXPlHYt4zUme6SZlnstL6gsH/0O/d5rOuN5lSIlOIfxXzapl8tAi7QmYOEogP09g/wcHzA==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.14",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14"
}
},
"Microsoft.Extensions.Configuration.FileExtensions": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "NBIfm8vWNi3UJ9OI9thvREJeV6KzEdPjQ4ONdH+yPWutGBpVnwLbXiEqdEFaGAFYpAluGCfyCwKFgH9pd2scfw==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.14",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14",
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.14",
"Microsoft.Extensions.FileProviders.Physical": "10.0.14",
"Microsoft.Extensions.Primitives": "10.0.14"
}
},
"Microsoft.Extensions.Configuration.Json": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "4Tn8eNg85x+ICDN4OLC7Dl/xvZNREZIf7VSOAdT4Q4KYf5Ip1zAk+0BAx8BsRTomgEpCYV4kKsNNnP/ZXUbQkw==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.14",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14",
"Microsoft.Extensions.Configuration.FileExtensions": "10.0.14",
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.14"
}
},
"Microsoft.Extensions.Configuration.UserSecrets": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "z+dvl9uQnNzvq6Xco+UQyeujpP/BHs+ahHLPCBMxR5GW6M4JcsN1tupEgn5uWgR1fGCfmxS4QJEMt6eyizXGUA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14",
"Microsoft.Extensions.Configuration.Json": "10.0.14",
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.14",
"Microsoft.Extensions.FileProviders.Physical": "10.0.14"
}
},
"Microsoft.Extensions.Diagnostics": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "80VqW8eKxQaxBOLDNpLUdxOlxzWn/jqBSxNBCfD8GCjcshNDpFvUgKh8uvvZwvkfBbwmNPWPWHyy9F+RLd1dlQ==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.14",
"Microsoft.Extensions.Diagnostics.Abstractions": "10.0.14",
"Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.14"
}
},
"Microsoft.Extensions.Diagnostics.Abstractions": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "vm+PPso6vOwGeX52MdOPh6z/R6KHgxQUwqq7k7Jc9jhy2JOxO2KB4xfoJQBBp2Ni8M4zKgJ4r2a1dgrYG7+MKw==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14",
"Microsoft.Extensions.Options": "10.0.14"
}
},
"Microsoft.Extensions.FileProviders.Abstractions": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "rAqf2Em2ZjLqNbcLJlboQnXNyJP604F960TsCKNiP00Ur6ExIc1mcwmNb8L2eTRT8RC8UKx/GjecoWcW2Sj7bw==",
"dependencies": {
"Microsoft.Extensions.Primitives": "10.0.14"
}
},
"Microsoft.Extensions.FileProviders.Physical": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "dcp6eCIk6ZpE3CTNmIna0ifgxsPel/MtOc23/Y/AJlD9SZZr7bhlKK2DAXYlrz81yMkMi6el/LHHUFKCZ3ufuQ==",
"dependencies": {
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.14",
"Microsoft.Extensions.FileSystemGlobbing": "10.0.14",
"Microsoft.Extensions.Primitives": "10.0.14"
}
},
"Microsoft.Extensions.FileSystemGlobbing": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "xt6c/PWLL6+CiBiZA3PWRSfkwcPh+HCwiOLrgSUkhzBT7lrT/+QpIKPeuCQyDPspwOuG1q0cbJhuiGpRjr4UNQ=="
},
"Microsoft.Extensions.Hosting.Abstractions": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "p6NUEkmlaB+FujQZTtyNBKFULQO+Fj8SKuYdYHASQso+RkeYdFDPNsMM4mtOHqx1GZNQnZm/inmsqGkja/Dw2w==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14",
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14",
"Microsoft.Extensions.Diagnostics.Abstractions": "10.0.14",
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.14",
"Microsoft.Extensions.Logging.Abstractions": "10.0.14"
}
},
"Microsoft.Extensions.Logging.Configuration": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "CfFSNbVSXSl8UTH453c0HoY5owcpaY1PMh1xsB+3NWcEq6WUSPHRotydbnMJtmw7Kybp6cTba8e+/uaJI52ANw==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.14",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14",
"Microsoft.Extensions.Configuration.Binder": "10.0.14",
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14",
"Microsoft.Extensions.Logging": "10.0.14",
"Microsoft.Extensions.Logging.Abstractions": "10.0.14",
"Microsoft.Extensions.Options": "10.0.14",
"Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.14"
}
},
"Microsoft.Extensions.Logging.Console": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "8Qx57p3sUAajSZHLQf8eihZqMtSIeI4fZ1JVpL4fvg4QqSbbgJkN0X0owX1cVJJRW2Xw4uqtVv9F7LgdXOBQHQ==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14",
"Microsoft.Extensions.Logging": "10.0.14",
"Microsoft.Extensions.Logging.Abstractions": "10.0.14",
"Microsoft.Extensions.Logging.Configuration": "10.0.14",
"Microsoft.Extensions.Options": "10.0.14"
}
},
"Microsoft.Extensions.Logging.Debug": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "8e79uonXzgIsZbdgc5pa2Ybk5W+vUbd+gfGS50E+BW9ApRv9s0qL1DTyqLv7VQEPxTHS/l8Y0AtS7K8do+TczQ==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14",
"Microsoft.Extensions.Logging": "10.0.14",
"Microsoft.Extensions.Logging.Abstractions": "10.0.14"
}
},
"Microsoft.Extensions.Logging.EventLog": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "4HbWayQiJdw0lYthC45rElah2mJJeSlHDu3rcIrinGe95JdOt6I/vWQTNUFXiujIsHv3Z8MyA79ZC5P1Ww+jNg==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14",
"Microsoft.Extensions.Logging": "10.0.14",
"Microsoft.Extensions.Logging.Abstractions": "10.0.14",
"Microsoft.Extensions.Options": "10.0.14"
}
},
"Microsoft.Extensions.Logging.EventSource": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "Q06Q90D3qnrsKtf1QlaMELCED3ZdMV5SGIRIERUQTTSCoqTNKSitx3KMRgLdxBeqI5ZcbOu5InOu6xQ6o6zmUg==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14",
"Microsoft.Extensions.Logging": "10.0.14",
"Microsoft.Extensions.Logging.Abstractions": "10.0.14",
"Microsoft.Extensions.Options": "10.0.14",
"Microsoft.Extensions.Primitives": "10.0.14"
}
},
"Microsoft.Extensions.Options": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "EeN/33S418m9oWEaZY4N5T+BNxtOqNTIFoFbIgBKwylh4OJPKIWFAzbIhpTdNbwUs26MhkmbLCAbdY+YCJ1dIQ==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14",
"Microsoft.Extensions.Primitives": "10.0.14"
}
},
"Microsoft.Extensions.Options.ConfigurationExtensions": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "4wcIU0rE04ejEfCwHTftu9O8fgH6CRYCe+tseRapikUBn1Kic3QdO7ku22SwFyLrzdWGYPUZMEgv57ZYuuc5gA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14",
"Microsoft.Extensions.Configuration.Binder": "10.0.14",
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14",
"Microsoft.Extensions.Options": "10.0.14",
"Microsoft.Extensions.Primitives": "10.0.14"
}
},
"Microsoft.Extensions.Primitives": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "1bbZqqCJTPba3inTADExbp/9PsGVyvGOX3zr6tFr7ySCgVkX9Lpw7BV0TizktNItd3SsbUu1sQfSAYm1GZMoNw=="
},
"SharpGen.Runtime": {
"type": "Transitive",
"resolved": "2.4.2-beta",
"contentHash": "niTtWAUov1F7wZGAlVeEvW+Tnqvg5yTmhI7rxmYu2Utoyu2TbC9tWWpUpMs0PQg5lu5svoYpCAztNjxCqMFP/w=="
},
"SharpGen.Runtime.COM": {
"type": "Transitive",
"resolved": "2.4.2-beta",
"contentHash": "9lxDFMiepqo3lJQzMSjECCIONeCc2f3Drokgj6HtrTLZcJSftNgcLbD6/iXYj2iphkwgrZb1oLsDOZxoFZkawQ==",
"dependencies": {
"SharpGen.Runtime": "2.4.2-beta"
}
},
"SkiaSharp.NativeAssets.Win32": {
"type": "Transitive",
"resolved": "4.154.0",
"contentHash": "GXgoY77GCXdPcveNAmy8o3gVit8sp6YtnI88h5camLPfihjulwJUajZXKhgVuZ8RhuwSTgfyt/00Dx8HRUSeAA=="
},
"Vortice.DirectX": {
"type": "Transitive",
"resolved": "3.8.3",
"contentHash": "nKwSavv0w5rDF7prSefqAVPDcTyqrfZxKFMVfttiXPfm62VdA/1d+b3PhCZpW4xO7jXczXDwjQdWgD1zGsvM8w==",
"dependencies": {
"SharpGen.Runtime": "2.4.2-beta",
"SharpGen.Runtime.COM": "2.4.2-beta",
"Vortice.Mathematics": "2.1.0"
}
},
"Vortice.Mathematics": {
"type": "Transitive",
"resolved": "2.1.0",
"contentHash": "KK+SjNSuKdP+zbavekubi+vaeb1Jo4k87ZF6CMkVWjr6RjJwc8peVtmgzXXDIMy4ZC3ZISyk3llY3q65ISOkBQ=="
},
"WPF-UI.Abstractions": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "7Kj9DmCCo4SOCd1jAiw4+EcMFP2nR8rLLvitAYzVtzbWToTsodkbie24+8x9C4LDLxkopWEUGX62szqqNy7oeg=="
},
"captureimage.core": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
}
},
"captureimage.infrastructure": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.1.0, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )",
"Serilog": "[4.4.0, )",
"SkiaSharp": "[4.154.0, )",
"Velopack": "[1.2.161, )",
"Vortice.DXGI": "[3.8.3, )",
"Vortice.Direct2D1": "[3.8.3, )",
"Vortice.Direct3D11": "[3.8.3, )"
}
},
"captureimage.ui": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.1.0, )",
"CaptureImage.ViewModels": "[2.1.0, )",
"CommunityToolkit.Mvvm": "[8.4.2, )",
"H.NotifyIcon.Wpf": "[2.4.1, )",
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.14, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )",
"WPF-UI": "[4.3.0, )"
}
},
"captureimage.viewmodels": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.1.0, )",
"CommunityToolkit.Mvvm": "[8.4.2, )",
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.14, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
}
},
"H.NotifyIcon.Wpf": {
"type": "CentralTransitive",
"requested": "[2.4.1, )",
"resolved": "2.4.1",
"contentHash": "aDfDSHCCOWgQoIvAApiog/MhriXibacqANQm+b5GaRCgRg92u5J2QcoW2C+wIblgxhtGx3o32/DCKWRR5C/KLw==",
"dependencies": {
"H.NotifyIcon": "2.4.1"
}
},
"Microsoft.Extensions.DependencyInjection": {
"type": "CentralTransitive",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "2LzcuVjemeXR+WdY9wGIr8iGb7fYsDAit+IScxXX2XJnX0b++mWcE/WO6fEGIqhdMfSQM2ZS5JGMHYZix7YXZg==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14"
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "CentralTransitive",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "QtpQzuSZVyTPCuHW058yCs9Nj0394uUkNyFHS813nOmK9UgUdBdaprJ5PPsBgsQIpxADTsTkbaMMonykem6qdw=="
},
"Microsoft.Extensions.Logging": {
"type": "CentralTransitive",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "O2fXL6JmtkFwkigxS8fPTQpLXxGDjgZco5D+h88s++Cl0bDCs023PVkpNoifciJ+f30I82jnp8tpwF0wCLdFtA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "10.0.14",
"Microsoft.Extensions.Logging.Abstractions": "10.0.14",
"Microsoft.Extensions.Options": "10.0.14"
}
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "CentralTransitive",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "SwcbEBtkECq3D2oywvHkm46fyrX9Dd2JPWphDnHUc2+cUWR1Mdo41atAjh/9iZjgQxuvbKfZKXqostT/LZfefA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14"
}
},
"SkiaSharp": {
"type": "CentralTransitive",
"requested": "[4.154.0, )",
"resolved": "4.154.0",
"contentHash": "R3BuszJ3tUFmni37nZIRawXL0yx+XHyx7xi1716/0TybuEQFhnBx48Ig3rFpeVFQVytpGpJZZ+NLW9d9UPG7EA==",
"dependencies": {
"SkiaSharp.NativeAssets.Win32": "4.154.0"
}
},
"Vortice.Direct2D1": {
"type": "CentralTransitive",
"requested": "[3.8.3, )",
"resolved": "3.8.3",
"contentHash": "SDHEmNUT3A4P8yj+g7q3AnRZ9fvqOOe/EoWjsgkHlQ3C9Tkc51rTeZXC9bQPySli+/lFTui8vMs9tpWZqf+AwQ==",
"dependencies": {
"SharpGen.Runtime": "2.4.2-beta",
"Vortice.DXGI": "3.8.3"
}
},
"Vortice.Direct3D11": {
"type": "CentralTransitive",
"requested": "[3.8.3, )",
"resolved": "3.8.3",
"contentHash": "JgFUswu2mgrSwcd0KRF2AnfeE5VbMEgcicmxPD1g2yXyomPIHbnX3wldBNHPOzzD0URC1WJ/pO1ymfi3imZwvg==",
"dependencies": {
"SharpGen.Runtime": "2.4.2-beta",
"Vortice.DXGI": "3.8.3"
}
},
"Vortice.DXGI": {
"type": "CentralTransitive",
"requested": "[3.8.3, )",
"resolved": "3.8.3",
"contentHash": "MbAUnTeQ6WD99ctAdrj5CQO2I7oaax0Kt2eVdWSUj0bYP9Ed0726+s7dIHe4+tqhpmINW/dcPt0mNtc72o+E0w==",
"dependencies": {
"SharpGen.Runtime": "2.4.2-beta",
"Vortice.DirectX": "3.8.3"
}
},
"WPF-UI": {
"type": "CentralTransitive",
"requested": "[4.3.0, )",
"resolved": "4.3.0",
"contentHash": "SIHhc8lIrhEQ/1cLFZN6Dtf8cqsLm4myBULj9obnacd9TyDs2vizhKYzRzTlcPEcnzb3L4EstvPN3M6kcXbJCA==",
"dependencies": {
"WPF-UI.Abstractions": "4.3.0"
}
}
},
"net10.0-windows10.0.22621/win-x64": {
"SkiaSharp.NativeAssets.Win32": {
"type": "Transitive",
"resolved": "4.154.0",
"contentHash": "GXgoY77GCXdPcveNAmy8o3gVit8sp6YtnI88h5camLPfihjulwJUajZXKhgVuZ8RhuwSTgfyt/00Dx8HRUSeAA=="
}
}
}
}
@@ -1,18 +1,27 @@
using System.Threading;
using System.Threading.Tasks;
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Capture;
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Captures a single frame of a target window. The engine handles D3D/WinRT ceremony and
/// returns raw BGRA pixels — encoding is the encoder's responsibility (see <see cref="IImageEncoder"/>).
/// </summary>
/// <summary>Grabs a single frame from a window or a monitor.</summary>
public interface ICaptureEngine
{
/// <summary>
/// Capture one frame of the target's window. Throws <see cref="Errors.CaptureException"/>
/// with a stable <see cref="Errors.CaptureError"/> on any known-bad path.
/// Capture one frame. 8-bit frames always come back opaque. Failures are reported as
/// <see cref="Errors.CaptureException"/> with a specific <see cref="Errors.CaptureError"/>.
/// </summary>
Task<CapturedFrame> CaptureAsync(GameTarget target, CancellationToken cancellationToken = default);
Task<CapturedFrame> CaptureAsync(CaptureSource source, CaptureOptions options, CancellationToken cancellationToken = default);
}
/// <summary>Monitor layout, DPI and HDR state.</summary>
public interface IDisplayService
{
IReadOnlyList<MonitorInfo> GetMonitors();
MonitorInfo? GetMonitorForWindow(nint windowHandle);
MonitorInfo? GetMonitorAtCursor();
}
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Library;
namespace CaptureImage.Core.Abstractions;
/// <summary>Index of saved captures backing the Library page.</summary>
public interface ICaptureLibrary
{
/// <summary>The index changed (capture added or removed). Raised on any thread.</summary>
event EventHandler? Changed;
/// <summary>All known captures, newest first; files deleted outside the app are dropped.</summary>
Task<IReadOnlyList<CaptureRecord>> GetAllAsync(CancellationToken cancellationToken = default);
Task AddAsync(CaptureRecord record, CancellationToken cancellationToken = default);
/// <summary>Move the image (and its HDR sidecar) to the Recycle Bin and forget it.</summary>
Task<bool> DeleteAsync(CaptureRecord record, CancellationToken cancellationToken = default);
/// <summary>Path of a cached JPEG thumbnail (at most <paramref name="maxSize"/> px on the long edge).</summary>
Task<string?> GetThumbnailAsync(CaptureRecord record, int maxSize, CancellationToken cancellationToken = default);
}
@@ -1,21 +0,0 @@
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Platform-neutral test: is this hotkey binding already owned by another process?
/// Implementations perform a best-effort check (e.g. Windows <c>RegisterHotKey</c> sniff)
/// and immediately release any claim they take — they must never leave the combination
/// bound after the call returns.
/// </summary>
public interface IHotkeyConflictSniffer
{
/// <summary>
/// <c>true</c> if the combination is already registered by another process or the
/// shell; <c>false</c> if we successfully (and transiently) claimed it. Returning
/// <c>false</c> does not prove the combination will work — the Windows shell has
/// higher priority and consumes some combos before <c>RegisterHotKey</c> is consulted
/// (see <see cref="Validation.ReservedHotkeys"/>).
/// </summary>
bool IsConflicted(HotkeyBinding binding);
}
@@ -1,26 +1,61 @@
using System;
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Capture;
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>Result of trying to register one global hotkey.</summary>
public enum HotkeyRegistrationStatus
{
/// <summary>The mode has no hotkey.</summary>
Unbound,
/// <summary>Registered with Windows; it fires while the service is active.</summary>
Registered,
/// <summary>Another application already owns the combination.</summary>
Conflict,
/// <summary>The binding is not a valid hotkey (see <see cref="HotkeyBinding.Validate"/>).</summary>
Invalid,
}
public sealed record HotkeyRegistration(CaptureMode Mode, HotkeyBinding Binding, HotkeyRegistrationStatus Status);
/// <summary>
/// Global (system-wide) hotkey listener. Subscribers are responsible for marshalling
/// to the UI thread — <see cref="Triggered"/> fires from whatever thread the hook uses.
/// System-wide hotkeys (Win32 <c>RegisterHotKey</c>). Keys are only registered while the
/// service is active, because a registered combination never reaches other applications.
/// </summary>
public interface IHotkeyService : IDisposable
{
/// <summary>Currently registered binding, or <c>null</c> if the service is stopped.</summary>
HotkeyBinding? CurrentBinding { get; }
/// <summary>A capture hotkey was pressed. Raised on a background thread.</summary>
event EventHandler<CaptureMode>? Triggered;
/// <summary>Fired whenever the registered binding matches the currently pressed keys.</summary>
event EventHandler? Triggered;
bool IsActive { get; }
IReadOnlyList<HotkeyRegistration> Registrations { get; }
/// <summary>(Re)register every bound mode; returns the per-mode result.</summary>
IReadOnlyList<HotkeyRegistration> Activate(HotkeySettings bindings);
void Deactivate();
/// <summary>
/// Start listening with the given binding. If the service is already listening, the
/// previous binding is replaced.
/// True when another application currently owns <paramref name="binding"/>. Bindings
/// held by this service are not reported as conflicts.
/// </summary>
void SetBinding(HotkeyBinding binding);
bool IsTakenByAnotherApp(HotkeyBinding binding);
/// <summary>Stop listening. Safe to call multiple times.</summary>
void Stop();
/// <summary>
/// Register extra keys for a short time (the region overlay's keys, so they work even if
/// the overlay never gets keyboard focus). Keys another program holds are skipped. The
/// callback runs off the hotkey thread, one press at a time and in the order the keys were
/// pressed. Dispose to release the keys.
/// </summary>
/// <param name="bindings">The keys to hold.</param>
/// <param name="callback">Called with the binding of each press.</param>
/// <param name="repeat">Whether holding a key down repeats it (arrow keys) instead of firing once.</param>
IDisposable RegisterTemporary(IReadOnlyList<HotkeyBinding> bindings, Action<HotkeyBinding> callback, bool repeat = false);
}
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>Loads saved images back into frames (library: copy, OCR, pin).</summary>
public interface IImageDecoder
{
/// <summary>
/// Decode <paramref name="path"/> into an opaque 8-bit frame. With
/// <paramref name="maxDimension"/> &gt; 0 the image is downscaled so its long edge fits.
/// Returns <c>null</c> when the file is missing or not a readable image.
/// </summary>
Task<CapturedFrame?> LoadAsync(string path, int maxDimension = 0, CancellationToken cancellationToken = default);
}
@@ -1,34 +1,44 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Encodes a <see cref="CapturedFrame"/> to a byte stream in a target <see cref="ImageFormat"/>.
/// Encoders may be format-specialized (SkiaSharp for PNG/JPEG/WebP, ImageSharp for TIFF);
/// the dispatcher picks the right one per request.
/// </summary>
/// <summary>PNG zlib effort.</summary>
public enum PngCompressionLevel
{
/// <summary>Fastest save, larger files.</summary>
Fast,
/// <summary>Default trade-off.</summary>
Balanced,
/// <summary>Smallest files, slowest save.</summary>
Smallest,
}
/// <summary>Text metadata embedded into saved images where the format supports it.</summary>
public sealed record ImageMetadata(string? Title, string Software, DateTimeOffset CapturedAt);
/// <summary>Per-save encoder options.</summary>
public sealed record EncoderSettings(
int JpegQuality = 90,
int WebpQuality = 85,
PngCompressionLevel PngCompression = PngCompressionLevel.Balanced,
ImageMetadata? Metadata = null);
/// <summary>Encodes a <see cref="CapturedFrame"/> into an image file stream.</summary>
public interface IImageEncoder
{
/// <summary>True if this encoder can handle <paramref name="format"/>.</summary>
bool Supports(ImageFormat format);
/// <summary>True if this encoder can write <paramref name="format"/> from <paramref name="pixelFormat"/> input.</summary>
bool Supports(ImageFormat format, FramePixelFormat pixelFormat);
/// <summary>
/// Encode <paramref name="frame"/> into <paramref name="destination"/>.
/// </summary>
/// <param name="frame">Raw BGRA source frame.</param>
/// <param name="format">Target format. Must be supported by this encoder.</param>
/// <param name="jpegQuality">1-100, used only when format is JPEG.</param>
/// <param name="webpQuality">1-100, used only when format is WebP.</param>
/// <param name="destination">Writable stream; flushed but not closed.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <summary>Encode into <paramref name="destination"/> (flushed, not closed).</summary>
Task EncodeAsync(
CapturedFrame frame,
ImageFormat format,
int jpegQuality,
int webpQuality,
EncoderSettings settings,
Stream destination,
CancellationToken cancellationToken = default);
}
@@ -0,0 +1,82 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Capture;
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>A frozen picture of one monitor, shown by the region selector.</summary>
/// <param name="Monitor">The monitor that was captured.</param>
/// <param name="DisplayFrame">An 8-bit rendition of the monitor (tone-mapped when it was HDR).</param>
public sealed record MonitorSnapshot(MonitorInfo Monitor, CapturedFrame DisplayFrame);
/// <summary>The rectangle a user dragged, relative to the monitor's top-left corner (physical pixels).</summary>
public sealed record RegionSelection(MonitorInfo Monitor, PixelRect Area);
/// <summary>Full-screen overlays (one per monitor) for dragging a capture rectangle.</summary>
public interface IRegionSelector
{
/// <summary>The user's selection, or <c>null</c> when they cancelled (Esc, right click).</summary>
Task<RegionSelection?> SelectAsync(IReadOnlyList<MonitorSnapshot> snapshots, CancellationToken cancellationToken = default);
}
/// <summary>"Save this capture?" dialog shown when preview-before-save is enabled.</summary>
public interface IPreviewPresenter
{
/// <summary>True to save, false to discard.</summary>
Task<bool> ShowAsync(CapturedFrame frame, string title, CancellationToken cancellationToken = default);
}
/// <summary>Floating always-on-top thumbnails of recent captures.</summary>
public interface IPinnedThumbnailHost
{
void Show(CapturedFrame frame, string? filePath, string title);
}
public interface IClipboardService
{
Task<bool> CopyImageAsync(CapturedFrame frame, CancellationToken cancellationToken = default);
Task<bool> CopyTextAsync(string text, CancellationToken cancellationToken = default);
}
/// <summary>
/// Notifications. While the main window is visible they appear inside it; while the app sits
/// in the tray they appear as small non-activating pop-ups that never steal focus from a game.
/// </summary>
public interface IToastService
{
void Show(ToastKind kind, string title, string message, TimeSpan? duration = null);
}
public static class ToastServiceExtensions
{
public static void ShowSuccess(this IToastService toasts, string title, string message) =>
toasts.Show(ToastKind.Success, title, message);
public static void ShowError(this IToastService toasts, string title, string message) =>
toasts.Show(ToastKind.Error, title, message);
public static void ShowInfo(this IToastService toasts, string title, string message) =>
toasts.Show(ToastKind.Info, title, message);
public static void ShowWarning(this IToastService toasts, string title, string message) =>
toasts.Show(ToastKind.Warning, title, message);
}
/// <summary>Marshals work onto the UI thread.</summary>
public interface IUIThreadDispatcher
{
bool IsOnUIThread { get; }
/// <summary>Queue <paramref name="action"/>; runs inline when already on the UI thread.</summary>
void Post(Action action);
Task InvokeAsync(Action action);
Task<T> InvokeAsync<T>(Func<T> func);
/// <summary>Run an async function on the UI thread and observe its completion.</summary>
Task InvokeAsync(Func<Task> func);
}
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using System.ComponentModel;
using System.Globalization;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Direction of text flow for the UI. Maps 1:1 to Avalonia's
/// <c>Avalonia.Media.FlowDirection</c> but stays in the portable Core assembly so view models
/// don't have to reference Avalonia.
/// Direction of text flow for the UI. Maps 1:1 to WPF's <c>System.Windows.FlowDirection</c>
/// but stays in the portable Core assembly so view models don't reference the UI framework.
/// </summary>
public enum TextFlowDirection
{
@@ -18,8 +18,8 @@ public enum TextFlowDirection
/// <summary>
/// Runtime localization service. Exposes translated strings via the <see cref="this[string]"/>
/// indexer so XAML can bind to <c>{Binding [MyKey], Source={StaticResource Localizer}}</c> and
/// react to culture changes without a restart.
/// indexer so XAML can bind to <c>{Binding Localization[MyKey]}</c> and react to culture
/// changes without a restart.
/// </summary>
public interface ILocalizationService : INotifyPropertyChanged
{
@@ -45,8 +45,44 @@ public interface ILocalizationService : INotifyPropertyChanged
event EventHandler? CultureChanged;
/// <summary>
/// Switch the UI culture. Raises <see cref="PropertyChanged"/> for the indexer (so all
/// Switch the UI culture. Raises <see cref="System.ComponentModel.INotifyPropertyChanged.PropertyChanged"/> for the indexer (so all
/// bindings refresh) and <see cref="CultureChanged"/>.
/// </summary>
void SetCulture(CultureInfo culture);
}
public static class LocalizationServiceExtensions
{
/// <summary>Format a localized template with the current UI culture's number/date rules.</summary>
public static string Format(this ILocalizationService localization, string key, params object?[] args)
{
ArgumentNullException.ThrowIfNull(localization);
return string.Format(localization.CurrentCulture, localization[key], args);
}
/// <summary>
/// The shipped culture closest to <paramref name="requested"/>: the exact name, then the same
/// language (<c>vi</c> → <c>vi-VN</c>, <c>zh-CN</c> → <c>zh-Hans</c>), then English.
/// </summary>
public static CultureInfo MatchSupportedCulture(this ILocalizationService localization, CultureInfo? requested)
{
ArgumentNullException.ThrowIfNull(localization);
var supported = localization.SupportedCultures;
var fallback = supported.Count > 0 ? supported[0] : CultureInfo.GetCultureInfo("en-US");
if (requested is null || requested.Equals(CultureInfo.InvariantCulture))
{
return fallback;
}
for (var culture = requested; !culture.Equals(CultureInfo.InvariantCulture); culture = culture.Parent)
{
var exact = supported.FirstOrDefault(c => string.Equals(c.Name, culture.Name, StringComparison.OrdinalIgnoreCase));
if (exact is not null)
{
return exact;
}
}
return supported.FirstOrDefault(c => c.TwoLetterISOLanguageName == requested.TwoLetterISOLanguageName) ?? fallback;
}
}
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Live control over the Serilog minimum-level floor. The Settings view mutates this
/// when the user picks a new log level, and the wrapper — implemented in
/// <c>CaptureImage.Infrastructure.Logging</c> — pushes the value through to Serilog's
/// <c>LoggingLevelSwitch</c> so new events are filtered immediately.
/// </summary>
/// <remarks>
/// Level strings accepted by <see cref="SetLevel"/>: <c>Debug</c>, <c>Information</c>,
/// <c>Warning</c>, <c>Error</c> (case-insensitive, aliases <c>info</c> / <c>warn</c>
/// accepted). Unknown strings fall back to <c>Information</c>.
/// </remarks>
public interface ILogLevelSwitcher
{
/// <summary>Set the minimum log level from a canonical string.</summary>
void SetLevel(string level);
/// <summary>Canonical name of the currently active minimum level.</summary>
string CurrentLevel { get; }
}
@@ -0,0 +1,33 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
public enum OcrStatus
{
/// <summary>Text was recognized.</summary>
Success,
/// <summary>The engine ran but found no text.</summary>
NoText,
/// <summary>No OCR language pack is installed for the requested or user languages.</summary>
EngineUnavailable,
/// <summary>Recognition failed.</summary>
Failed,
}
public sealed record OcrResult(OcrStatus Status, string Text)
{
public static OcrResult Failed { get; } = new(OcrStatus.Failed, string.Empty);
}
/// <summary>Offline text recognition (Windows.Media.Ocr).</summary>
public interface IOcrService
{
/// <summary>Recognize text in an 8-bit frame; large frames are downscaled to the engine's limit.</summary>
Task<OcrResult> RecognizeAsync(CapturedFrame frame, string? languageTag, CancellationToken cancellationToken = default);
}
@@ -1,25 +0,0 @@
using System.Threading;
using System.Threading.Tasks;
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Shows the user a preview of a captured frame and awaits their accept/reject decision.
/// </summary>
/// <remarks>
/// Declared in Core so the orchestrator / view models don't reference Avalonia. The UI
/// project provides an implementation that opens a modal <c>PreviewWindow</c>.
/// </remarks>
public interface IPreviewPresenter
{
/// <summary>
/// Show the preview dialog for <paramref name="frame"/>. The returned task completes
/// with <c>true</c> when the user accepts and <c>false</c> when they discard or close
/// the dialog without saving.
/// </summary>
Task<bool> ShowAsync(
CapturedFrame frame,
GameTarget target,
CancellationToken cancellationToken = default);
}
@@ -1,20 +0,0 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Enumerates candidate capture targets — processes with a visible top-level window.
/// Implementations combine window enumeration, process metadata, icon extraction,
/// and Steam attribution into a single call.
/// </summary>
public interface IProcessDetector
{
/// <summary>
/// Snapshot the current set of targets. Safe to call repeatedly; detectors
/// are expected to do their own caching for expensive lookups (icons, Steam metadata).
/// </summary>
Task<IReadOnlyList<GameTarget>> EnumerateTargetsAsync(CancellationToken cancellationToken = default);
}
@@ -1,23 +0,0 @@
using System;
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Observes process create/destroy events so the Dashboard can stay live without polling.
/// Implementations raise <see cref="Changed"/> off the UI thread; subscribers are responsible
/// for marshalling to the UI via <see cref="IUIThreadDispatcher"/>.
/// </summary>
public interface IProcessWatcher : IDisposable
{
/// <summary>
/// Raised when a process starts or stops. May fire from an arbitrary thread.
/// </summary>
event EventHandler<ProcessChange>? Changed;
/// <summary>Begin observing. Safe to call multiple times; subsequent calls are no-ops.</summary>
void Start();
/// <summary>Stop observing. Can be restarted with <see cref="Start"/>.</summary>
void Stop();
}
@@ -1,59 +1,35 @@
using System;
using System.Threading;
using System.Threading.Tasks;
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Persistence for <see cref="AppSettings"/>. The orchestrator treats this as a live
/// cache — reads return the current in-memory copy, writes debounce to disk.
/// </summary>
/// <summary>Persisted user settings (<c>settings.json</c> in the data directory).</summary>
public interface ISettingsStore
{
/// <summary>
/// Current in-memory settings. Never <c>null</c>; defaults are returned before the first load.
/// </summary>
AppSettings Current { get; }
/// <summary>
/// Raised after <see cref="Current"/> has been mutated (via <see cref="Update"/>,
/// <see cref="LoadAsync"/>, or <see cref="ImportAsync"/>). Subscribers run on whatever
/// thread the change happened on.
/// </summary>
/// <summary>Raised after <see cref="Current"/> changes, on the thread that made the change.</summary>
event EventHandler? Changed;
/// <summary>Absolute path to the settings file on disk.</summary>
string SettingsFilePath { get; }
/// <summary>
/// Load settings from disk into <see cref="Current"/>. If the file does not exist or
/// fails to parse, defaults are used and a warning is logged. Safe to call repeatedly.
/// </summary>
/// <summary>Load (migrating older schemas and the v1 settings location) — call once at startup.</summary>
Task LoadAsync(CancellationToken cancellationToken = default);
/// <summary>
/// Apply <paramref name="mutator"/> to a copy of <see cref="Current"/> and make it the
/// new current value. Writes are debounced — call this as often as you like, the disk
/// only sees one write per quiet window.
/// </summary>
/// <summary>Apply a change and schedule a debounced write.</summary>
void Update(Func<AppSettings, AppSettings> mutator);
/// <summary>
/// Force an immediate, non-debounced flush to disk. Use at app shutdown or before
/// import/export operations.
/// </summary>
/// <summary>Write pending changes now.</summary>
Task FlushAsync(CancellationToken cancellationToken = default);
/// <summary>
/// Serialize the current settings to <paramref name="exportPath"/>. Existing files are
/// overwritten.
/// </summary>
Task ExportAsync(string exportPath, CancellationToken cancellationToken = default);
/// <summary>
/// Load + validate settings from <paramref name="importPath"/>, adopt them as the new
/// <see cref="Current"/>, and immediately flush. Throws on parse errors or unknown versions.
/// </summary>
/// <summary>Validate and apply a settings file exported earlier.</summary>
/// <exception cref="InvalidDataException">The file is not a valid settings document.</exception>
Task ImportAsync(string importPath, CancellationToken cancellationToken = default);
/// <summary>Back up the current file and restore defaults.</summary>
Task ResetAsync(CancellationToken cancellationToken = default);
}
@@ -1,23 +1,12 @@
using System.Collections.Generic;
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Maps executable paths to Steam application metadata. The user decided (see the plan file)
/// that Steam games get a <b>warning badge, not an ignore</b> — this service returns the
/// <see cref="SteamAppInfo"/> so the UI can render the badge; it does not filter anything out.
/// </summary>
/// <summary>Maps executables to installed Steam apps (for the Steam badge and profiles).</summary>
public interface ISteamDetector
{
/// <summary>
/// All Steam library roots discovered on this machine (empty if Steam is not installed).
/// </summary>
IReadOnlyList<SteamLibrary> Libraries { get; }
/// <summary>
/// Return the <see cref="SteamAppInfo"/> for the executable at <paramref name="executablePath"/>,
/// or <c>null</c> if the executable does not live under a Steam library.
/// </summary>
SteamAppInfo? TryGetAppInfo(string executablePath);
}
@@ -1,14 +0,0 @@
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Locates the Steam client install directory. Production resolves from registry;
/// tests inject a fixed path.
/// </summary>
public interface ISteamRootLocator
{
/// <summary>
/// Absolute path to the Steam install directory (the folder that contains
/// <c>steamapps\libraryfolders.vdf</c>), or <c>null</c> if Steam is not installed.
/// </summary>
string? TryFindSteamRoot();
}
@@ -0,0 +1,61 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
namespace CaptureImage.Core.Abstractions;
/// <summary>Shell integration (open files and folders, links, Recycle Bin).</summary>
public interface IShellService
{
/// <summary>Open a file with its default program, or a folder in Explorer.</summary>
bool Open(string path);
/// <summary>Open Explorer with <paramref name="filePath"/> selected.</summary>
bool RevealInExplorer(string filePath);
bool OpenUrl(Uri url);
/// <summary>Move a file to the Recycle Bin (never a permanent delete).</summary>
bool MoveToRecycleBin(string path);
}
public interface ISoundService
{
void PlayCaptureSound();
}
/// <summary>
/// Windows 11 "efficiency mode" (EcoQoS) while the app idles in the tray, lifted while a
/// capture runs so encoding isn't throttled.
/// </summary>
public interface IPerformanceModeService
{
void SetBackground(bool isBackground);
/// <summary>Temporarily run at normal priority; dispose to return to the previous mode.</summary>
IDisposable BeginForegroundWork();
}
/// <summary>"Start with Windows" (per-user Run key).</summary>
public interface IAutostartService
{
bool IsEnabled { get; }
/// <summary>Returns false if the registry could not be updated.</summary>
bool SetEnabled(bool enabled);
}
/// <summary>Bundles logs, settings and system information for a bug report.</summary>
public interface IDiagnosticsExporter
{
/// <summary>Write a zip to <paramref name="destinationPath"/> and return its path.</summary>
Task<string> ExportAsync(string destinationPath, CancellationToken cancellationToken = default);
/// <summary>A default file name such as <c>CaptureImage-diagnostics-20261019-071500.zip</c>.</summary>
string SuggestFileName();
}
/// <summary>Application shutdown, so view models can quit without referencing the UI framework.</summary>
public interface IAppLifetime
{
void Shutdown();
}
@@ -1,30 +0,0 @@
using System;
using System.Collections.ObjectModel;
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// In-app toast notifications. Anchors to a corner of the main window rather than the
/// OS Action Center — see plan §9.
/// </summary>
public interface IToastService
{
/// <summary>
/// Live collection the UI binds to. Always mutated on the UI thread (callers are
/// responsible for marshalling).
/// </summary>
ObservableCollection<ToastItem> Visible { get; }
/// <summary>Push a toast. Oldest toasts drop off when the visible cap is reached.</summary>
void Show(ToastItem item);
/// <summary>Dismiss a specific toast (user click, auto-timeout, or VM cleanup).</summary>
void Dismiss(Guid id);
/// <summary>Convenience helpers that build a <see cref="ToastItem"/> for you.</summary>
void ShowSuccess(string title, string message);
void ShowError(string title, string message);
void ShowInfo(string title, string message);
void ShowWarning(string title, string message);
}
@@ -1,20 +0,0 @@
using System;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Owns the system tray icon and its context menu. Lifecycle:
/// <list type="number">
/// <item>App startup calls <see cref="Initialize"/> once the main window exists.</item>
/// <item>Menu items post actions back to the main window (Show / Arm / Exit).</item>
/// <item>App shutdown disposes the host.</item>
/// </list>
/// </summary>
public interface ITrayIconHost : IDisposable
{
/// <summary>
/// Attach the tray icon to the application. The host takes a weak reference to the
/// main window so close-to-tray works.
/// </summary>
void Initialize(object mainWindow);
}
@@ -1,20 +0,0 @@
using System;
using System.Threading.Tasks;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Abstraction over the UI thread so portable VM/service code can marshal work
/// without depending on Avalonia directly. The UI project provides the real impl.
/// </summary>
public interface IUIThreadDispatcher
{
/// <summary>True if the current thread is the UI thread.</summary>
bool IsOnUIThread { get; }
/// <summary>Fire-and-forget post to the UI thread.</summary>
void Post(Action action);
/// <summary>Await-able invoke on the UI thread.</summary>
Task InvokeAsync(Action action);
}
@@ -1,50 +1,28 @@
using System;
using System.Threading;
using System.Threading.Tasks;
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Self-update for CaptureImage. Backed by Velopack + GitHub Releases in production, or a
/// no-op stub in dev builds / when Velopack was never set up for the running installation.
/// </summary>
/// <summary>In-app updates from GitHub Releases (Velopack).</summary>
public interface IUpdateService
{
/// <summary>Currently-installed version string (e.g. <c>"0.1.0"</c>).</summary>
string CurrentVersion { get; }
/// <summary>
/// True when the service can actually perform updates (i.e. Velopack metadata is present
/// next to the executable). Dev / <c>dotnet run</c> sessions return false.
/// </summary>
/// <summary>False when running from source (not a Velopack install).</summary>
bool IsAvailable { get; }
/// <summary>
/// Raised whenever a log line should be appended to the Update tab's status log.
/// Fires on whatever thread the update workflow is running on — subscribers marshal
/// to the UI themselves.
/// </summary>
/// <summary>Human-readable progress lines for the Update page.</summary>
event EventHandler<string>? LogEmitted;
/// <summary>
/// Hit the update source and report whether a newer version is available.
/// </summary>
Task<UpdateCheckResult> CheckAsync(CancellationToken cancellationToken = default);
/// <summary>
/// Download the update that was returned by the most recent <see cref="CheckAsync"/>.
/// Reports progress 0-100.
/// </summary>
/// <exception cref="InvalidOperationException">
/// No pending update to download (caller skipped <see cref="CheckAsync"/> or the previous
/// check returned <see cref="UpdateStatus.UpToDate"/>).
/// </exception>
Task DownloadAsync(IProgress<int>? progress = null, CancellationToken cancellationToken = default);
/// <summary>
/// Apply the downloaded update and restart the app. Does not return on success; throws
/// if no download has been performed yet.
/// Hand the downloaded update to the Velopack updater, which waits for this process to
/// exit, applies it and restarts the app. The caller must then shut down normally.
/// </summary>
void ApplyAndRestart();
void ApplyOnExit();
}
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Abstractions;
/// <summary>
/// Event-driven view of the desktop's top-level windows (Win32 WinEvent hooks — no polling).
/// Events are raised on a background thread.
/// </summary>
public interface IWindowWatcher : IDisposable
{
/// <summary>Top-level windows appeared, disappeared or were renamed (debounced).</summary>
event EventHandler? WindowsChanged;
/// <summary>A different window became the foreground window.</summary>
event EventHandler<nint>? ForegroundChanged;
bool IsRunning { get; }
void Start();
void Stop();
}
/// <summary>Builds <see cref="GameTarget"/>s for capturable top-level windows.</summary>
public interface ITargetCatalog
{
/// <summary>All visible, capturable top-level windows of other processes.</summary>
Task<IReadOnlyList<GameTarget>> EnumerateAsync(CancellationToken cancellationToken = default);
/// <summary>Describe one window, or <c>null</c> when it is gone or not capturable.</summary>
Task<GameTarget?> GetTargetAsync(nint windowHandle, CancellationToken cancellationToken = default);
/// <summary>The current foreground window handle (0 when none).</summary>
nint GetForegroundWindow();
}
+3
View File
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using System.Runtime.CompilerServices;
// Expose internal helpers (e.g. FileNameStrategy.ExpandTokens / Sanitize) to the test assembly.
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
namespace CaptureImage.Core.Capture;
/// <summary>What a capture request grabs. Each mode has its own global hotkey.</summary>
public enum CaptureMode
{
/// <summary>The locked target window, or the foreground window when nothing is locked.</summary>
Window,
/// <summary>A rectangle the user drags on a frozen snapshot of one monitor.</summary>
Region,
/// <summary>The whole monitor under the mouse cursor.</summary>
Monitor,
}
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
namespace CaptureImage.Core.Capture;
/// <summary>Per-request switches for the capture engine.</summary>
/// <param name="PreferHdr">
/// Request a 16-bit floating-point (scRGB) frame. Only honored when the source is on an
/// HDR display; otherwise an 8-bit BGRA frame is returned.
/// </param>
/// <param name="IncludeCursor">Draw the mouse cursor into the frame.</param>
/// <param name="IncludeWindowFrame">
/// Keep the title bar and borders of a window capture. Off by default — games are captured
/// from their client area only.
/// </param>
public sealed record CaptureOptions(
bool PreferHdr = false,
bool IncludeCursor = false,
bool IncludeWindowFrame = false)
{
public static CaptureOptions Default { get; } = new();
}
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
namespace CaptureImage.Core.Capture;
/// <summary>What the capture engine should read pixels from.</summary>
public abstract record CaptureSource
{
private protected CaptureSource()
{
}
}
/// <summary>A top-level window (<c>HWND</c>).</summary>
public sealed record WindowCaptureSource(nint WindowHandle) : CaptureSource;
/// <summary>A whole monitor (<c>HMONITOR</c>).</summary>
public sealed record MonitorCaptureSource(nint MonitorHandle) : CaptureSource;
+19
View File
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
namespace CaptureImage.Core.Capture;
/// <summary>
/// HDR state of a display. Luminance values are in nits. When Windows reports nothing
/// usable the defaults describe a plain SDR monitor (80-nit reference white).
/// </summary>
/// <param name="IsHdrActive">The output currently runs in an HDR (PQ / BT.2100) color space.</param>
/// <param name="SdrWhiteNits">Brightness Windows maps SDR white to ("SDR content brightness").</param>
/// <param name="MaxLuminanceNits">Peak luminance reported by the display.</param>
public sealed record HdrInfo(bool IsHdrActive, float SdrWhiteNits, float MaxLuminanceNits)
{
/// <summary>scRGB defines 1.0 as 80 nits.</summary>
public const float ScRgbReferenceWhiteNits = 80f;
public static HdrInfo Sdr { get; } = new(false, ScRgbReferenceWhiteNits, ScRgbReferenceWhiteNits);
}
Loaded 100 of 379 files, more files were not shown because too many files have changed in this diff. Show more