main
6
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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>
|
||
|
|
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> |
||
|
|
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> |
||
|
|
0cb119be6e | remove unused using | ||
|
|
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>
|
||
|
|
0482f718cb |
feat(v1.1-m1): hotkey rebinder + conflict sniff
Settings → Hotkey previously showed a hardcoded "Ctrl+Shift+F12" placeholder. This milestone lands the full rebinder UX: - HotkeyRecorder Avalonia control listens for key combos (Esc cancels) - HotkeyBindingViewModel bridges the recorder to persistence and calls IHotkeyService.SetBinding live so an armed capture picks up the new combo without disarm/re-arm - ReservedHotkeys catalogues Windows shell combos (Win+L, Alt+Tab, Ctrl+Shift+Esc, …); HotkeyBinding.Validate() rejects those plus modifier-only / naked-letter bindings before persistence - HotkeyConflictSniffer does a RegisterHotKey/UnregisterHotKey probe on HWND=NULL so a binding already claimed by another process surfaces as a non-blocking warning — the user still saves it so they keep control - i18n strings added to EN / VI / AR for every recorder surface Tests: +24 Core validation (ReservedHotkeys + HotkeyBinding.Validate), +12 ViewModel flow via NSubstitute fakes. Total 107 pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |