7 Commits
Author SHA1 Message Date
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
72 changed files with 960 additions and 726 deletions

No files matched your search

+9 -2
View File
@@ -10,7 +10,7 @@
"rollForward": false
},
"jetbrains.resharper.globaltools": {
"version": "2026.2.3.1",
"version": "2026.2.4",
"commands": [
"jb"
],
@@ -24,7 +24,7 @@
"rollForward": false
},
"dotnet-reportgenerator-globaltool": {
"version": "5.5.11",
"version": "5.5.12",
"commands": [
"reportgenerator"
],
@@ -36,6 +36,13 @@
"dotnet-CycloneDX"
],
"rollForward": false
},
"dotnet-sonarscanner": {
"version": "12.0.0",
"commands": [
"dotnet-sonarscanner"
],
"rollForward": false
}
}
}
+7
View File
@@ -8,6 +8,9 @@ version: 2
# 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:
- package-ecosystem: nuget
@@ -33,6 +36,9 @@ updates:
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:
@@ -64,6 +70,7 @@ updates:
- "nuget-license"
- "dotnet-reportgenerator-globaltool"
- "cyclonedx"
- "dotnet-sonarscanner"
- package-ecosystem: github-actions
directory: "/"
+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 }
+117 -7
View File
@@ -37,7 +37,7 @@ jobs:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
cache: true
@@ -77,6 +77,110 @@ jobs:
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
@@ -90,7 +194,7 @@ jobs:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
cache: true
@@ -122,7 +226,7 @@ jobs:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
cache: true
@@ -171,7 +275,7 @@ jobs:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
@@ -184,6 +288,12 @@ jobs:
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
@@ -206,7 +316,7 @@ jobs:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
@@ -247,7 +357,7 @@ jobs:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
cache: true
@@ -313,7 +423,7 @@ jobs:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
cache: true
+1 -1
View File
@@ -34,7 +34,7 @@ jobs:
persist-credentials: false
- name: markdownlint
uses: DavidAnson/markdownlint-cli2-action@21c1be1b93ad9ed58fa840aacc3f279cde2a72ff # v24.2.0
uses: DavidAnson/markdownlint-cli2-action@696eb3f2509270d7b882d2aa68347bc676e7af34 # v25.0.0
with:
globs: |
**/*.md
+7 -5
View File
@@ -43,8 +43,10 @@ env:
PACK_TITLE: CaptureImage
MAIN_EXE: CaptureImage.App.exe
CHANNEL: win
# Installed by Setup / the updater when missing (the app is framework-dependent).
RUNTIME: net10-x64-desktop
# 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:
build:
@@ -91,7 +93,7 @@ jobs:
# No NuGet cache here: a poisoned cache must never reach release binaries.
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
@@ -182,8 +184,8 @@ jobs:
"## 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 if it is missing.',
'- **`CaptureImage-win-Portable.zip`** — extract-and-run build without installer (needs the [.NET 10 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/10.0)).',
'- **`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',
+1 -1
View File
@@ -37,7 +37,7 @@ jobs:
publish_results: true
- name: Upload to code scanning
uses: github/codeql-action/upload-sarif@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0
uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with:
sarif_file: scorecard.sarif
category: scorecard
+2 -2
View File
@@ -44,9 +44,9 @@ jobs:
./actionlint -color
- name: zizmor
uses: zizmorcore/zizmor-action@85b2b9fb8e3325e7a23d7d0a9d7ba5ae0f999e3e # v0.7.1
uses: zizmorcore/zizmor-action@45d7276c9ca790aabd705e31ca99c6185c3e76dd # v0.8.1
with:
version: "1.31.1"
version: "1.32.0"
advanced-security: false
annotations: true
persona: regular
+3
View File
@@ -50,6 +50,9 @@ _Pvt_Extensions/
packages/
!packages/build/
# SonarScanner for .NET working folder
.sonarqube/
# Test results / coverage / build logs
TestResults/
coverage*.xml
+36
View File
@@ -7,6 +7,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [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
+25 -11
View File
@@ -18,7 +18,7 @@ dotnet test --solution CaptureImage.sln -c Release --no-build # Microsoft.Test
dotnet run --project src/CaptureImage.App -c Release -- --data-dir .\.devdata --instance-id dev
```
- SDK pinned in `global.json` (10.0.401, `latestFeature`). Tests are xunit.v3 on
- 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
@@ -29,7 +29,7 @@ dotnet run --project src/CaptureImage.App -c Release -- --data-dir .\.devdata --
- 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`.
`reportgenerator`, `dotnet-CycloneDX`, `dotnet-sonarscanner` (CI only; needs `SONAR_TOKEN`).
## Layout and layering rules
@@ -60,7 +60,13 @@ tests/* Core, Infrastructure, ViewModels tests + App.Ui
`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).
`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`.
## Pitfalls already hit
@@ -80,15 +86,22 @@ tests/* Core, Infrastructure, ViewModels tests + App.Ui
- `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`,
`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), plus CodeQL via the code-scanning rule.
- 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.
- SonarCloud (automatic analysis, project `poli0981_captureimg`) comments on PRs — fix what it
reports.
- 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
@@ -105,7 +118,8 @@ tests/* Core, Infrastructure, ViewModels tests + App.Ui
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-x64-desktop` — never change the first three), attaches SBOM, SHA256SUMS and provenance
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`.
+7 -2
View File
@@ -42,10 +42,15 @@ Every pull request must pass the required checks before it can be merged (squash
- **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; shipped dependencies use a GPL-compatible
license.
- **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**.
+1 -1
View File
@@ -34,7 +34,7 @@
</PropertyGroup>
<PropertyGroup Label="Version (single source of truth — the release workflow checks the tag against it)">
<Version>2.0.1</Version>
<Version>2.0.3</Version>
<AssemblyVersion>$([System.Text.RegularExpressions.Regex]::Match('$(Version)', '^\d+\.\d+\.\d+').Value).0</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
+7 -7
View File
@@ -15,11 +15,11 @@
</ItemGroup>
<ItemGroup Label="Microsoft.Extensions">
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.13" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.13" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.13" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.13" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.13" />
<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">
@@ -33,11 +33,11 @@
<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.363" />
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.367" />
</ItemGroup>
<ItemGroup Label="Imaging">
<PackageVersion Include="SkiaSharp" Version="4.153.1" />
<PackageVersion Include="SkiaSharp" Version="4.154.0" />
</ItemGroup>
<ItemGroup Label="Auto-update (keep in lockstep with the vpk tool in .config/dotnet-tools.json)">
+4 -2
View File
@@ -5,6 +5,8 @@
[![License: GPL-3.0](https://img.shields.io/badge/License-GPL--3.0--or--later-blue.svg)](LICENSE)
[![.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 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.
@@ -68,8 +70,8 @@ small tray app that does nothing until you press a hotkey.
## Requirements
- **Windows 11 22H2 or later** (build 22621+), 64-bit.
- **.NET 10 Desktop Runtime** — installed automatically by Setup and by the in-app updater when it
is missing. The portable zip needs it installed
- **.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
+2 -1
View File
@@ -65,7 +65,8 @@ targets rather than guarantees.
## Supply chain
- Dependencies are pinned centrally with lock files; Dependabot proposes updates after a cooldown,
and every pull request is checked for known-vulnerable and incompatibly licensed packages.
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
+6 -4
View File
@@ -191,7 +191,9 @@ shortcuts never change, so installed copies keep updating. See [RELEASING.md](RE
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 and incompatibly licensed dependencies; a publish of the app
followed by a smoke test that opens every page; PR title; dependency review; workflow lint
(actionlint, zizmor); Markdown lint and link check. End-to-end UI tests (FlaUI), CodeQL, OpenSSF
Scorecard and SonarCloud run as well.
(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.
+1 -1
View File
@@ -36,7 +36,7 @@ The workflow then:
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 as a prerequisite, full packages only;
.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.
+3 -2
View File
@@ -1,6 +1,6 @@
# Privacy Policy
_Last updated: 2026-10-19 (CaptureImage 2.0)_
_Last updated: 2026-10-26 (CaptureImage 2.0.2)_
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
@@ -79,7 +79,8 @@ No identifiers, cookies or system information are sent beyond what any HTTPS req
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).
When the .NET Desktop Runtime is missing, Setup and the updater download it from Microsoft.
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** send crash reports, contact analytics or license servers, upload
+31 -31
View File
@@ -1,6 +1,6 @@
# Third-party Notices
_Last updated: 2026-10-19 (CaptureImage 2.0)_
_Last updated: 2026-11-09 (CaptureImage 2.0.3)_
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
@@ -25,8 +25,8 @@ within licenses compatible with **GPL-3.0-or-later**.
|---|---|---|---|
| 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.153.1 | MIT | <https://github.com/mono/SkiaSharp> |
| SkiaSharp.NativeAssets.Win32 | 4.153.1 | MIT | <https://github.com/mono/SkiaSharp> |
| 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> |
@@ -37,33 +37,33 @@ within licenses compatible with **GPL-3.0-or-later**.
| Package | Version | License | Project |
|---|---|---|---|
| Microsoft.Extensions.Configuration | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.Abstractions | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.Binder | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.CommandLine | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.EnvironmentVariables | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.FileExtensions | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.Json | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Configuration.UserSecrets | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.DependencyInjection | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.DependencyInjection.Abstractions | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Diagnostics | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Diagnostics.Abstractions | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.FileProviders.Abstractions | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.FileProviders.Physical | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.FileSystemGlobbing | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Hosting | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Hosting.Abstractions | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging.Abstractions | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging.Configuration | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging.Console | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging.Debug | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging.EventLog | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Logging.EventSource | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Options | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Options.ConfigurationExtensions | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| Microsoft.Extensions.Primitives | 10.0.13 | MIT | <https://github.com/dotnet/runtime> |
| 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
@@ -84,7 +84,7 @@ within licenses compatible with **GPL-3.0-or-later**.
| Component | License | Project |
|---|---|---|
| .NET 10 Desktop Runtime (installed separately by Setup when missing) | MIT | <https://github.com/dotnet/runtime> |
| .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> |
+1 -1
View File
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "10.0.401",
"version": "10.0.403",
"rollForward": "latestFeature",
"allowPrerelease": false
},
+173 -173
View File
@@ -10,32 +10,32 @@
},
"Microsoft.Extensions.Hosting": {
"type": "Direct",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "Q+hmPoDqeHipHyJcY7mDCQiLDUcn9jIgjoCThcgaOgjLTTT3ApTe8p6M2+twsDyfKuuCsKhSNlnNjaaggtXxRA==",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "q3f2GLZebtxWG/pDtckPrgIWV22pVmSLSLEkncdmbUz7Z6atwF2wn9ag5cZCc/ndcGe7ffHJom98scauFG+oNQ==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.13",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
"Microsoft.Extensions.Configuration.Binder": "10.0.13",
"Microsoft.Extensions.Configuration.CommandLine": "10.0.13",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "10.0.13",
"Microsoft.Extensions.Configuration.FileExtensions": "10.0.13",
"Microsoft.Extensions.Configuration.Json": "10.0.13",
"Microsoft.Extensions.Configuration.UserSecrets": "10.0.13",
"Microsoft.Extensions.DependencyInjection": "10.0.13",
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
"Microsoft.Extensions.Diagnostics": "10.0.13",
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.13",
"Microsoft.Extensions.FileProviders.Physical": "10.0.13",
"Microsoft.Extensions.Hosting.Abstractions": "10.0.13",
"Microsoft.Extensions.Logging": "10.0.13",
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
"Microsoft.Extensions.Logging.Configuration": "10.0.13",
"Microsoft.Extensions.Logging.Console": "10.0.13",
"Microsoft.Extensions.Logging.Debug": "10.0.13",
"Microsoft.Extensions.Logging.EventLog": "10.0.13",
"Microsoft.Extensions.Logging.EventSource": "10.0.13",
"Microsoft.Extensions.Options": "10.0.13"
"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": {
@@ -93,221 +93,221 @@
},
"Microsoft.Extensions.Configuration": {
"type": "Transitive",
"resolved": "10.0.13",
"contentHash": "inhujYI/nikhmLxYI6ZEcaCgZ28ipJsKMPPxxr2XWf3vM0Q2P+E9R3hDHABZOLBxzD3gjpgcbSH/+hd2+gvI2A==",
"resolved": "10.0.14",
"contentHash": "UcnvaEaMvRckDDhyqY1OZkFwBqpZArkHFKB6dWaQWT9XTuNttNNX8Cqsb/Sic2LfJxsMLJUXnYrxY3iX5LN9pQ==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
"Microsoft.Extensions.Primitives": "10.0.13"
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14",
"Microsoft.Extensions.Primitives": "10.0.14"
}
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Transitive",
"resolved": "10.0.13",
"contentHash": "DY4C2qzTt2lOIY3VoscBH/TCwTolI5DKOfgJLuI+k1QUvRNT5vTMS58AOerNiihdVRStO0wEpLeRWA8jytzHBQ==",
"resolved": "10.0.14",
"contentHash": "4YdfvaoWn3tB1xQQHGrhRTFWJ8fGOqxThxduynSZy9ZFTiSaUi3vX4EK/kj8h2HQMwTlks9MWV1fv2WRBv5/1w==",
"dependencies": {
"Microsoft.Extensions.Primitives": "10.0.13"
"Microsoft.Extensions.Primitives": "10.0.14"
}
},
"Microsoft.Extensions.Configuration.Binder": {
"type": "Transitive",
"resolved": "10.0.13",
"contentHash": "yJJl/b0+W+GEWbu+7viw6C3h2BoNkB69Vlz7s/4e+hm4mYbJqfhdcDSi9sCXJw47blsBaiQd3UDPgDtop92+ug==",
"resolved": "10.0.14",
"contentHash": "brDb5kgle2iY2lWHgeV/KOqnBEpVnlMFigGJ/WW7KP9Nj6C/t53f/h5boYyVXB0bEhgpL+ctbewDJMI+zAMj1w==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.13",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13"
"Microsoft.Extensions.Configuration": "10.0.14",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14"
}
},
"Microsoft.Extensions.Configuration.CommandLine": {
"type": "Transitive",
"resolved": "10.0.13",
"contentHash": "RwdNZ9JdGs8eZmeL5qRe7ugp0Irk3KVkWpC/w1c8kjJwu1R4HvCXYz9kwHZxn45WiaRBG5lphQKtqnBaJOQC+Q==",
"resolved": "10.0.14",
"contentHash": "/9IqkBeB7mE1enbN4Cfeu4HFPU9uR1JSJh2qwXfwr7SYBxETkTKRht/LoPfajmmlh+BJlH3jm79CLhQPFb9ovw==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.13",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13"
"Microsoft.Extensions.Configuration": "10.0.14",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14"
}
},
"Microsoft.Extensions.Configuration.EnvironmentVariables": {
"type": "Transitive",
"resolved": "10.0.13",
"contentHash": "qJK2dm9/AxyPVfqqBaZtjkUFl2hnBR/CQnMJtSO5LdEoyATMqvZjeQVY+8l0oa6PM6qlVe28iMEyXIRQ0wyZjA==",
"resolved": "10.0.14",
"contentHash": "jB0UiYjpnneoBH1ZeXPlHYt4zUme6SZlnstL6gsH/0O/d5rOuN5lSIlOIfxXzapl8tAi7QmYOEogP09g/wcHzA==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.13",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13"
"Microsoft.Extensions.Configuration": "10.0.14",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.14"
}
},
"Microsoft.Extensions.Configuration.FileExtensions": {
"type": "Transitive",
"resolved": "10.0.13",
"contentHash": "kwC1DY55CsqPmDtJAz+7alD3G+gJcM+XwHSZrcRO8mJGYB9hRq1qC6ZH8DL0SPW9WtJ/Bae5ikzPic8SxSv6Vw==",
"resolved": "10.0.14",
"contentHash": "NBIfm8vWNi3UJ9OI9thvREJeV6KzEdPjQ4ONdH+yPWutGBpVnwLbXiEqdEFaGAFYpAluGCfyCwKFgH9pd2scfw==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.13",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.13",
"Microsoft.Extensions.FileProviders.Physical": "10.0.13",
"Microsoft.Extensions.Primitives": "10.0.13"
"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.13",
"contentHash": "acCWM2+WR67kBAz6gAhD2zG+IZH9Q2VpKv5le7Msiu0vAMsnnLXpnV3BAzxd8/i+uOEo/dfb2XRYTynRVTDvEg==",
"resolved": "10.0.14",
"contentHash": "4Tn8eNg85x+ICDN4OLC7Dl/xvZNREZIf7VSOAdT4Q4KYf5Ip1zAk+0BAx8BsRTomgEpCYV4kKsNNnP/ZXUbQkw==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.13",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
"Microsoft.Extensions.Configuration.FileExtensions": "10.0.13",
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.13"
"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.13",
"contentHash": "kQ/Tx972unP+ueQL8SSninthIj6w6XP2o0VnJPFC5HQIimPMwEN704MOspEgDkmm4FUL5SuxLEU0bNiW4HEZFA==",
"resolved": "10.0.14",
"contentHash": "z+dvl9uQnNzvq6Xco+UQyeujpP/BHs+ahHLPCBMxR5GW6M4JcsN1tupEgn5uWgR1fGCfmxS4QJEMt6eyizXGUA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
"Microsoft.Extensions.Configuration.Json": "10.0.13",
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.13",
"Microsoft.Extensions.FileProviders.Physical": "10.0.13"
"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.13",
"contentHash": "J9ODOrffj1mK3Et69elNsLGRguesPxvThTdVpFmQX7fLNPhIOgqHQfLdGnTBEwNAV3yf8yiyVlpDZNw2qN87Nw==",
"resolved": "10.0.14",
"contentHash": "80VqW8eKxQaxBOLDNpLUdxOlxzWn/jqBSxNBCfD8GCjcshNDpFvUgKh8uvvZwvkfBbwmNPWPWHyy9F+RLd1dlQ==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.13",
"Microsoft.Extensions.Diagnostics.Abstractions": "10.0.13",
"Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.13"
"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.13",
"contentHash": "oZzqZze8ed1fLS20HtIrkPxQXGRG/koq09srIw2ptnDHm9RHfwB++d35hosB/cXc55TH7Pshv85O0txongjCIg==",
"resolved": "10.0.14",
"contentHash": "vm+PPso6vOwGeX52MdOPh6z/R6KHgxQUwqq7k7Jc9jhy2JOxO2KB4xfoJQBBp2Ni8M4zKgJ4r2a1dgrYG7+MKw==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
"Microsoft.Extensions.Options": "10.0.13"
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14",
"Microsoft.Extensions.Options": "10.0.14"
}
},
"Microsoft.Extensions.FileProviders.Abstractions": {
"type": "Transitive",
"resolved": "10.0.13",
"contentHash": "BZDwtN3uoWRghDi5lRRZPDjMMCg2Ds7J6YEYjqka/TLjqnzquEpXyvchrIMeoubwT1ns23ow6PPeAoBHJO81Rw==",
"resolved": "10.0.14",
"contentHash": "rAqf2Em2ZjLqNbcLJlboQnXNyJP604F960TsCKNiP00Ur6ExIc1mcwmNb8L2eTRT8RC8UKx/GjecoWcW2Sj7bw==",
"dependencies": {
"Microsoft.Extensions.Primitives": "10.0.13"
"Microsoft.Extensions.Primitives": "10.0.14"
}
},
"Microsoft.Extensions.FileProviders.Physical": {
"type": "Transitive",
"resolved": "10.0.13",
"contentHash": "U7HkgGCNPICN5k7NVK6dmLsSPSPeO/EbNcuxOl/5qdC9Ahjp9UZWKOvlnUC+rYurmoxIlwyv9e5j0BaQlTOELA==",
"resolved": "10.0.14",
"contentHash": "dcp6eCIk6ZpE3CTNmIna0ifgxsPel/MtOc23/Y/AJlD9SZZr7bhlKK2DAXYlrz81yMkMi6el/LHHUFKCZ3ufuQ==",
"dependencies": {
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.13",
"Microsoft.Extensions.FileSystemGlobbing": "10.0.13",
"Microsoft.Extensions.Primitives": "10.0.13"
"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.13",
"contentHash": "vQVzmAbnzlhXSXA2caYnlxtG9GXxEwtj5bODiWLu06A6iqeJmfBtlfKjuOSJGRy0/CFaNUrm7u9nxEUlljc2Rg=="
"resolved": "10.0.14",
"contentHash": "xt6c/PWLL6+CiBiZA3PWRSfkwcPh+HCwiOLrgSUkhzBT7lrT/+QpIKPeuCQyDPspwOuG1q0cbJhuiGpRjr4UNQ=="
},
"Microsoft.Extensions.Hosting.Abstractions": {
"type": "Transitive",
"resolved": "10.0.13",
"contentHash": "zIrbe9vkIFXxW3mOApIOWXw+xMwX7Cgsptr3ZSlglJt4hW2qp4fB/JU1NHgAevteBNH4PicvU9DsFPHxlnnloA==",
"resolved": "10.0.14",
"contentHash": "p6NUEkmlaB+FujQZTtyNBKFULQO+Fj8SKuYdYHASQso+RkeYdFDPNsMM4mtOHqx1GZNQnZm/inmsqGkja/Dw2w==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
"Microsoft.Extensions.Diagnostics.Abstractions": "10.0.13",
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.13",
"Microsoft.Extensions.Logging.Abstractions": "10.0.13"
"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.13",
"contentHash": "OyYJOaE9WbBx1Hp+Dd2zrqeFM0JwH5M/x0VL6tNUv3V18vIAVpix8UjhvY9eW/iXpguEHy68JO/Z9YkBOwftIw==",
"resolved": "10.0.14",
"contentHash": "CfFSNbVSXSl8UTH453c0HoY5owcpaY1PMh1xsB+3NWcEq6WUSPHRotydbnMJtmw7Kybp6cTba8e+/uaJI52ANw==",
"dependencies": {
"Microsoft.Extensions.Configuration": "10.0.13",
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
"Microsoft.Extensions.Configuration.Binder": "10.0.13",
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
"Microsoft.Extensions.Logging": "10.0.13",
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
"Microsoft.Extensions.Options": "10.0.13",
"Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.13"
"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.13",
"contentHash": "i9rn0rHkiCxfNVbf4DRG7LOFcKPy/BioAxS07w6daWvIpLNRjskqDJcGGaYVFWndsq0iTRaS8Msry0t5fRYQug==",
"resolved": "10.0.14",
"contentHash": "8Qx57p3sUAajSZHLQf8eihZqMtSIeI4fZ1JVpL4fvg4QqSbbgJkN0X0owX1cVJJRW2Xw4uqtVv9F7LgdXOBQHQ==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
"Microsoft.Extensions.Logging": "10.0.13",
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
"Microsoft.Extensions.Logging.Configuration": "10.0.13",
"Microsoft.Extensions.Options": "10.0.13"
"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.13",
"contentHash": "yBig0DNMq+3UgliwxYlUC48dg0fPqvqI5B3ljzmLTrpR6maoKTOO5i9QnPgQUmQoaQWZMgu74fuF6oSDihb6pg==",
"resolved": "10.0.14",
"contentHash": "8e79uonXzgIsZbdgc5pa2Ybk5W+vUbd+gfGS50E+BW9ApRv9s0qL1DTyqLv7VQEPxTHS/l8Y0AtS7K8do+TczQ==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
"Microsoft.Extensions.Logging": "10.0.13",
"Microsoft.Extensions.Logging.Abstractions": "10.0.13"
"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.13",
"contentHash": "OAK40lXhgMuvyNwvzW3fxLvvucN8yr5XS7dQRcPmtnPf+Pt1lpbMgao5T4Wa6VdFagtIeDZNgPtV5Ig4xstziQ==",
"resolved": "10.0.14",
"contentHash": "4HbWayQiJdw0lYthC45rElah2mJJeSlHDu3rcIrinGe95JdOt6I/vWQTNUFXiujIsHv3Z8MyA79ZC5P1Ww+jNg==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
"Microsoft.Extensions.Logging": "10.0.13",
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
"Microsoft.Extensions.Options": "10.0.13"
"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.13",
"contentHash": "SxJu3oczk+TJtHvpgAmCVzEkzx69/obA6GZCbGrbqYqc981YOAyfEprySBdFX7Yc5qatHJKHNTlpGeeBAQkZcA==",
"resolved": "10.0.14",
"contentHash": "Q06Q90D3qnrsKtf1QlaMELCED3ZdMV5SGIRIERUQTTSCoqTNKSitx3KMRgLdxBeqI5ZcbOu5InOu6xQ6o6zmUg==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
"Microsoft.Extensions.Logging": "10.0.13",
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
"Microsoft.Extensions.Options": "10.0.13",
"Microsoft.Extensions.Primitives": "10.0.13"
"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.13",
"contentHash": "tmMJgdrE4uhf1JcNs9CV9moAHW+hmDuvgMiPpnQxarKaUxqI2eN33sYK5S4l9Uw+rG9PJvlm4qPxMhvolTDTaQ==",
"resolved": "10.0.14",
"contentHash": "EeN/33S418m9oWEaZY4N5T+BNxtOqNTIFoFbIgBKwylh4OJPKIWFAzbIhpTdNbwUs26MhkmbLCAbdY+YCJ1dIQ==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
"Microsoft.Extensions.Primitives": "10.0.13"
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14",
"Microsoft.Extensions.Primitives": "10.0.14"
}
},
"Microsoft.Extensions.Options.ConfigurationExtensions": {
"type": "Transitive",
"resolved": "10.0.13",
"contentHash": "xVO5HhATc09WXuS/RaDmx8ZeWS0mTpT1L0tkEDMSBHtAnNpNsDr0ge0wIO2jinCWWqpq5dL1tRTzpYNVlvyqLw==",
"resolved": "10.0.14",
"contentHash": "4wcIU0rE04ejEfCwHTftu9O8fgH6CRYCe+tseRapikUBn1Kic3QdO7ku22SwFyLrzdWGYPUZMEgv57ZYuuc5gA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
"Microsoft.Extensions.Configuration.Binder": "10.0.13",
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
"Microsoft.Extensions.Options": "10.0.13",
"Microsoft.Extensions.Primitives": "10.0.13"
"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.13",
"contentHash": "ZjTwxzhiw2TMEzIbUDkMF0dfDB2I4NQgIfKD0ELu9/5Mk+SRGdKZcD0/lvBrRCAPo6KN2r0BW86MRancoyJkoA=="
"resolved": "10.0.14",
"contentHash": "1bbZqqCJTPba3inTADExbp/9PsGVyvGOX3zr6tFr7ySCgVkX9Lpw7BV0TizktNItd3SsbUu1sQfSAYm1GZMoNw=="
},
"SharpGen.Runtime": {
"type": "Transitive",
@@ -324,8 +324,8 @@
},
"SkiaSharp.NativeAssets.Win32": {
"type": "Transitive",
"resolved": "4.153.1",
"contentHash": "Yqg6rChTVh0BUE8QQxtOA3uUBnihfgID4yex/AvDa0+os2bVcBjmI3Qj9tnOB+R1hd/Jry1Gwl8qw5JI9HZG8Q=="
"resolved": "4.154.0",
"contentHash": "GXgoY77GCXdPcveNAmy8o3gVit8sp6YtnI88h5camLPfihjulwJUajZXKhgVuZ8RhuwSTgfyt/00Dx8HRUSeAA=="
},
"Vortice.DirectX": {
"type": "Transitive",
@@ -350,16 +350,16 @@
"captureimage.core": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )"
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
}
},
"captureimage.infrastructure": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.0.1, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )",
"CaptureImage.Core": "[2.0.3, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )",
"Serilog": "[4.4.0, )",
"SkiaSharp": "[4.153.1, )",
"SkiaSharp": "[4.154.0, )",
"Velopack": "[1.2.161, )",
"Vortice.DXGI": "[3.8.3, )",
"Vortice.Direct2D1": "[3.8.3, )",
@@ -369,22 +369,22 @@
"captureimage.ui": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.0.1, )",
"CaptureImage.ViewModels": "[2.0.1, )",
"CaptureImage.Core": "[2.0.3, )",
"CaptureImage.ViewModels": "[2.0.3, )",
"CommunityToolkit.Mvvm": "[8.4.2, )",
"H.NotifyIcon.Wpf": "[2.4.1, )",
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.13, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )",
"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.0.1, )",
"CaptureImage.Core": "[2.0.3, )",
"CommunityToolkit.Mvvm": "[8.4.2, )",
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.13, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )"
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.14, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
}
},
"H.NotifyIcon.Wpf": {
@@ -398,46 +398,46 @@
},
"Microsoft.Extensions.DependencyInjection": {
"type": "CentralTransitive",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "4tnWU9vrU/A8NwYe9Z6wvieZ0EBb/uM82LAT+edNhdepOBWREZ7M7mzb941EIDPJaeOFdbVrDd5+7s9e89U6bQ==",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "2LzcuVjemeXR+WdY9wGIr8iGb7fYsDAit+IScxXX2XJnX0b++mWcE/WO6fEGIqhdMfSQM2ZS5JGMHYZix7YXZg==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14"
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "CentralTransitive",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "G2GrGWNAPZBsii2F6AU8n+JT2tC1/I0Ml/e9ZyNCgPjf3hZqronP7o0X91aAynCmVeae8KkSIUNXXeXCNRmdVQ=="
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "QtpQzuSZVyTPCuHW058yCs9Nj0394uUkNyFHS813nOmK9UgUdBdaprJ5PPsBgsQIpxADTsTkbaMMonykem6qdw=="
},
"Microsoft.Extensions.Logging": {
"type": "CentralTransitive",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "fqbiPy4nUp4H2XHKAVQXKN2y3T2h4cFIx1DAAgE6iY9OHkN/OA1cKFi+geJKRWGuX6pS5SFbsjIPWHJqrxE0eg==",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "O2fXL6JmtkFwkigxS8fPTQpLXxGDjgZco5D+h88s++Cl0bDCs023PVkpNoifciJ+f30I82jnp8tpwF0wCLdFtA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "10.0.13",
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
"Microsoft.Extensions.Options": "10.0.13"
"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.13, )",
"resolved": "10.0.13",
"contentHash": "aSZEhEig4fvNiw2zs8Z6NyDlniKtq6YjcF3DyHuqTEHcZ2VKA/6itMPZ+dW+yWABWExlDcQwwdbqX1Rcb7W8WQ==",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "SwcbEBtkECq3D2oywvHkm46fyrX9Dd2JPWphDnHUc2+cUWR1Mdo41atAjh/9iZjgQxuvbKfZKXqostT/LZfefA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14"
}
},
"SkiaSharp": {
"type": "CentralTransitive",
"requested": "[4.153.1, )",
"resolved": "4.153.1",
"contentHash": "TghYLOUaP3q6rTjQw7U9uQaaXh8lEs9rfA1U7/VtmyAptVDtj/SmjtcWzFWmcC/VMWxe3QgbV9uyvqDL7ySFtQ==",
"requested": "[4.154.0, )",
"resolved": "4.154.0",
"contentHash": "R3BuszJ3tUFmni37nZIRawXL0yx+XHyx7xi1716/0TybuEQFhnBx48Ig3rFpeVFQVytpGpJZZ+NLW9d9UPG7EA==",
"dependencies": {
"SkiaSharp.NativeAssets.Win32": "4.153.1"
"SkiaSharp.NativeAssets.Win32": "4.154.0"
}
},
"Vortice.Direct2D1": {
@@ -483,8 +483,8 @@
"net10.0-windows10.0.22621/win-x64": {
"SkiaSharp.NativeAssets.Win32": {
"type": "Transitive",
"resolved": "4.153.1",
"contentHash": "Yqg6rChTVh0BUE8QQxtOA3uUBnihfgID4yex/AvDa0+os2bVcBjmI3Qj9tnOB+R1hd/Jry1Gwl8qw5JI9HZG8Q=="
"resolved": "4.154.0",
"contentHash": "GXgoY77GCXdPcveNAmy8o3gVit8sp6YtnI88h5camLPfihjulwJUajZXKhgVuZ8RhuwSTgfyt/00Dx8HRUSeAA=="
}
}
}
@@ -166,7 +166,7 @@ public sealed partial class CaptureCoordinator : IDisposable
}
// While suspended (hotkey recorder open) only remember the request; resuming registers.
IReadOnlyList<HotkeyRegistration> registrations = suspended ? [] : _hotkeys.Activate(hotkeys);
var registrations = suspended ? [] : _hotkeys.Activate(hotkeys);
lock (_gate)
{
_armed = true;
@@ -36,20 +36,16 @@ public sealed record SaveRequest(
/// overwriting an existing file (a name stolen by a concurrent write is retried).
/// Encoding runs on the thread pool so callers on the UI thread never block.
/// </summary>
public sealed partial class CaptureFileWriter
public sealed partial class CaptureFileWriter(
IEnumerable<IImageEncoder> encoders,
FileNameStrategy fileNames,
ILogger<CaptureFileWriter> logger)
{
private const int MaxNameAttempts = 8;
private readonly IReadOnlyList<IImageEncoder> _encoders;
private readonly FileNameStrategy _fileNames;
private readonly ILogger<CaptureFileWriter> _logger;
public CaptureFileWriter(IEnumerable<IImageEncoder> encoders, FileNameStrategy fileNames, ILogger<CaptureFileWriter> logger)
{
_encoders = [.. encoders];
_fileNames = fileNames;
_logger = logger;
}
private readonly IReadOnlyList<IImageEncoder> _encoders = [.. encoders];
private readonly FileNameStrategy _fileNames = fileNames;
private readonly ILogger<CaptureFileWriter> _logger = logger;
public async Task<CaptureRecord> SaveAsync(SaveRequest request, CancellationToken cancellationToken = default)
{
@@ -21,7 +21,8 @@ namespace CaptureImage.Core.Pipeline;
/// reserved device names (CON, NUL, COM1…) get a trailing <c>_</c>; the name is capped at
/// <see cref="MaxNameLength"/> characters.</para>
/// </remarks>
public sealed class FileNameStrategy
/// <param name="fileExists">Existence check (injected so tests can fake collisions).</param>
public sealed class FileNameStrategy(Func<string, bool> fileExists)
{
/// <summary>Default template: <c>{Game}_{yyyy}-{MM}-{dd}_{HH}-{mm}-{ss}</c>.</summary>
public const string DefaultTemplate = "{Game}_{yyyy}-{MM}-{dd}_{HH}-{mm}-{ss}";
@@ -42,13 +43,7 @@ public sealed class FileNameStrategy
"COM¹", "COM²", "COM³", "LPT¹", "LPT²", "LPT³",
};
private readonly Func<string, bool> _fileExists;
/// <param name="fileExists">Existence check (injected so tests can fake collisions).</param>
public FileNameStrategy(Func<string, bool> fileExists)
{
_fileExists = fileExists;
}
private readonly Func<string, bool> _fileExists = fileExists;
/// <summary>
/// A full path under <paramref name="directory"/> that does not collide with an existing
+7 -7
View File
@@ -4,18 +4,18 @@
"net10.0": {
"Microsoft.Extensions.Logging.Abstractions": {
"type": "Direct",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "aSZEhEig4fvNiw2zs8Z6NyDlniKtq6YjcF3DyHuqTEHcZ2VKA/6itMPZ+dW+yWABWExlDcQwwdbqX1Rcb7W8WQ==",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "SwcbEBtkECq3D2oywvHkm46fyrX9Dd2JPWphDnHUc2+cUWR1Mdo41atAjh/9iZjgQxuvbKfZKXqostT/LZfefA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14"
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "CentralTransitive",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "G2GrGWNAPZBsii2F6AU8n+JT2tC1/I0Ml/e9ZyNCgPjf3hZqronP7o0X91aAynCmVeae8KkSIUNXXeXCNRmdVQ=="
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "QtpQzuSZVyTPCuHW058yCs9Nj0394uUkNyFHS813nOmK9UgUdBdaprJ5PPsBgsQIpxADTsTkbaMMonykem6qdw=="
}
},
"net10.0/win-x64": {}
@@ -13,18 +13,13 @@ namespace CaptureImage.Infrastructure.Capture;
/// GPU reset or driver update the engine calls <see cref="Invalidate"/> and the next capture
/// gets a fresh device (v1 never recreated it, so every capture failed until restart).
/// </summary>
public sealed partial class D3D11DeviceManager : IDisposable
public sealed partial class D3D11DeviceManager(ILogger<D3D11DeviceManager> logger) : IDisposable
{
private readonly ILogger<D3D11DeviceManager> _logger;
private readonly ILogger<D3D11DeviceManager> _logger = logger;
private readonly Lock _gate = new();
private Session? _session;
private bool _disposed;
public D3D11DeviceManager(ILogger<D3D11DeviceManager> logger)
{
_logger = logger;
}
/// <summary>The device, its immediate context and the WinRT wrapper WGC needs.</summary>
internal sealed record Session(ID3D11Device Device, ID3D11DeviceContext Context, IDirect3DDevice WinRtDevice) : IDisposable
{
@@ -76,7 +71,7 @@ public sealed partial class D3D11DeviceManager : IDisposable
// usable GPU driver (virtual machines, CI runners).
FeatureLevel[] levels = [FeatureLevel.Level_11_1, FeatureLevel.Level_11_0];
var driver = DriverType.Hardware;
var result = D3D11.D3D11CreateDevice(null, driver, DeviceCreationFlags.BgraSupport, levels, out ID3D11Device device, out ID3D11DeviceContext context);
var result = D3D11.D3D11CreateDevice(null, driver, DeviceCreationFlags.BgraSupport, levels, out var device, out ID3D11DeviceContext context);
if (result.Failure)
{
driver = DriverType.Warp;
@@ -33,20 +33,16 @@ namespace CaptureImage.Infrastructure.Capture;
/// <item>8-bit frames are forced opaque so saved images are never see-through.</item>
/// </list>
/// </remarks>
public sealed partial class WgcCaptureEngine : ICaptureEngine, IDisposable
public sealed partial class WgcCaptureEngine(
D3D11DeviceManager devices,
ILogger<WgcCaptureEngine> logger) : ICaptureEngine, IDisposable
{
private static readonly TimeSpan FrameTimeout = TimeSpan.FromSeconds(3);
private readonly D3D11DeviceManager _devices;
private readonly ILogger<WgcCaptureEngine> _logger;
private readonly D3D11DeviceManager _devices = devices;
private readonly ILogger<WgcCaptureEngine> _logger = logger;
private readonly SemaphoreSlim _gate = new(1, 1);
public WgcCaptureEngine(D3D11DeviceManager devices, ILogger<WgcCaptureEngine> logger)
{
_devices = devices;
_logger = logger;
}
public async Task<CapturedFrame> CaptureAsync(CaptureSource source, CaptureOptions options, CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(source);
@@ -15,7 +15,7 @@ namespace CaptureImage.Infrastructure.Capture;
/// vtable function pointers so no runtime-callable wrapper is created (v1 leaked one per
/// capture and kept full-size GPU textures alive until the next garbage collection).
/// </summary>
internal static unsafe class WinRtCaptureInterop
internal static unsafe partial class WinRtCaptureInterop
{
private const string GraphicsCaptureItemClass = "Windows.Graphics.Capture.GraphicsCaptureItem";
@@ -85,6 +85,6 @@ internal static unsafe class WinRtCaptureInterop
}
}
[DllImport("d3d11.dll", ExactSpelling = true)]
private static extern int CreateDirect3D11DeviceFromDXGIDevice(nint dxgiDevice, out nint graphicsDevice);
[LibraryImport("d3d11.dll")]
private static partial int CreateDirect3D11DeviceFromDXGIDevice(nint dxgiDevice, out nint graphicsDevice);
}
@@ -18,24 +18,20 @@ namespace CaptureImage.Infrastructure.Diagnostics;
/// system summary (Windows build, .NET, GPUs, monitors with DPI and HDR state). The user's
/// profile path is replaced with <c>%USERPROFILE%</c> in every text file.
/// </summary>
public sealed partial class DiagnosticsExporter : IDiagnosticsExporter
public sealed partial class DiagnosticsExporter(
AppPaths paths,
IDisplayService displays,
IUpdateService updates,
ILogger<DiagnosticsExporter> logger) : IDiagnosticsExporter
{
private const int MaxLogFiles = 5;
private readonly AppPaths _paths;
private readonly IDisplayService _displays;
private readonly IUpdateService _updates;
private readonly ILogger<DiagnosticsExporter> _logger;
private readonly AppPaths _paths = paths;
private readonly IDisplayService _displays = displays;
private readonly IUpdateService _updates = updates;
private readonly ILogger<DiagnosticsExporter> _logger = logger;
private readonly UserPathRedactionEnricher _redactor = new();
public DiagnosticsExporter(AppPaths paths, IDisplayService displays, IUpdateService updates, ILogger<DiagnosticsExporter> logger)
{
_paths = paths;
_displays = displays;
_updates = updates;
_logger = logger;
}
public string SuggestFileName() =>
$"CaptureImage-diagnostics-{DateTime.Now.ToString("yyyyMMdd-HHmmss", CultureInfo.InvariantCulture)}.zip";
@@ -10,16 +10,11 @@ using Vortice.WIC;
namespace CaptureImage.Infrastructure.Imaging;
/// <summary>Decodes PNG / JPEG / WebP / TIFF / JPEG XR files into BGRA frames with WIC.</summary>
public sealed partial class WicImageDecoder : IImageDecoder, IDisposable
public sealed partial class WicImageDecoder(ILogger<WicImageDecoder> logger) : IImageDecoder, IDisposable
{
private readonly ILogger<WicImageDecoder> _logger;
private readonly ILogger<WicImageDecoder> _logger = logger;
private readonly Lazy<IWICImagingFactory> _factory = new(() => new IWICImagingFactory(), LazyThreadSafetyMode.ExecutionAndPublication);
public WicImageDecoder(ILogger<WicImageDecoder> logger)
{
_logger = logger;
}
public Task<CapturedFrame?> LoadAsync(string path, int maxDimension = 0, CancellationToken cancellationToken = default) =>
Task.Run(() => Load(path, maxDimension), cancellationToken);
@@ -21,27 +21,23 @@ namespace CaptureImage.Infrastructure.Library;
/// JPEG thumbnails. Files deleted outside the app drop out on the next read. The first time
/// the index is created, the output folders are scanned so captures made by v1 show up too.
/// </summary>
public sealed partial class CaptureLibraryService : ICaptureLibrary, IDisposable
public sealed partial class CaptureLibraryService(
AppPaths paths,
ISettingsStore settings,
IShellService shell,
ILogger<CaptureLibraryService> logger) : ICaptureLibrary, IDisposable
{
private const int MaxRecords = 2000;
private const int MaxSeededFiles = 500;
private readonly AppPaths _paths;
private readonly ISettingsStore _settings;
private readonly IShellService _shell;
private readonly ILogger<CaptureLibraryService> _logger;
private readonly AppPaths _paths = paths;
private readonly ISettingsStore _settings = settings;
private readonly IShellService _shell = shell;
private readonly ILogger<CaptureLibraryService> _logger = logger;
private readonly SemaphoreSlim _indexLock = new(1, 1);
private readonly Lazy<IWICImagingFactory> _wic = new(() => new IWICImagingFactory(), LazyThreadSafetyMode.ExecutionAndPublication);
private List<CaptureRecord>? _records;
public CaptureLibraryService(AppPaths paths, ISettingsStore settings, IShellService shell, ILogger<CaptureLibraryService> logger)
{
_paths = paths;
_settings = settings;
_shell = shell;
_logger = logger;
}
public event EventHandler? Changed;
public async Task<IReadOnlyList<CaptureRecord>> GetAllAsync(CancellationToken cancellationToken = default)
@@ -9,14 +9,9 @@ using Serilog.Events;
namespace CaptureImage.Infrastructure.Logging;
/// <summary>Changes the live Serilog minimum level (no restart needed).</summary>
public sealed class SerilogLogLevelSwitcher : ILogLevelSwitcher
public sealed class SerilogLogLevelSwitcher(LoggingLevelSwitch levelSwitch) : ILogLevelSwitcher
{
private readonly LoggingLevelSwitch _levelSwitch;
public SerilogLogLevelSwitcher(LoggingLevelSwitch levelSwitch)
{
_levelSwitch = levelSwitch;
}
private readonly LoggingLevelSwitch _levelSwitch = levelSwitch;
public string CurrentLevel => _levelSwitch.MinimumLevel switch
{
@@ -20,16 +20,11 @@ namespace CaptureImage.Infrastructure.Ocr;
/// the engine limit are downscaled, engines are cached per language, and failures are
/// reported as failures instead of "no text found".
/// </summary>
public sealed partial class WindowsOcrService : IOcrService
public sealed partial class WindowsOcrService(ILogger<WindowsOcrService> logger) : IOcrService
{
private readonly ILogger<WindowsOcrService> _logger;
private readonly ILogger<WindowsOcrService> _logger = logger;
private readonly ConcurrentDictionary<string, OcrEngine?> _engines = new(StringComparer.OrdinalIgnoreCase);
public WindowsOcrService(ILogger<WindowsOcrService> logger)
{
_logger = logger;
}
public async Task<OcrResult> RecognizeAsync(CapturedFrame frame, string? languageTag, CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(frame);
@@ -11,7 +11,7 @@ using Windows.Win32.UI.Shell;
namespace CaptureImage.Infrastructure.Platform;
/// <summary>Explorer, default-program and Recycle Bin integration.</summary>
public sealed partial class ShellService : IShellService
public sealed partial class ShellService(ILogger<ShellService> logger) : IShellService
{
private const uint FoDelete = 0x0003;
private const ushort FofSilent = 0x0004;
@@ -22,12 +22,7 @@ public sealed partial class ShellService : IShellService
private static readonly string ExplorerPath =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe");
private readonly ILogger<ShellService> _logger;
public ShellService(ILogger<ShellService> logger)
{
_logger = logger;
}
private readonly ILogger<ShellService> _logger = logger;
public bool Open(string path)
{
@@ -22,18 +22,13 @@ public sealed class SoundService : ISoundService
/// Windows 11 efficiency mode: EcoQoS plus below-normal priority while the app idles in the
/// tray. <see cref="BeginForegroundWork"/> lifts it for the duration of a capture.
/// </summary>
public sealed partial class PerformanceModeService : IPerformanceModeService
public sealed partial class PerformanceModeService(ILogger<PerformanceModeService> logger) : IPerformanceModeService
{
private readonly ILogger<PerformanceModeService> _logger;
private readonly ILogger<PerformanceModeService> _logger = logger;
private readonly Lock _gate = new();
private bool _background;
private int _foregroundWork;
public PerformanceModeService(ILogger<PerformanceModeService> logger)
{
_logger = logger;
}
public void SetBackground(bool isBackground)
{
lock (_gate)
@@ -112,17 +107,12 @@ public sealed partial class PerformanceModeService : IPerformanceModeService
/// "Start with Windows" via the per-user Run key. Points at the Velopack launcher in the
/// install root (stable across updates) when present, otherwise at the running executable.
/// </summary>
public sealed partial class AutostartService : IAutostartService
public sealed partial class AutostartService(ILogger<AutostartService> logger) : IAutostartService
{
private const string RunKey = @"Software\Microsoft\Windows\CurrentVersion\Run";
private const string ValueName = "CaptureImage";
private readonly ILogger<AutostartService> _logger;
public AutostartService(ILogger<AutostartService> logger)
{
_logger = logger;
}
private readonly ILogger<AutostartService> _logger = logger;
public bool IsEnabled
{
@@ -13,13 +13,19 @@ namespace CaptureImage.Infrastructure.Steam;
/// <c>appmanifest_*.acf</c> files of every library. Scanned once, lazily, thread-safe; a scan that
/// fails is retried a minute later rather than failing every lookup from then on.
/// </summary>
public sealed partial class SteamLibraryScanner : ISteamDetector
/// <param name="steamRoot">Returns Steam's install folder, or <c>null</c> when Steam isn't installed.</param>
/// <param name="logger">Logger.</param>
/// <param name="timeProvider">Clock for the retry delay (tests); the system clock by default.</param>
public sealed partial class SteamLibraryScanner(
Func<string?> steamRoot,
ILogger<SteamLibraryScanner> logger,
TimeProvider? timeProvider = null) : ISteamDetector
{
private static readonly TimeSpan RetryDelay = TimeSpan.FromMinutes(1);
private readonly Func<string?> _steamRoot;
private readonly ILogger<SteamLibraryScanner> _logger;
private readonly TimeProvider _time;
private readonly Func<string?> _steamRoot = steamRoot;
private readonly ILogger<SteamLibraryScanner> _logger = logger;
private readonly TimeProvider _time = timeProvider ?? TimeProvider.System;
private readonly Lock _gate = new();
private IReadOnlyList<SteamLibrary>? _libraries;
private DateTimeOffset _retryAt = DateTimeOffset.MinValue;
@@ -30,16 +36,6 @@ public sealed partial class SteamLibraryScanner : ISteamDetector
{
}
/// <param name="steamRoot">Returns Steam's install folder, or <c>null</c> when Steam isn't installed.</param>
/// <param name="logger">Logger.</param>
/// <param name="timeProvider">Clock for the retry delay (tests); the system clock by default.</param>
public SteamLibraryScanner(Func<string?> steamRoot, ILogger<SteamLibraryScanner> logger, TimeProvider? timeProvider = null)
{
_steamRoot = steamRoot;
_logger = logger;
_time = timeProvider ?? TimeProvider.System;
}
/// <summary>The scanned libraries, or none while a failed scan waits for its retry.</summary>
private IReadOnlyList<SteamLibrary> Libraries
{
@@ -119,13 +119,11 @@ public static class VdfParser
}
/// <summary>Cursor over the input text with helpers for quoted strings and trivia.</summary>
private sealed class VdfReader
private sealed class VdfReader(string text)
{
private readonly string _text;
private readonly string _text = text;
private int _pos;
public VdfReader(string text) { _text = text; _pos = 0; }
public int Position => _pos;
public bool Eof => _pos >= _text.Length;
@@ -213,12 +211,7 @@ public static class VdfParser
}
/// <summary>Thrown when a VDF document fails to parse.</summary>
public sealed class VdfParseException : FormatException
public sealed class VdfParseException(string message, int position) : FormatException(message)
{
public int Position { get; }
public VdfParseException(string message, int position) : base(message)
{
Position = position;
}
public int Position { get; } = position;
}
@@ -19,19 +19,14 @@ namespace CaptureImage.Infrastructure.Windowing;
/// DXGI adapter (hybrid-GPU laptops attach outputs to different adapters) and recreates the
/// DXGI factory when Windows reports it stale (HDR toggled, display plugged in).
/// </summary>
public sealed partial class DisplayService : IDisplayService, IDisposable
public sealed partial class DisplayService(ILogger<DisplayService> logger) : IDisplayService, IDisposable
{
private const uint MonitorDefaultToNearest = 2;
private readonly ILogger<DisplayService> _logger;
private readonly ILogger<DisplayService> _logger = logger;
private readonly Lock _gate = new();
private IDXGIFactory1? _factory;
public DisplayService(ILogger<DisplayService> logger)
{
_logger = logger;
}
public IReadOnlyList<MonitorInfo> GetMonitors()
{
var handles = new List<HMONITOR>(4);
@@ -16,22 +16,17 @@ namespace CaptureImage.Infrastructure.Windowing;
/// file when it has none. Results (including failures) are cached per path in a bounded
/// least-recently-used cache, so long sessions don't grow without limit.
/// </summary>
public sealed partial class IconExtractor : IDisposable
public sealed partial class IconExtractor(ILogger<IconExtractor> logger) : IDisposable
{
private const int Capacity = 256;
private const uint IconSize = 48;
private readonly ILogger<IconExtractor> _logger;
private readonly ILogger<IconExtractor> _logger = logger;
private readonly Lock _gate = new();
private readonly Dictionary<string, LinkedListNode<(string Path, byte[]? Png)>> _index = new(StringComparer.OrdinalIgnoreCase);
private readonly LinkedList<(string Path, byte[]? Png)> _order = new();
private readonly Lazy<IWICImagingFactory> _factory = new(() => new IWICImagingFactory(), LazyThreadSafetyMode.ExecutionAndPublication);
public IconExtractor(ILogger<IconExtractor> logger)
{
_logger = logger;
}
public byte[]? TryGetIconPngBytes(string executablePath)
{
if (string.IsNullOrWhiteSpace(executablePath))
@@ -21,25 +21,21 @@ namespace CaptureImage.Infrastructure.Windowing;
/// also works for elevated processes (v1 used <c>Process.MainModule</c>, which throws for
/// games running as administrator and left them without icon or Steam badge).
/// </summary>
public sealed unsafe partial class TargetCatalog : ITargetCatalog
public sealed unsafe partial class TargetCatalog(
IconExtractor icons,
ISteamDetector steam,
ILogger<TargetCatalog> logger) : ITargetCatalog
{
private static readonly HashSet<string> ShellWindowClasses = new(StringComparer.Ordinal)
{
"Progman", "WorkerW", "Shell_TrayWnd", "Shell_SecondaryTrayWnd", "Windows.UI.Core.CoreWindow",
};
private readonly IconExtractor _icons;
private readonly ISteamDetector _steam;
private readonly ILogger<TargetCatalog> _logger;
private readonly IconExtractor _icons = icons;
private readonly ISteamDetector _steam = steam;
private readonly ILogger<TargetCatalog> _logger = logger;
private readonly uint _ownProcessId = (uint)Environment.ProcessId;
public TargetCatalog(IconExtractor icons, ISteamDetector steam, ILogger<TargetCatalog> logger)
{
_icons = icons;
_steam = steam;
_logger = logger;
}
public Task<IReadOnlyList<GameTarget>> EnumerateAsync(CancellationToken cancellationToken = default) =>
Task.Run<IReadOnlyList<GameTarget>>(() =>
{
@@ -4,21 +4,21 @@
"net10.0-windows10.0.22621": {
"Microsoft.Extensions.Logging.Abstractions": {
"type": "Direct",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "aSZEhEig4fvNiw2zs8Z6NyDlniKtq6YjcF3DyHuqTEHcZ2VKA/6itMPZ+dW+yWABWExlDcQwwdbqX1Rcb7W8WQ==",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "SwcbEBtkECq3D2oywvHkm46fyrX9Dd2JPWphDnHUc2+cUWR1Mdo41atAjh/9iZjgQxuvbKfZKXqostT/LZfefA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14"
}
},
"Microsoft.Windows.CsWin32": {
"type": "Direct",
"requested": "[0.3.363, )",
"resolved": "0.3.363",
"contentHash": "Fd1p6Fr5H6A+c4FO033CojR8jKsvYZm6vigrKvB/auI40KXb0Vb+ge0F6baGBZptc1yIKVxmh/Iu8/KvLVQ94A==",
"requested": "[0.3.367, )",
"resolved": "0.3.367",
"contentHash": "C4JVE3wmVjCvzpdBzC+HK/boVU6g4ZRDEZ7uDmMJHCkgjFHhiMb9vhe2+wffzWzyNNObpCsIAW4G1t+1CAIEWw==",
"dependencies": {
"Microsoft.Windows.SDK.Win32Docs": "0.1.42-alpha",
"Microsoft.Windows.SDK.Win32Metadata": "71.0.30-preview",
"Microsoft.Windows.SDK.Win32Metadata": "71.0.37-preview",
"Microsoft.Windows.WDK.Win32Metadata": "0.13.25-experimental"
}
},
@@ -30,11 +30,11 @@
},
"SkiaSharp": {
"type": "Direct",
"requested": "[4.153.1, )",
"resolved": "4.153.1",
"contentHash": "TghYLOUaP3q6rTjQw7U9uQaaXh8lEs9rfA1U7/VtmyAptVDtj/SmjtcWzFWmcC/VMWxe3QgbV9uyvqDL7ySFtQ==",
"requested": "[4.154.0, )",
"resolved": "4.154.0",
"contentHash": "R3BuszJ3tUFmni37nZIRawXL0yx+XHyx7xi1716/0TybuEQFhnBx48Ig3rFpeVFQVytpGpJZZ+NLW9d9UPG7EA==",
"dependencies": {
"SkiaSharp.NativeAssets.Win32": "4.153.1"
"SkiaSharp.NativeAssets.Win32": "4.154.0"
}
},
"Velopack": {
@@ -80,8 +80,8 @@
},
"Microsoft.Windows.SDK.Win32Metadata": {
"type": "Transitive",
"resolved": "71.0.30-preview",
"contentHash": "h/FD+SrIlxgr+HD/WrJnLvpTdyWFAX7F0FCMPRxPJFTt4Qz70wGXKEBZvvIDX7om4hP0Tb7O0s1ND3aUvigL8g=="
"resolved": "71.0.37-preview",
"contentHash": "0y4uKnOzE+k2zUCxcTOJTOuRuOFiW01A+j1GpjyN11saEjkESLW9XrWkGYG/zdlAAb8oRk4oLdokkcx0X2z7yA=="
},
"Microsoft.Windows.WDK.Win32Metadata": {
"type": "Transitive",
@@ -106,8 +106,8 @@
},
"SkiaSharp.NativeAssets.Win32": {
"type": "Transitive",
"resolved": "4.153.1",
"contentHash": "Yqg6rChTVh0BUE8QQxtOA3uUBnihfgID4yex/AvDa0+os2bVcBjmI3Qj9tnOB+R1hd/Jry1Gwl8qw5JI9HZG8Q=="
"resolved": "4.154.0",
"contentHash": "GXgoY77GCXdPcveNAmy8o3gVit8sp6YtnI88h5camLPfihjulwJUajZXKhgVuZ8RhuwSTgfyt/00Dx8HRUSeAA=="
},
"Vortice.DirectX": {
"type": "Transitive",
@@ -127,21 +127,21 @@
"captureimage.core": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )"
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "CentralTransitive",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "G2GrGWNAPZBsii2F6AU8n+JT2tC1/I0Ml/e9ZyNCgPjf3hZqronP7o0X91aAynCmVeae8KkSIUNXXeXCNRmdVQ=="
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "QtpQzuSZVyTPCuHW058yCs9Nj0394uUkNyFHS813nOmK9UgUdBdaprJ5PPsBgsQIpxADTsTkbaMMonykem6qdw=="
}
},
"net10.0-windows10.0.22621/win-x64": {
"SkiaSharp.NativeAssets.Win32": {
"type": "Transitive",
"resolved": "4.153.1",
"contentHash": "Yqg6rChTVh0BUE8QQxtOA3uUBnihfgID4yex/AvDa0+os2bVcBjmI3Qj9tnOB+R1hd/Jry1Gwl8qw5JI9HZG8Q=="
"resolved": "4.154.0",
"contentHash": "GXgoY77GCXdPcveNAmy8o3gVit8sp6YtnI88h5camLPfihjulwJUajZXKhgVuZ8RhuwSTgfyt/00Dx8HRUSeAA=="
}
}
}
+1 -1
View File
@@ -72,7 +72,7 @@ public sealed class InverseBoolConverter : IValueConverter
/// <summary>PNG bytes (window icons) → image, cached per byte array.</summary>
public sealed class BytesToImageConverter : IValueConverter
{
private static readonly ConditionalWeakTable<byte[], BitmapImage> Cache = new();
private static readonly ConditionalWeakTable<byte[], BitmapImage> Cache = [];
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
+17 -17
View File
@@ -19,27 +19,27 @@
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Direct",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "G2GrGWNAPZBsii2F6AU8n+JT2tC1/I0Ml/e9ZyNCgPjf3hZqronP7o0X91aAynCmVeae8KkSIUNXXeXCNRmdVQ=="
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "QtpQzuSZVyTPCuHW058yCs9Nj0394uUkNyFHS813nOmK9UgUdBdaprJ5PPsBgsQIpxADTsTkbaMMonykem6qdw=="
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "Direct",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "aSZEhEig4fvNiw2zs8Z6NyDlniKtq6YjcF3DyHuqTEHcZ2VKA/6itMPZ+dW+yWABWExlDcQwwdbqX1Rcb7W8WQ==",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "SwcbEBtkECq3D2oywvHkm46fyrX9Dd2JPWphDnHUc2+cUWR1Mdo41atAjh/9iZjgQxuvbKfZKXqostT/LZfefA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14"
}
},
"Microsoft.Windows.CsWin32": {
"type": "Direct",
"requested": "[0.3.363, )",
"resolved": "0.3.363",
"contentHash": "Fd1p6Fr5H6A+c4FO033CojR8jKsvYZm6vigrKvB/auI40KXb0Vb+ge0F6baGBZptc1yIKVxmh/Iu8/KvLVQ94A==",
"requested": "[0.3.367, )",
"resolved": "0.3.367",
"contentHash": "C4JVE3wmVjCvzpdBzC+HK/boVU6g4ZRDEZ7uDmMJHCkgjFHhiMb9vhe2+wffzWzyNNObpCsIAW4G1t+1CAIEWw==",
"dependencies": {
"Microsoft.Windows.SDK.Win32Docs": "0.1.42-alpha",
"Microsoft.Windows.SDK.Win32Metadata": "71.0.30-preview",
"Microsoft.Windows.SDK.Win32Metadata": "71.0.37-preview",
"Microsoft.Windows.WDK.Win32Metadata": "0.13.25-experimental"
}
},
@@ -72,8 +72,8 @@
},
"Microsoft.Windows.SDK.Win32Metadata": {
"type": "Transitive",
"resolved": "71.0.30-preview",
"contentHash": "h/FD+SrIlxgr+HD/WrJnLvpTdyWFAX7F0FCMPRxPJFTt4Qz70wGXKEBZvvIDX7om4hP0Tb7O0s1ND3aUvigL8g=="
"resolved": "71.0.37-preview",
"contentHash": "0y4uKnOzE+k2zUCxcTOJTOuRuOFiW01A+j1GpjyN11saEjkESLW9XrWkGYG/zdlAAb8oRk4oLdokkcx0X2z7yA=="
},
"Microsoft.Windows.WDK.Win32Metadata": {
"type": "Transitive",
@@ -91,16 +91,16 @@
"captureimage.core": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )"
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
}
},
"captureimage.viewmodels": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.0.1, )",
"CaptureImage.Core": "[2.0.3, )",
"CommunityToolkit.Mvvm": "[8.4.2, )",
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.13, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )"
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.14, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
}
}
},
@@ -17,25 +17,21 @@ public sealed record SponsorLink(string Name, Uri Url);
/// <summary>
/// About page: version, contact, links, sponsors, legal documents and third-party notices.
/// </summary>
public sealed partial class AboutViewModel : ViewModelBase
public sealed partial class AboutViewModel(
IShellService shell,
ILocalizationService localization,
AppInfo appInfo) : ViewModelBase
{
public const string RepositoryUrl = "https://github.com/poli0981/captureimg";
public const string ContactEmail = "contact@poli0981.dev";
public const string SponsorEmail = "sponsor@poli0981.dev";
public const string LinksPageUrl = "https://poli0981.dev/links";
private readonly IShellService _shell;
private readonly IShellService _shell = shell;
public AboutViewModel(IShellService shell, ILocalizationService localization, AppInfo appInfo)
{
_shell = shell;
Localization = localization;
AppInfo = appInfo;
}
public ILocalizationService Localization { get; } = localization;
public ILocalizationService Localization { get; }
public AppInfo AppInfo { get; }
public AppInfo AppInfo { get; } = appInfo;
public string AppName => "CaptureImage";
@@ -78,30 +78,30 @@ public sealed partial class DashboardViewModel : ViewModelBase, IDisposable
public ObservableCollection<HotkeyStatusItem> Hotkeys { get; } = [];
[ObservableProperty]
private string _searchText = string.Empty;
public partial string SearchText { get; set; } = string.Empty;
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(CaptureSelectedCommand), nameof(LockSelectedCommand), nameof(CreateProfileCommand))]
private TargetItemViewModel? _selectedTarget;
public partial TargetItemViewModel? SelectedTarget { get; set; }
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(HasNoTargets))]
private bool _isLoading;
public partial bool IsLoading { get; set; }
[ObservableProperty]
private bool _isArmed;
public partial bool IsArmed { get; set; }
[ObservableProperty]
private bool _isBusy;
public partial bool IsBusy { get; set; }
[ObservableProperty]
private string _statusText = string.Empty;
public partial string StatusText { get; set; } = string.Empty;
[ObservableProperty]
private string? _lockedTargetName;
public partial string? LockedTargetName { get; set; }
[ObservableProperty]
private bool _hasHotkeyProblem;
public partial bool HasHotkeyProblem { get; set; }
public bool HasNoTargets => !IsLoading && Targets.Count == 0;
@@ -8,24 +8,18 @@ using CommunityToolkit.Mvvm.ComponentModel;
namespace CaptureImage.ViewModels.Dashboard;
/// <summary>One capturable window in the Dashboard list. Updated in place on refresh.</summary>
public sealed partial class TargetItemViewModel : ViewModelBase
public sealed partial class TargetItemViewModel(GameTarget target, ILocalizationService localization) : ViewModelBase
{
private readonly ILocalizationService _localization;
private readonly ILocalizationService _localization = localization;
[ObservableProperty]
private GameTarget _target;
public partial GameTarget Target { get; set; } = target;
[ObservableProperty]
private string? _profileName;
public partial string? ProfileName { get; set; }
[ObservableProperty]
private bool _isLocked;
public TargetItemViewModel(GameTarget target, ILocalizationService localization)
{
_target = target;
_localization = localization;
}
public partial bool IsLocked { get; set; }
public nint WindowHandle => Target.WindowHandle;
@@ -15,20 +15,14 @@ using Microsoft.Extensions.Logging;
namespace CaptureImage.ViewModels.Library;
/// <summary>One saved capture in the Library grid. The thumbnail loads the first time the view asks for it.</summary>
public sealed partial class CaptureItemViewModel : ViewModelBase
public sealed partial class CaptureItemViewModel(CaptureRecord record, ICaptureLibrary library) : ViewModelBase
{
private const int ThumbnailSize = 320;
private readonly ICaptureLibrary _library;
private readonly ICaptureLibrary _library = library;
private bool _thumbnailRequested;
private string? _thumbnailPath;
public CaptureItemViewModel(CaptureRecord record, ICaptureLibrary library)
{
Record = record;
_library = library;
}
public CaptureRecord Record { get; }
public CaptureRecord Record { get; } = record;
public string FileName => Record.FileName;
@@ -130,25 +124,25 @@ public sealed partial class LibraryViewModel : ViewModelBase, IDisposable
public ObservableCollection<string> Games { get; } = [];
[ObservableProperty]
private string _searchText = string.Empty;
public partial string SearchText { get; set; } = string.Empty;
[ObservableProperty]
private string? _selectedGame;
public partial string? SelectedGame { get; set; }
[ObservableProperty]
private bool _hdrOnly;
public partial bool HdrOnly { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(OpenCommand), nameof(RevealCommand), nameof(CopyImageCommand), nameof(CopyPathCommand),
nameof(ExtractTextCommand), nameof(PinCommand), nameof(DeleteCommand), nameof(OpenHdrCommand))]
private CaptureItemViewModel? _selectedItem;
public partial CaptureItemViewModel? SelectedItem { get; set; }
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsEmpty))]
private bool _isLoading;
public partial bool IsLoading { get; set; }
[ObservableProperty]
private string _summaryText = string.Empty;
public partial string SummaryText { get; set; } = string.Empty;
public bool IsEmpty => !IsLoading && Items.Count == 0;
@@ -15,7 +15,7 @@ namespace CaptureImage.ViewModels.Localization;
/// this assembly. Drives live culture switching: XAML binds to the indexer, and every
/// change raises <c>PropertyChanged("Item[]")</c> so all bindings refresh in place.
/// </summary>
public sealed partial class ResxLocalizationService : ILocalizationService
public sealed partial class ResxLocalizationService(ILogger<ResxLocalizationService> logger) : ILocalizationService
{
private const string ResourceBaseName = "CaptureImage.ViewModels.Resources.Strings.Strings";
@@ -34,8 +34,8 @@ public sealed partial class ResxLocalizationService : ILocalizationService
new("ru-RU"),
};
private readonly ResourceManager _resourceManager;
private readonly ILogger<ResxLocalizationService> _logger;
private readonly ResourceManager _resourceManager = new(ResourceBaseName, typeof(ResxLocalizationService).Assembly);
private readonly ILogger<ResxLocalizationService> _logger = logger;
/// <summary>
/// Tracks <c>(culture, key)</c> pairs we've already logged a "missing string" warning for.
@@ -44,14 +44,7 @@ public sealed partial class ResxLocalizationService : ILocalizationService
/// </summary>
private readonly ConcurrentDictionary<string, byte> _loggedMissingKeys = new();
private CultureInfo _currentCulture;
public ResxLocalizationService(ILogger<ResxLocalizationService> logger)
{
_resourceManager = new ResourceManager(ResourceBaseName, typeof(ResxLocalizationService).Assembly);
_currentCulture = CultureInfo.GetCultureInfo("en-US");
_logger = logger;
}
private CultureInfo _currentCulture = CultureInfo.GetCultureInfo("en-US");
public event PropertyChangedEventHandler? PropertyChanged;
public event EventHandler? CultureChanged;
@@ -82,17 +82,17 @@ public sealed partial class LogViewerViewModel : ViewModelBase, IDisposable
public IReadOnlyList<LocalizedOption<LogEntryLevel>> LevelOptions { get; }
[ObservableProperty]
private LogEntryLevel _minimumLevel = LogEntryLevel.Verbose;
public partial LogEntryLevel MinimumLevel { get; set; } = LogEntryLevel.Verbose;
[ObservableProperty]
private string _searchText = string.Empty;
public partial string SearchText { get; set; } = string.Empty;
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(CopySelectedCommand))]
private LogEntry? _selectedEntry;
public partial LogEntry? SelectedEntry { get; set; }
[ObservableProperty]
private bool _isPaused;
public partial bool IsPaused { get; set; }
/// <summary>Set by the view; the list only tracks the buffer while the page is visible.</summary>
public bool IsPageActive
@@ -13,34 +13,24 @@ namespace CaptureImage.ViewModels.Preview;
/// "Save this capture?" window. <see cref="Result"/> completes with <c>true</c> (save) or
/// <c>false</c> (discard — also when the window is closed).
/// </summary>
public sealed partial class PreviewViewModel : ViewModelBase
public sealed partial class PreviewViewModel(
CapturedFrame frame,
string title,
IOcrService ocr,
IClipboardService clipboard,
IToastService toasts,
ILocalizationService localization) : ViewModelBase
{
private readonly IOcrService _ocr;
private readonly IClipboardService _clipboard;
private readonly IToastService _toasts;
private readonly IOcrService _ocr = ocr;
private readonly IClipboardService _clipboard = clipboard;
private readonly IToastService _toasts = toasts;
private readonly TaskCompletionSource<bool> _result = new(TaskCreationOptions.RunContinuationsAsynchronously);
public PreviewViewModel(
CapturedFrame frame,
string title,
IOcrService ocr,
IClipboardService clipboard,
IToastService toasts,
ILocalizationService localization)
{
Frame = frame;
Title = title;
_ocr = ocr;
_clipboard = clipboard;
_toasts = toasts;
Localization = localization;
}
public ILocalizationService Localization { get; } = localization;
public ILocalizationService Localization { get; }
public CapturedFrame Frame { get; } = frame;
public CapturedFrame Frame { get; }
public string Title { get; }
public string Title { get; } = title;
public string Dimensions => $"{Frame.Width} × {Frame.Height}";
@@ -48,7 +38,7 @@ public sealed partial class PreviewViewModel : ViewModelBase
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(ExtractTextCommand))]
private bool _isRecognizing;
public partial bool IsRecognizing { get; set; }
[RelayCommand]
private void Save() => _result.TrySetResult(true);
@@ -15,16 +15,11 @@ using CommunityToolkit.Mvvm.Messaging;
namespace CaptureImage.ViewModels.Profiles;
/// <summary>One game profile in the list.</summary>
public sealed partial class ProfileItemViewModel : ViewModelBase
public sealed partial class ProfileItemViewModel(GameProfile profile) : ViewModelBase
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(Name), nameof(MatchSummary), nameof(Enabled), nameof(AutoArm))]
private GameProfile _profile;
public ProfileItemViewModel(GameProfile profile)
{
_profile = profile;
}
public partial GameProfile Profile { get; set; } = profile;
public string Id => Profile.Id;
@@ -104,43 +99,43 @@ public sealed partial class ProfilesViewModel : ViewModelBase, IRecipient<Create
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(HasSelection))]
[NotifyCanExecuteChangedFor(nameof(DeleteCommand), nameof(BrowseExecutableCommand), nameof(BrowseOutputFolderCommand), nameof(ClearOutputFolderCommand))]
private ProfileItemViewModel? _selectedProfile;
public partial ProfileItemViewModel? SelectedProfile { get; set; }
[ObservableProperty]
private string _name = string.Empty;
public partial string Name { get; set; } = string.Empty;
[ObservableProperty]
private bool _enabled = true;
public partial bool Enabled { get; set; } = true;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(MatchesNothing))]
private string _executablePath = string.Empty;
public partial string ExecutablePath { get; set; } = string.Empty;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(MatchesNothing))]
private string _executableName = string.Empty;
public partial string ExecutableName { get; set; } = string.Empty;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(MatchesNothing), nameof(SteamAppIdInvalid))]
private string _steamAppId = string.Empty;
public partial string SteamAppId { get; set; } = string.Empty;
[ObservableProperty]
private string _outputDirectory = string.Empty;
public partial string OutputDirectory { get; set; } = string.Empty;
[ObservableProperty]
private string _format = string.Empty;
public partial string Format { get; set; } = string.Empty;
[ObservableProperty]
private string _fileNameTemplate = string.Empty;
public partial string FileNameTemplate { get; set; } = string.Empty;
[ObservableProperty]
private string _hdrMode = string.Empty;
public partial string HdrMode { get; set; } = string.Empty;
[ObservableProperty]
private bool _autoArm;
public partial bool AutoArm { get; set; }
[ObservableProperty]
private bool _lockTarget = true;
public partial bool LockTarget { get; set; } = true;
public bool HasSelection => SelectedProfile is not null;
@@ -15,31 +15,21 @@ namespace CaptureImage.ViewModels.Settings;
/// capture hotkeys are released while recording so the combination reaches the recorder),
/// and rejects invalid, duplicate or already-taken combinations with a message.
/// </summary>
public sealed partial class HotkeyBindingViewModel : ViewModelBase
public sealed partial class HotkeyBindingViewModel(
CaptureMode mode,
ISettingsStore settings,
CaptureCoordinator coordinator,
IHotkeyService hotkeys,
ILocalizationService localization) : ViewModelBase
{
private readonly ISettingsStore _settings;
private readonly CaptureCoordinator _coordinator;
private readonly IHotkeyService _hotkeys;
private readonly ISettingsStore _settings = settings;
private readonly CaptureCoordinator _coordinator = coordinator;
private readonly IHotkeyService _hotkeys = hotkeys;
private IDisposable? _suspension;
public HotkeyBindingViewModel(
CaptureMode mode,
ISettingsStore settings,
CaptureCoordinator coordinator,
IHotkeyService hotkeys,
ILocalizationService localization)
{
Mode = mode;
_settings = settings;
_coordinator = coordinator;
_hotkeys = hotkeys;
Localization = localization;
_binding = settings.Current.Hotkeys.Get(mode);
}
public ILocalizationService Localization { get; } = localization;
public ILocalizationService Localization { get; }
public CaptureMode Mode { get; }
public CaptureMode Mode { get; } = mode;
public string ModeName => Localization[$"Mode_{Mode}"];
@@ -47,17 +37,17 @@ public sealed partial class HotkeyBindingViewModel : ViewModelBase
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(DisplayText), nameof(IsDefault))]
private HotkeyBinding _binding;
public partial HotkeyBinding Binding { get; set; } = settings.Current.Hotkeys.Get(mode);
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(DisplayText))]
private bool _isRecording;
public partial bool IsRecording { get; set; }
[ObservableProperty]
private string _message = string.Empty;
public partial string Message { get; set; } = string.Empty;
[ObservableProperty]
private bool _hasError;
public partial bool HasError { get; set; }
public string DisplayText => IsRecording
? Localization["Hotkey_PressKeys"]
@@ -136,46 +136,46 @@ public sealed partial class SettingsViewModel : ViewModelBase, IDisposable
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsJpeg), nameof(IsWebp), nameof(IsPng), nameof(FileNamePreview))]
private ImageFormat _defaultFormat;
public partial ImageFormat DefaultFormat { get; set; }
[ObservableProperty]
private int _jpegQuality;
public partial int JpegQuality { get; set; }
[ObservableProperty]
private int _webpQuality;
public partial int WebpQuality { get; set; }
[ObservableProperty]
private string _pngCompression = "Balanced";
public partial string PngCompression { get; set; } = "Balanced";
/// <summary>Configured folder; empty means <see cref="DefaultOutputDirectory"/>.</summary>
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(EffectiveOutputDirectory), nameof(HasCustomOutputDirectory))]
private string _outputDirectory = string.Empty;
public partial string OutputDirectory { get; set; } = string.Empty;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(FileNamePreview))]
private string _fileNameTemplate = FileNameStrategy.DefaultTemplate;
public partial string FileNameTemplate { get; set; } = FileNameStrategy.DefaultTemplate;
[ObservableProperty]
private bool _previewBeforeSave;
public partial bool PreviewBeforeSave { get; set; }
[ObservableProperty]
private int _countdownSeconds;
public partial int CountdownSeconds { get; set; }
[ObservableProperty]
private string _clipboardMode = "None";
public partial string ClipboardMode { get; set; } = "None";
[ObservableProperty]
private bool _includeCursor;
public partial bool IncludeCursor { get; set; }
[ObservableProperty]
private bool _includeWindowFrame;
public partial bool IncludeWindowFrame { get; set; }
[ObservableProperty]
private string _hdrMode = "Auto";
public partial string HdrMode { get; set; } = "Auto";
[ObservableProperty]
private bool _saveHdrSidecar;
public partial bool SaveHdrSidecar { get; set; }
public bool IsJpeg => DefaultFormat == ImageFormat.Jpeg;
@@ -202,37 +202,37 @@ public sealed partial class SettingsViewModel : ViewModelBase, IDisposable
// ---- Behaviour, startup, appearance ---------------------------------------------
[ObservableProperty]
private bool _minimizeToTray;
public partial bool MinimizeToTray { get; set; }
[ObservableProperty]
private bool _startMinimized;
public partial bool StartMinimized { get; set; }
[ObservableProperty]
private bool _soundEnabled;
public partial bool SoundEnabled { get; set; }
[ObservableProperty]
private bool _openFolderAfterSave;
public partial bool OpenFolderAfterSave { get; set; }
[ObservableProperty]
private bool _autoPinAfterCapture;
public partial bool AutoPinAfterCapture { get; set; }
[ObservableProperty]
private bool _showNotifications;
public partial bool ShowNotifications { get; set; }
[ObservableProperty]
private bool _armOnStartup;
public partial bool ArmOnStartup { get; set; }
[ObservableProperty]
private bool _startWithWindows;
public partial bool StartWithWindows { get; set; }
[ObservableProperty]
private string _theme = "System";
public partial string Theme { get; set; } = "System";
[ObservableProperty]
private string _language = "en-US";
public partial string Language { get; set; } = "en-US";
[ObservableProperty]
private string _logLevel = "Information";
public partial string LogLevel { get; set; } = "Information";
// ---- Commands ---------------------------------------------------------------------
@@ -59,13 +59,13 @@ public sealed partial class ShellViewModel : ViewModelBase, IDisposable
public string Subtitle => AppInfo.DisplayVersion;
[ObservableProperty]
private bool _isArmed;
public partial bool IsArmed { get; set; }
[ObservableProperty]
private bool _isBusy;
public partial bool IsBusy { get; set; }
[ObservableProperty]
private string _trayToolTip = "CaptureImage";
public partial string TrayToolTip { get; set; } = "CaptureImage";
public string ArmMenuText => IsArmed ? Localization["Tray_Disarm"] : Localization["Tray_Arm"];
@@ -46,7 +46,7 @@ public sealed partial class UpdateViewModel : ViewModelBase, IDisposable
Localization = localization;
AppInfo = appInfo;
_logger = logger;
_status = updates.IsAvailable ? UpdateStatus.Idle : UpdateStatus.Unavailable;
Status = updates.IsAvailable ? UpdateStatus.Idle : UpdateStatus.Unavailable;
_updates.LogEmitted += OnLogEmitted;
Localization.PropertyChanged += OnLocalizationChanged;
@@ -61,19 +61,19 @@ public sealed partial class UpdateViewModel : ViewModelBase, IDisposable
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(StatusText), nameof(IsWorking), nameof(ShowProgress), nameof(IsUpdateAvailable), nameof(IsReady), nameof(HasFailed))]
[NotifyCanExecuteChangedFor(nameof(CheckCommand), nameof(DownloadCommand), nameof(InstallAndRestartCommand), nameof(CancelCommand))]
private UpdateStatus _status;
public partial UpdateStatus Status { get; set; }
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(StatusText))]
private string? _availableVersion;
public partial string? AvailableVersion { get; set; }
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(HasReleaseNotes))]
private string? _releaseNotes;
public partial string? ReleaseNotes { get; set; }
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsProgressIndeterminate))]
private int _progress;
public partial int Progress { get; set; }
public string StatusText => Status == UpdateStatus.UpdateAvailable
? Localization.Format("Update_Status_UpdateAvailable", AvailableVersion ?? "?")
@@ -10,23 +10,23 @@
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Direct",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "G2GrGWNAPZBsii2F6AU8n+JT2tC1/I0Ml/e9ZyNCgPjf3hZqronP7o0X91aAynCmVeae8KkSIUNXXeXCNRmdVQ=="
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "QtpQzuSZVyTPCuHW058yCs9Nj0394uUkNyFHS813nOmK9UgUdBdaprJ5PPsBgsQIpxADTsTkbaMMonykem6qdw=="
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "Direct",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "aSZEhEig4fvNiw2zs8Z6NyDlniKtq6YjcF3DyHuqTEHcZ2VKA/6itMPZ+dW+yWABWExlDcQwwdbqX1Rcb7W8WQ==",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "SwcbEBtkECq3D2oywvHkm46fyrX9Dd2JPWphDnHUc2+cUWR1Mdo41atAjh/9iZjgQxuvbKfZKXqostT/LZfefA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14"
}
},
"captureimage.core": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )"
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
}
}
},
@@ -20,16 +20,13 @@ internal sealed record EncodeCall(CapturedFrame Frame, ImageFormat Format, Encod
/// two halves with <see cref="Midway"/> in between, so a failure there leaves a partially
/// written file behind — exactly what the writer has to clean up.
/// </summary>
internal sealed class FakeImageEncoder : IImageEncoder
/// <param name="supported">Format/pixel-format pairs to accept; empty means <see cref="DefaultSupport"/>.</param>
internal sealed class FakeImageEncoder(
params (ImageFormat Format, FramePixelFormat PixelFormat)[] supported) : IImageEncoder
{
private readonly ConcurrentQueue<EncodeCall> _calls = new();
private readonly HashSet<(ImageFormat, FramePixelFormat)> _supported;
/// <param name="supported">Format/pixel-format pairs to accept; empty means <see cref="DefaultSupport"/>.</param>
public FakeImageEncoder(params (ImageFormat Format, FramePixelFormat PixelFormat)[] supported)
{
_supported = supported.Length > 0 ? [.. supported] : [.. DefaultSupport];
}
private readonly HashSet<(ImageFormat, FramePixelFormat)> _supported =
supported.Length > 0 ? [.. supported] : [.. DefaultSupport];
/// <summary>Every 8-bit output format, plus the JPEG XR sidecar from FP16.</summary>
public static IReadOnlyList<(ImageFormat Format, FramePixelFormat PixelFormat)> DefaultSupport { get; } =
@@ -10,16 +10,11 @@ namespace CaptureImage.Core.Tests.TestSupport;
/// wait until code under test is really blocked on <c>Task.Delay(…, timeProvider, …)</c>
/// before advancing the clock, so no advance is ever lost to a race.
/// </summary>
internal sealed class SignalingTimeProvider : TimeProvider, IDisposable
internal sealed class SignalingTimeProvider(DateTimeOffset start) : TimeProvider, IDisposable
{
private readonly SemaphoreSlim _timerCreated = new(0);
public SignalingTimeProvider(DateTimeOffset start)
{
Fake = new FakeTimeProvider(start);
}
public FakeTimeProvider Fake { get; }
public FakeTimeProvider Fake { get; } = new(start);
public override TimeZoneInfo LocalTimeZone => Fake.LocalTimeZone;
@@ -193,22 +193,22 @@
"captureimage.core": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )"
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "CentralTransitive",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "G2GrGWNAPZBsii2F6AU8n+JT2tC1/I0Ml/e9ZyNCgPjf3hZqronP7o0X91aAynCmVeae8KkSIUNXXeXCNRmdVQ=="
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "QtpQzuSZVyTPCuHW058yCs9Nj0394uUkNyFHS813nOmK9UgUdBdaprJ5PPsBgsQIpxADTsTkbaMMonykem6qdw=="
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "CentralTransitive",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "aSZEhEig4fvNiw2zs8Z6NyDlniKtq6YjcF3DyHuqTEHcZ2VKA/6itMPZ+dW+yWABWExlDcQwwdbqX1Rcb7W8WQ==",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "SwcbEBtkECq3D2oywvHkm46fyrX9Dd2JPWphDnHUc2+cUWR1Mdo41atAjh/9iZjgQxuvbKfZKXqostT/LZfefA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14"
}
}
},
@@ -176,7 +176,7 @@ public sealed class WgcIntegrationTests : IDisposable
{
SkipUnlessCaptureIsSupported();
var monitors = _displays.GetMonitors();
var monitor = monitors.FirstOrDefault(m => m.IsPrimary) ?? monitors.FirstOrDefault();
var monitor = monitors.FirstOrDefault(m => m.IsPrimary) ?? (monitors.Count > 0 ? monitors[0] : null);
if (monitor is null)
{
Assert.Skip("No monitor is attached to this session.");
@@ -52,10 +52,10 @@ public sealed class DiagnosticsExporterTests : IDisposable
[Fact]
public async Task ExportAsync_BundlesSystemInfoSettingsAndLogs()
{
File.WriteAllText(_paths.SettingsFile, """{"version":3,"culture":"vi-VN"}""");
await File.WriteAllTextAsync(_paths.SettingsFile, """{"version":3,"culture":"vi-VN"}""", Ct);
WriteLog("captureimage-20261018.log", "yesterday", hoursAgo: 24);
WriteLog("captureimage-20261019.log", "today", hoursAgo: 1);
File.WriteAllText(Path.Combine(_paths.LogsDirectory, "readme.txt"), "not a log");
await File.WriteAllTextAsync(Path.Combine(_paths.LogsDirectory, "readme.txt"), "not a log", Ct);
var destination = _temp.Combine("diagnostics.zip");
var result = await CreateExporter().ExportAsync(destination, Ct);
@@ -89,7 +89,7 @@ public sealed class DiagnosticsExporterTests : IDisposable
});
await store.FlushAsync(Ct);
}
File.ReadAllText(_paths.SettingsFile).Should().Contain(JsonEncodedText.Encode(Profile).ToString(), "the test needs the escaped form on disk");
(await File.ReadAllTextAsync(_paths.SettingsFile, Ct)).Should().Contain(JsonEncodedText.Encode(Profile).ToString(), "the test needs the escaped form on disk");
WriteLog("captureimage-20261019.log", $"Saved {Path.Combine(Profile, "Pictures", "a.png")}\nOpened {Profile.ToUpperInvariant()}\\Desktop\n", hoursAgo: 0);
var destination = _temp.Combine("diagnostics.zip");
@@ -154,7 +154,7 @@ public sealed class DiagnosticsExporterTests : IDisposable
public async Task ExportAsync_ReplacesAnExistingFile()
{
var destination = _temp.Combine("diagnostics.zip");
File.WriteAllText(destination, "an older export");
await File.WriteAllTextAsync(destination, "an older export", Ct);
await CreateExporter().ExportAsync(destination, Ct);
@@ -165,7 +165,7 @@ public sealed class DiagnosticsExporterTests : IDisposable
public async Task ExportAsync_LeftoverTempFileFromAnInterruptedExport_DoesNotBlockTheNextOne()
{
var destination = _temp.Combine("diagnostics.zip");
File.WriteAllText(destination + ".tmp", "half-written zip from a crash");
await File.WriteAllTextAsync(destination + ".tmp", "half-written zip from a crash", Ct);
await CreateExporter().ExportAsync(destination, Ct);
@@ -68,7 +68,7 @@ public sealed class SkiaImageEncoderTests : IDisposable
var path = await EncodeToFileAsync(frame, ImageFormat.Png, new EncoderSettings());
File.ReadAllBytes(path)[..8].Should().Equal(PngSignature);
(await File.ReadAllBytesAsync(path, Ct))[..8].Should().Equal(PngSignature);
var decoded = await _decoder.LoadAsync(path, cancellationToken: Ct);
decoded.Should().NotBeNull();
decoded.ShouldHaveSamePixelsAs(frame);
@@ -83,7 +83,7 @@ public sealed class SkiaImageEncoderTests : IDisposable
var path = await EncodeToFileAsync(frame, ImageFormat.Png, new EncoderSettings());
// IHDR colour type (byte 25): 2 = truecolour without alpha.
File.ReadAllBytes(path)[25].Should().Be(2);
(await File.ReadAllBytesAsync(path, Ct))[25].Should().Be(2);
var decoded = await _decoder.LoadAsync(path, cancellationToken: Ct);
decoded.Should().NotBeNull();
decoded.ShouldHaveSamePixelsAs(frame);
@@ -115,7 +115,7 @@ public sealed class SkiaImageEncoderTests : IDisposable
var path = await EncodeToFileAsync(frame, ImageFormat.Jpeg, new EncoderSettings(JpegQuality: quality));
File.ReadAllBytes(path)[..3].Should().Equal(0xFF, 0xD8, 0xFF);
(await File.ReadAllBytesAsync(path, Ct))[..3].Should().Equal(0xFF, 0xD8, 0xFF);
var decoded = await _decoder.LoadAsync(path, cancellationToken: Ct);
decoded.Should().NotBeNull();
decoded.Width.Should().Be(32);
@@ -144,7 +144,7 @@ public sealed class SkiaImageEncoderTests : IDisposable
var path = await EncodeToFileAsync(frame, ImageFormat.Webp, new EncoderSettings(WebpQuality: 90));
var bytes = File.ReadAllBytes(path);
var bytes = await File.ReadAllBytesAsync(path, Ct);
Encoding.ASCII.GetString(bytes, 0, 4).Should().Be("RIFF");
Encoding.ASCII.GetString(bytes, 8, 4).Should().Be("WEBP");
// Skia decodes WebP everywhere; WIC needs an optional Windows codec (see WicImageDecoderTests).
@@ -163,7 +163,7 @@ public sealed class WicImageDecoderTests : IDisposable
{
var complete = await WriteAsync(TestFrames.Bgra(64, 64, TestFrames.Gradient), ImageFormat.Png);
var truncated = _temp.Combine("truncated.png");
await File.WriteAllBytesAsync(truncated, File.ReadAllBytes(complete)[..40], Ct);
await File.WriteAllBytesAsync(truncated, (await File.ReadAllBytesAsync(complete, Ct))[..40], Ct);
(await _decoder.LoadAsync(truncated, cancellationToken: Ct)).Should().BeNull();
}
@@ -65,7 +65,7 @@ public sealed class WicImageEncoderTests : IDisposable
var path = await EncodeToFileAsync(frame, ImageFormat.Tiff);
File.ReadAllBytes(path)[..4].Should().Equal(0x49, 0x49, 0x2A, 0x00); // "II*\0", little-endian TIFF
(await File.ReadAllBytesAsync(path, Ct))[..4].Should().Equal(0x49, 0x49, 0x2A, 0x00); // "II*\0", little-endian TIFF
var decoded = await _decoder.LoadAsync(path, cancellationToken: Ct);
decoded.Should().NotBeNull();
decoded.ShouldHaveSamePixelsAs(frame);
@@ -85,7 +85,7 @@ public sealed class WicImageEncoderTests : IDisposable
var path = await EncodeToFileAsync(frame, ImageFormat.Jxr);
File.ReadAllBytes(path)[..4].Should().Equal(0x49, 0x49, 0xBC, 0x01); // JPEG XR "II\xBC\x01"
(await File.ReadAllBytesAsync(path, Ct))[..4].Should().Equal(0x49, 0x49, 0xBC, 0x01); // JPEG XR "II\xBC\x01"
var decoded = await _decoder.LoadAsync(path, cancellationToken: Ct);
decoded.Should().NotBeNull();
decoded.Width.Should().Be(32);
@@ -56,7 +56,7 @@ public sealed class CaptureLibraryServiceTests : IDisposable
var records = await library.GetAllAsync(Ct);
records.Should().BeEmpty();
File.ReadAllText(_paths.LibraryIndexFile).Trim().Should().Be("[]");
(await File.ReadAllTextAsync(_paths.LibraryIndexFile, Ct)).Trim().Should().Be("[]");
}
[Fact]
@@ -116,13 +116,13 @@ public sealed class CaptureLibraryServiceTests : IDisposable
.Select(i => new CaptureRecord(Path.Combine(_output, $"old-{i}.png"), Noon.AddMinutes(-i), 1, 1, ImageFormat.Png, 1, CaptureMode.Window, null))
.ToList();
Directory.CreateDirectory(_paths.DataDirectory);
File.WriteAllText(_paths.LibraryIndexFile, JsonSerializer.Serialize(existing, SettingsJsonContext.Default.ListCaptureRecord));
await File.WriteAllTextAsync(_paths.LibraryIndexFile, JsonSerializer.Serialize(existing, SettingsJsonContext.Default.ListCaptureRecord), Ct);
using var library = CreateLibrary();
var newest = await SaveCaptureAsync("newest.png", 10, 10, Noon.AddDays(1));
await library.AddAsync(newest, Ct);
using var index = JsonDocument.Parse(File.ReadAllText(_paths.LibraryIndexFile));
using var index = JsonDocument.Parse(await File.ReadAllTextAsync(_paths.LibraryIndexFile, Ct));
var paths = index.RootElement.EnumerateArray().Select(r => r.GetProperty("filePath").GetString()).ToList();
paths.Should().HaveCount(2000);
paths[0].Should().Be(newest.FilePath);
@@ -144,7 +144,7 @@ public sealed class CaptureLibraryServiceTests : IDisposable
(await library.GetAllAsync(Ct)).Should().ContainSingle().Which.FilePath.Should().Be(kept.FilePath);
}
File.ReadAllText(_paths.LibraryIndexFile).Should().NotContain("deleted.png");
(await File.ReadAllTextAsync(_paths.LibraryIndexFile, Ct)).Should().NotContain("deleted.png");
}
[Fact]
@@ -152,13 +152,13 @@ public sealed class CaptureLibraryServiceTests : IDisposable
{
await SaveCaptureAsync("on-disk.png", 12, 8, Noon);
Directory.CreateDirectory(_paths.DataDirectory);
File.WriteAllText(_paths.LibraryIndexFile, "{ definitely not a list");
await File.WriteAllTextAsync(_paths.LibraryIndexFile, "{ definitely not a list", Ct);
using var library = CreateLibrary();
var records = await library.GetAllAsync(Ct);
records.Should().ContainSingle().Which.FileName.Should().Be("on-disk.png");
File.ReadAllText(_paths.LibraryIndexFile).Should().Contain("on-disk.png");
(await File.ReadAllTextAsync(_paths.LibraryIndexFile, Ct)).Should().Contain("on-disk.png");
}
// ---- First-run seeding ---------------------------------------------------------------
@@ -176,9 +176,9 @@ public sealed class CaptureLibraryServiceTests : IDisposable
var jpeg = await WriteImageAsync(Path.Combine(_output, "mid.jpg"), 50, 20, ImageFormat.Jpeg, Noon.AddHours(-2));
var hdr = await WriteImageAsync(Path.Combine(_output, "hdr.png"), 64, 48, ImageFormat.Png, Noon.AddHours(-1));
var sidecar = Path.Combine(_output, "hdr.jxr");
File.WriteAllBytes(sidecar, [0x49, 0x49, 0xBC, 0x01]);
await File.WriteAllBytesAsync(sidecar, [0x49, 0x49, 0xBC, 0x01], Ct);
var fromProfile = await WriteImageAsync(Path.Combine(profileFolder, "profile.png"), 16, 9, ImageFormat.Png, Noon.AddMinutes(-30));
File.WriteAllText(Path.Combine(_output, "notes.txt"), "not an image");
await File.WriteAllTextAsync(Path.Combine(_output, "notes.txt"), "not an image", Ct);
await WriteImageAsync(Path.Combine(_temp.CreateDirectory("Captures", "nested"), "nested.png"), 8, 8, ImageFormat.Png, Noon);
using var library = CreateLibrary();
@@ -194,7 +194,7 @@ public sealed class CaptureLibraryServiceTests : IDisposable
[Fact]
public async Task GetAllAsync_FirstRun_ListsAnUnreadableImageWithZeroSize()
{
File.WriteAllText(Path.Combine(_output, "broken.png"), "not really a png");
await File.WriteAllTextAsync(Path.Combine(_output, "broken.png"), "not really a png", Ct);
using var library = CreateLibrary();
var record = (await library.GetAllAsync(Ct)).Should().ContainSingle().Subject;
@@ -226,7 +226,7 @@ public sealed class CaptureLibraryServiceTests : IDisposable
using var library = CreateLibrary();
var record = await SaveCaptureAsync("hdr.png", 10, 10, Noon);
var sidecar = Path.ChangeExtension(record.FilePath, ".jxr");
File.WriteAllBytes(sidecar, [0x49, 0x49, 0xBC, 0x01]);
await File.WriteAllBytesAsync(sidecar, [0x49, 0x49, 0xBC, 0x01], Ct);
record = record with { HdrFilePath = sidecar };
await library.AddAsync(record, Ct);
var changed = 0;
@@ -240,7 +240,7 @@ public sealed class CaptureLibraryServiceTests : IDisposable
changed.Should().Be(1);
// The substitute does not delete anything, so the record must be gone from the index itself.
(await library.GetAllAsync(Ct)).Should().BeEmpty();
File.ReadAllText(_paths.LibraryIndexFile).Should().NotContain("hdr.png");
(await File.ReadAllTextAsync(_paths.LibraryIndexFile, Ct)).Should().NotContain("hdr.png");
}
[Fact]
@@ -250,7 +250,7 @@ public sealed class CaptureLibraryServiceTests : IDisposable
using var library = CreateLibrary();
var record = await SaveCaptureAsync("locked.png", 10, 10, Noon);
var sidecar = Path.ChangeExtension(record.FilePath, ".jxr");
File.WriteAllBytes(sidecar, [0x49, 0x49, 0xBC, 0x01]);
await File.WriteAllBytesAsync(sidecar, [0x49, 0x49, 0xBC, 0x01], Ct);
record = record with { HdrFilePath = sidecar };
await library.AddAsync(record, Ct);
var changed = 0;
@@ -276,7 +276,7 @@ public sealed class CaptureLibraryServiceTests : IDisposable
deleted.Should().BeTrue();
_shell.DidNotReceive().MoveToRecycleBin(Arg.Any<string>());
File.ReadAllText(_paths.LibraryIndexFile).Should().NotContain("gone.png");
(await File.ReadAllTextAsync(_paths.LibraryIndexFile, Ct)).Should().NotContain("gone.png");
}
// ---- Thumbnails ------------------------------------------------------------------------
@@ -293,7 +293,7 @@ public sealed class CaptureLibraryServiceTests : IDisposable
thumbnail.Should().NotBeNull();
Path.GetDirectoryName(thumbnail).Should().Be(_paths.ThumbnailCacheDirectory);
thumbnail.Should().EndWith("_64.jpg");
File.ReadAllBytes(thumbnail)[..3].Should().Equal(0xFF, 0xD8, 0xFF);
(await File.ReadAllBytesAsync(thumbnail, Ct))[..3].Should().Equal(0xFF, 0xD8, 0xFF);
var image = await decoder.LoadAsync(thumbnail, cancellationToken: Ct);
image.Should().NotBeNull();
image.Width.Should().Be(64);
@@ -302,9 +302,9 @@ public sealed class CaptureLibraryServiceTests : IDisposable
Directory.GetFiles(_paths.ThumbnailCacheDirectory, "*.tmp").Should().BeEmpty();
// A cached thumbnail is served as is, not regenerated.
File.WriteAllBytes(thumbnail, [1, 2, 3]);
await File.WriteAllBytesAsync(thumbnail, [1, 2, 3], Ct);
(await library.GetThumbnailAsync(record, 64, Ct)).Should().Be(thumbnail);
File.ReadAllBytes(thumbnail).Should().Equal(1, 2, 3);
(await File.ReadAllBytesAsync(thumbnail, Ct)).Should().Equal(1, 2, 3);
}
[Fact]
@@ -357,7 +357,7 @@ public sealed class CaptureLibraryServiceTests : IDisposable
using var library = CreateLibrary();
var missing = new CaptureRecord(Path.Combine(_output, "missing.png"), Noon, 1, 1, ImageFormat.Png, 1, CaptureMode.Window, null);
var broken = missing with { FilePath = Path.Combine(_output, "broken.png") };
File.WriteAllText(broken.FilePath, "not a png");
await File.WriteAllTextAsync(broken.FilePath, "not a png", Ct);
(await library.GetThumbnailAsync(missing, 64, Ct)).Should().BeNull();
(await library.GetThumbnailAsync(broken, 64, Ct)).Should().BeNull();
@@ -77,7 +77,7 @@ public sealed class JsonSettingsStoreTests : IDisposable
using var store = await LoadStoreAsync(legacy);
// The v1 file is only read: v1.5.1 keeps working if the user goes back to it.
File.ReadAllText(legacy).Should().Be(V151SettingsJson);
(await File.ReadAllTextAsync(legacy, Ct)).Should().Be(V151SettingsJson);
File.GetLastWriteTimeUtc(legacy).Should().Be(legacyWrittenAt);
var s = store.Current;
@@ -107,7 +107,7 @@ public sealed class JsonSettingsStoreTests : IDisposable
s.UI.ShowLogViewer.Should().BeNull();
// The pre-migration document is kept next to the migrated one.
File.ReadAllText(Backups("v2").Should().ContainSingle().Subject).Should().Be(V151SettingsJson);
(await File.ReadAllTextAsync(Backups("v2").Should().ContainSingle().Subject, Ct)).Should().Be(V151SettingsJson);
// settings.json now holds a v3 document without the retired v2 fields.
var json = ReadSettingsFile();
@@ -187,7 +187,7 @@ public sealed class JsonSettingsStoreTests : IDisposable
using var store = await LoadStoreAsync(legacy);
store.Current.Culture.Should().Be("vi-VN");
File.ReadAllText(legacy).Should().Be(V151SettingsJson);
(await File.ReadAllTextAsync(legacy, Ct)).Should().Be(V151SettingsJson);
}
[Fact]
@@ -214,7 +214,7 @@ public sealed class JsonSettingsStoreTests : IDisposable
using var store = await LoadStoreAsync();
store.Current.Should().BeEquivalentTo(new AppSettings());
File.ReadAllText(Backups("corrupt").Should().ContainSingle().Subject).Should().Be(content);
(await File.ReadAllTextAsync(Backups("corrupt").Should().ContainSingle().Subject, Ct)).Should().Be(content);
ReadSettingsFile().GetProperty("version").GetInt32().Should().Be(AppSettings.CurrentVersion);
}
@@ -237,7 +237,7 @@ public sealed class JsonSettingsStoreTests : IDisposable
using var store = await LoadStoreAsync();
File.ReadAllText(Backups("v7").Should().ContainSingle().Subject).Should().Be(future);
(await File.ReadAllTextAsync(Backups("v7").Should().ContainSingle().Subject, Ct)).Should().Be(future);
store.Current.Version.Should().Be(AppSettings.CurrentVersion);
store.Current.Culture.Should().Be("fr-FR");
store.Current.Theme.Should().Be("Dark");
@@ -612,7 +612,7 @@ public sealed class JsonSettingsStoreTests : IDisposable
store.Current.Should().BeEquivalentTo(new AppSettings { Culture = "vi-VN" });
changed.Should().Be(1);
using (var backup = JsonDocument.Parse(File.ReadAllText(Backups("reset").Should().ContainSingle().Subject)))
using (var backup = JsonDocument.Parse(await File.ReadAllTextAsync(Backups("reset").Should().ContainSingle().Subject, Ct)))
{
backup.RootElement.GetProperty("theme").GetString().Should().Be("Dark");
backup.RootElement.GetProperty("capture").GetProperty("jpegQuality").GetInt32().Should().Be(40);
@@ -670,7 +670,7 @@ public sealed class JsonSettingsStoreTests : IDisposable
private async Task ShouldRejectImportAsync(JsonSettingsStore store, string importPath)
{
var before = store.Current;
var fileBefore = File.ReadAllText(_paths.SettingsFile);
var fileBefore = await File.ReadAllTextAsync(_paths.SettingsFile, Ct);
var changed = 0;
store.Changed += (_, _) => changed++;
@@ -678,7 +678,7 @@ public sealed class JsonSettingsStoreTests : IDisposable
await act.Should().ThrowAsync<InvalidDataException>();
store.Current.Should().BeSameAs(before);
File.ReadAllText(_paths.SettingsFile).Should().Be(fileBefore);
(await File.ReadAllTextAsync(_paths.SettingsFile, Ct)).Should().Be(fileBefore);
changed.Should().Be(0);
}
@@ -127,8 +127,8 @@
},
"SkiaSharp.NativeAssets.Win32": {
"type": "Transitive",
"resolved": "4.153.1",
"contentHash": "Yqg6rChTVh0BUE8QQxtOA3uUBnihfgID4yex/AvDa0+os2bVcBjmI3Qj9tnOB+R1hd/Jry1Gwl8qw5JI9HZG8Q=="
"resolved": "4.154.0",
"contentHash": "GXgoY77GCXdPcveNAmy8o3gVit8sp6YtnI88h5camLPfihjulwJUajZXKhgVuZ8RhuwSTgfyt/00Dx8HRUSeAA=="
},
"System.Diagnostics.EventLog": {
"type": "Transitive",
@@ -226,16 +226,16 @@
"captureimage.core": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )"
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
}
},
"captureimage.infrastructure": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.0.1, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )",
"CaptureImage.Core": "[2.0.3, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )",
"Serilog": "[4.4.0, )",
"SkiaSharp": "[4.153.1, )",
"SkiaSharp": "[4.154.0, )",
"Velopack": "[1.2.161, )",
"Vortice.DXGI": "[3.8.3, )",
"Vortice.Direct2D1": "[3.8.3, )",
@@ -244,17 +244,17 @@
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "CentralTransitive",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "G2GrGWNAPZBsii2F6AU8n+JT2tC1/I0Ml/e9ZyNCgPjf3hZqronP7o0X91aAynCmVeae8KkSIUNXXeXCNRmdVQ=="
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "QtpQzuSZVyTPCuHW058yCs9Nj0394uUkNyFHS813nOmK9UgUdBdaprJ5PPsBgsQIpxADTsTkbaMMonykem6qdw=="
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "CentralTransitive",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "aSZEhEig4fvNiw2zs8Z6NyDlniKtq6YjcF3DyHuqTEHcZ2VKA/6itMPZ+dW+yWABWExlDcQwwdbqX1Rcb7W8WQ==",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "SwcbEBtkECq3D2oywvHkm46fyrX9Dd2JPWphDnHUc2+cUWR1Mdo41atAjh/9iZjgQxuvbKfZKXqostT/LZfefA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14"
}
},
"Serilog": {
@@ -265,11 +265,11 @@
},
"SkiaSharp": {
"type": "CentralTransitive",
"requested": "[4.153.1, )",
"resolved": "4.153.1",
"contentHash": "TghYLOUaP3q6rTjQw7U9uQaaXh8lEs9rfA1U7/VtmyAptVDtj/SmjtcWzFWmcC/VMWxe3QgbV9uyvqDL7ySFtQ==",
"requested": "[4.154.0, )",
"resolved": "4.154.0",
"contentHash": "R3BuszJ3tUFmni37nZIRawXL0yx+XHyx7xi1716/0TybuEQFhnBx48Ig3rFpeVFQVytpGpJZZ+NLW9d9UPG7EA==",
"dependencies": {
"SkiaSharp.NativeAssets.Win32": "4.153.1"
"SkiaSharp.NativeAssets.Win32": "4.154.0"
}
},
"Velopack": {
@@ -329,8 +329,8 @@
},
"SkiaSharp.NativeAssets.Win32": {
"type": "Transitive",
"resolved": "4.153.1",
"contentHash": "Yqg6rChTVh0BUE8QQxtOA3uUBnihfgID4yex/AvDa0+os2bVcBjmI3Qj9tnOB+R1hd/Jry1Gwl8qw5JI9HZG8Q=="
"resolved": "4.154.0",
"contentHash": "GXgoY77GCXdPcveNAmy8o3gVit8sp6YtnI88h5camLPfihjulwJUajZXKhgVuZ8RhuwSTgfyt/00Dx8HRUSeAA=="
},
"System.Diagnostics.EventLog": {
"type": "Transitive",
@@ -16,7 +16,7 @@ namespace CaptureImage.ViewModels.Tests.Localization;
/// test doesn't leak into the next one running on the same test runner thread.
/// </summary>
[Collection(LocalizationTestCollection.Name)]
public class ResxLocalizationServiceTests : IDisposable
public sealed class ResxLocalizationServiceTests : IDisposable
{
private readonly CultureInfo _savedUICulture;
private readonly CultureInfo _savedCulture;
@@ -0,0 +1,80 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using AwesomeAssertions;
using Xunit;
namespace CaptureImage.ViewModels.Tests.Shell;
/// <summary>
/// Dependency upgrades touch more than <c>Directory.Packages.props</c>: the third-party notices
/// (linked from the About page and shipped with the app) must list exactly the packages in the
/// app's lock file at the locked versions, and the <c>vpk</c> tool that packs a release must
/// match the Velopack library inside it.
/// </summary>
public sealed partial class DependencyManifestTests
{
[Fact]
public void ThirdPartyNotices_ListEveryShippedPackageAtItsLockedVersion()
{
var locked = LockedAppPackages();
var listed = PackagesListedInNotices();
locked.Should().NotBeEmpty();
listed.Should().BeEquivalentTo(locked, "docs/legal/THIRD_PARTY_NOTICES.md must follow src/CaptureImage.App/packages.lock.json");
}
[Fact]
public void VelopackLibrary_MatchesTheVpkTool()
{
var root = RepositoryRoot();
var library = XDocument.Load(Path.Combine(root, "Directory.Packages.props")).Descendants("PackageVersion")
.Single(e => (string?)e.Attribute("Include") == "Velopack")
.Attribute("Version")!.Value;
using var manifest = JsonDocument.Parse(File.ReadAllText(Path.Combine(root, ".config", "dotnet-tools.json")));
var tool = manifest.RootElement.GetProperty("tools").GetProperty("vpk").GetProperty("version").GetString();
tool.Should().Be(library, "the release is packed by vpk and updated by the Velopack library, which must agree on the package format");
}
/// <summary>Package id → resolved version for everything the app's publish output contains.</summary>
private static Dictionary<string, string> LockedAppPackages()
{
var path = Path.Combine(RepositoryRoot(), "src", "CaptureImage.App", "packages.lock.json");
using var lockFile = JsonDocument.Parse(File.ReadAllText(path));
// One entry per framework plus one per framework/RID; the RID entry repeats packages with native assets.
var graph = lockFile.RootElement.GetProperty("dependencies").EnumerateObject()
.Single(framework => !framework.Name.Contains('/', StringComparison.Ordinal)).Value;
return graph.EnumerateObject()
.Where(package => package.Value.GetProperty("type").GetString() != "Project")
.ToDictionary(package => package.Name, package => package.Value.GetProperty("resolved").GetString()!, StringComparer.Ordinal);
}
/// <summary>Package id → version from the notices' <c>| Package | Version | License | Project |</c> tables.</summary>
private static Dictionary<string, string> PackagesListedInNotices()
{
var path = Path.Combine(RepositoryRoot(), "docs", "legal", "THIRD_PARTY_NOTICES.md");
return File.ReadLines(path)
.Select(line => PackageRow().Match(line))
.Where(match => match.Success)
.ToDictionary(match => match.Groups["id"].Value, match => match.Groups["version"].Value, StringComparer.Ordinal);
}
private static string RepositoryRoot()
{
for (var dir = new DirectoryInfo(AppContext.BaseDirectory); dir is not null; dir = dir.Parent)
{
if (File.Exists(Path.Combine(dir.FullName, "CaptureImage.sln")))
{
return dir.FullName;
}
}
throw new DirectoryNotFoundException("CaptureImage.sln not found above the test output folder.");
}
[GeneratedRegex(@"^\| (?<id>[A-Za-z0-9][A-Za-z0-9.\-]*) \| (?<version>\d[^ |]*) \|")]
private static partial Regex PackageRow();
}
@@ -12,14 +12,9 @@ using NSubstitute;
namespace CaptureImage.ViewModels.Tests;
/// <summary>In-memory <see cref="ISettingsStore"/> that applies updates synchronously.</summary>
internal sealed class FakeSettingsStore : ISettingsStore
internal sealed class FakeSettingsStore(AppSettings? initial = null) : ISettingsStore
{
public FakeSettingsStore(AppSettings? initial = null)
{
Current = initial ?? new AppSettings();
}
public AppSettings Current { get; private set; }
public AppSettings Current { get; private set; } = initial ?? new AppSettings();
public event EventHandler? Changed;
@@ -187,16 +187,16 @@
"captureimage.core": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )"
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
}
},
"captureimage.viewmodels": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.0.1, )",
"CaptureImage.Core": "[2.0.3, )",
"CommunityToolkit.Mvvm": "[8.4.2, )",
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.13, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.13, )"
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.14, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
}
},
"CommunityToolkit.Mvvm": {
@@ -207,17 +207,17 @@
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "CentralTransitive",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "G2GrGWNAPZBsii2F6AU8n+JT2tC1/I0Ml/e9ZyNCgPjf3hZqronP7o0X91aAynCmVeae8KkSIUNXXeXCNRmdVQ=="
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "QtpQzuSZVyTPCuHW058yCs9Nj0394uUkNyFHS813nOmK9UgUdBdaprJ5PPsBgsQIpxADTsTkbaMMonykem6qdw=="
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "CentralTransitive",
"requested": "[10.0.13, )",
"resolved": "10.0.13",
"contentHash": "aSZEhEig4fvNiw2zs8Z6NyDlniKtq6YjcF3DyHuqTEHcZ2VKA/6itMPZ+dW+yWABWExlDcQwwdbqX1Rcb7W8WQ==",
"requested": "[10.0.14, )",
"resolved": "10.0.14",
"contentHash": "SwcbEBtkECq3D2oywvHkm46fyrX9Dd2JPWphDnHUc2+cUWR1Mdo41atAjh/9iZjgQxuvbKfZKXqostT/LZfefA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14"
}
}
},