Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82b4e02ffe | ||
|
|
c1984cab74 | ||
|
|
32e3c5aa8e | ||
|
|
0ffecb5851 |
No files matched your search
@@ -210,17 +210,53 @@ jobs:
|
||||
# ledger.db, logs, the layer manifest). The same id would put the install inside
|
||||
# the ledger's folder and have the uninstaller remove every session without the
|
||||
# question 12_BUILD promises. The title the user sees is still "FrameLedger".
|
||||
# A DELTA (beta.13): vpk pack diffs against the newest full package already in --outputDir, and until beta.13 that
|
||||
# directory was always empty - so no release carried a delta and every update downloaded the whole package
|
||||
# (11_UPDATER §Built). The previous release is downloaded first; what THIS pack produced is assets.win.json, and only
|
||||
# that is kept: the previous full package moves out (not uploaded, not checksummed) and the feed lists this build
|
||||
# alone, as `vpk upload github` would write it. No previous release, or a download that fails, is a full-only
|
||||
# release - said as a warning, not a stop, because it is exactly what every release before this one was.
|
||||
- name: Pack (Velopack)
|
||||
shell: pwsh
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
dotnet tool install -g vpk --version 1.2.0
|
||||
if ($LASTEXITCODE -ne 0) { throw 'vpk install failed' }
|
||||
$v = '${{ steps.version.outputs.version }}'
|
||||
New-Item -ItemType Directory out/release -Force | Out-Null
|
||||
vpk download github --repoUrl "https://github.com/${{ github.repository }}" --channel win --pre --token $env:GH_TOKEN --outputDir out/release
|
||||
if ($LASTEXITCODE -ne 0) { Write-Host '::warning::the previous release could not be downloaded - this release carries a full package only' }
|
||||
Write-Host 'previous release:'
|
||||
Get-ChildItem out/release -File | ForEach-Object { Write-Host (" {0,-48} {1,12:N0}" -f $_.Name, $_.Length) }
|
||||
vpk pack --packId FrameLedger.App --packVersion $v --packDir out/app --mainExe FrameLedger.exe --packTitle FrameLedger --packAuthors FrameLedger --releaseNotes out/notes.md --outputDir out/release
|
||||
if ($LASTEXITCODE -ne 0) { throw 'vpk pack failed' }
|
||||
|
||||
$built = @((Get-Content out/release/assets.win.json -Raw | ConvertFrom-Json) | ForEach-Object { $_.RelativeFileName })
|
||||
if ($built.Count -eq 0) { throw 'vpk pack wrote no assets.win.json entries' }
|
||||
$keep = $built + @('releases.win.json', 'assets.win.json', 'RELEASES')
|
||||
New-Item -ItemType Directory out/previous -Force | Out-Null
|
||||
Get-ChildItem out/release -File | Where-Object { $keep -notcontains $_.Name } | Move-Item -Destination out/previous
|
||||
$feed = Get-Content out/release/releases.win.json -Raw | ConvertFrom-Json
|
||||
$feed.Assets = @($feed.Assets | Where-Object { $built -contains $_.FileName })
|
||||
if ($feed.Assets.Count -eq 0) { throw 'the feed lists none of this build''s packages' }
|
||||
[System.IO.File]::WriteAllText((Join-Path $PWD 'out/release/releases.win.json'), ($feed | ConvertTo-Json -Depth 8 -Compress), [System.Text.UTF8Encoding]::new($false))
|
||||
if (Test-Path out/release/RELEASES) {
|
||||
$legacy = @(Get-Content out/release/RELEASES | Where-Object { $built -contains ($_ -split ' ')[1] })
|
||||
[System.IO.File]::WriteAllLines((Join-Path $PWD 'out/release/RELEASES'), [string[]]$legacy, [System.Text.UTF8Encoding]::new($false))
|
||||
}
|
||||
|
||||
Write-Host 'this release:'
|
||||
Get-ChildItem out/release | ForEach-Object { Write-Host (" {0,-48} {1,12:N0}" -f $_.Name, $_.Length) }
|
||||
Write-Host ('feed: ' + (($feed.Assets | ForEach-Object { '{0} {1} {2}' -f $_.Type, $_.Version, $_.FileName }) -join '; '))
|
||||
if (-not (Test-Path out/release/FrameLedger.App-win-Setup.exe)) { throw 'vpk did not produce FrameLedger.App-win-Setup.exe (README §Install names it)' }
|
||||
$delta = "out/release/FrameLedger.App-$v-delta.nupkg"
|
||||
if (Get-ChildItem out/previous -Filter '*-full.nupkg' -ErrorAction SilentlyContinue) {
|
||||
if (-not (Test-Path $delta)) { throw "the previous full package was downloaded, but vpk produced no delta ($delta)" }
|
||||
} else {
|
||||
Write-Host '::warning::no previous full package - this release carries no delta'
|
||||
}
|
||||
|
||||
- name: Checksums
|
||||
shell: pwsh
|
||||
|
||||
@@ -28,6 +28,69 @@ numeric core and does not move; the heading is the full version — corrected 20
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- **Settings ▸ Window ▸ Hide scroll bars.** No scroll bar is drawn anywhere in the app while it is on, and everything
|
||||
still scrolls with the mouse wheel, the keyboard and touch. Off by default; it applies at once, to the open windows
|
||||
too, and off brings every bar back.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **An installed copy never found an update unless you had changed its channel.** The update channel was *Stable* by
|
||||
default and every FrameLedger release so far is a pre-release, so the check found nothing. The channel is now
|
||||
*Automatic*: a pre-release looks for pre-releases and a release for releases; choosing *Stable* or *Beta* still decides.
|
||||
- **A downloaded update was applied the next time FrameLedger started, before anything could check for a running game.**
|
||||
The update library applies a waiting package at start unless told not to, and nothing told it: it stopped the capture
|
||||
agent mid-session instead of letting it finish. The App now offers such a package as *Restart to update*, which waits
|
||||
for the session to end and stops the agent properly, as it always did for a download in the same run.
|
||||
- **The update dialog said ~102 MB when the download was the 1.6 MB delta.** It now says the delta's size and names the
|
||||
full package as the fallback; the updater's own lines are in the App's log, so a full download shows there.
|
||||
- **Restart to update could fail half way** when a game FrameLedger had measured was still running — its loaded overlay
|
||||
cannot be replaced — or when an agent was still waiting on the administrator prompt, and it gave the agent 10 s to stop
|
||||
where the agent takes up to 15. It waits for all three now and says why. A full disk no longer reads as "offline",
|
||||
and uninstalling removes the *Start FrameLedger with Windows* entry.
|
||||
- **The import list was unreadable in the dark theme.** File ▸ Import library (and Games ▸ Refresh) drew every row white
|
||||
with white text, and each tick box as a sliver at the row's edge: a row style added in beta.11 to dim the games already
|
||||
in the library fell through to Windows' own row, which is white in every theme, and WPF UI's check box is too wide for
|
||||
its 40 px column. The rows take the theme's colours again and the boxes are whole, and the list is the one thing in the
|
||||
dialog that scrolls — its intro and the count under it stay in view, where a list scrolling inside a scrolling dialog
|
||||
used to carry the intro away. Compare's session picker draws the theme's check boxes too (it drew Windows' old ones).
|
||||
- **The mouse wheel scrolled nothing on the Dashboard, Games, a game's page, Compare and Settings** — only dragging the
|
||||
scroll bar did. WPF UI wraps a page in a scroller of its own unless the page says otherwise, and inside it each page's
|
||||
own scroller had nothing to scroll and still took every wheel. Every page scrolls itself now. The Logs page had the same
|
||||
cause: its tail grew to hold every line and never followed the newest one, as it was meant to. A scroller inside a
|
||||
dialog (the consent, administrator, anti-cheat exception and bug report dialogs) hands the wheel on at its ends.
|
||||
|
||||
### Changed
|
||||
|
||||
- **Over a chart, the wheel scrolls the page; Ctrl+wheel zooms the chart.** ScottPlot zoomed on every wheel, which with
|
||||
the pages scrolling again would have zoomed the chart and scrolled the page at once. Dragging still pans and
|
||||
double-click still resets.
|
||||
|
||||
## [0.1.0-beta.13] - 2026-10-04
|
||||
|
||||
**The thirteenth pre-release: refusal notices that say where the anti-cheat is, GPU sensors that follow the game's graphics
|
||||
card, and smaller updates.** The same unsigned installer: verify its hash against `SHA256SUMS.txt`, then *More info → Run
|
||||
anyway*. What changed for a user:
|
||||
|
||||
- **An anti-cheat driver or service running on the PC is said as that.** While, for example, Easy Anti-Cheat's service
|
||||
runs for another game, FrameLedger hooks no game at all; the notice used to say the anti-cheat "was detected in this
|
||||
game", naming a game that may not even use it. It now says the anti-cheat is running on this PC, and the session's
|
||||
summary says the same. A finding in the game itself still says "in this game".
|
||||
- **The notice for a capture stopped mid-game** no longer promises that FrameLedger will hook the game again "when you
|
||||
enable it again" — which was not true either way. It says where the anti-cheat was found and whether hooking was
|
||||
turned off.
|
||||
- **On a PC with more than one graphics card**, the GPU figures follow the card the game draws on once it has shown its
|
||||
first frame, instead of the first card Windows lists (often a laptop's integrated GPU). Not yet tested on such a PC.
|
||||
- **Updates download only what changed**: this release carries a delta package against `0.1.0-beta.12`, so updating
|
||||
from it through the App downloads a fraction of the full ~107 MB.
|
||||
|
||||
**Updating from `0.1.0-beta.12`:**
|
||||
|
||||
- Help ▸ Check for updates downloads the delta; or quit the App (tray icon → Exit), end `FrameLedger.Agent.exe` and
|
||||
run the installer as before.
|
||||
- No database change, and no document to accept again.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **A refusal because of a driver or service said the anti-cheat "was detected in this game".** The guard's checks for
|
||||
@@ -44,6 +107,10 @@ numeric core and does not move; the heading is the full version — corrected 20
|
||||
LibreHardwareMonitor reads that brand's GPU rather than the first one it lists (often a laptop's integrated GPU), and
|
||||
NVAPI says nothing when the game runs on an AMD or Intel card — N/A rather than another card's temperature.
|
||||
`LIMITATIONS.md` says what still describes the first card.
|
||||
- **Updates download only what changed**, from this release on: each release now carries a Velopack delta package
|
||||
against the previous one beside the full package, and an installed copy one release behind downloads the delta. No
|
||||
earlier release had one — every update so far downloaded the whole ~107 MB package — so the first update that can use
|
||||
a delta is from `0.1.0-beta.12` to this one; Velopack falls back to the full package whenever the delta does not apply.
|
||||
- **Tests that change the App's language ran beside tests that read its text**, so the second kind could read the
|
||||
wrong language once in many runs; the language-changing tests now run on their own.
|
||||
|
||||
|
||||
+6
-1
@@ -5,7 +5,7 @@ hooking on for — and reading the graphics calls the game makes. That is why it
|
||||
resolution, the upscaler, frame generation and ray tracing apart. It is also where its limits come from. This
|
||||
page lists them in plain words; each item links to the document that has the details.
|
||||
|
||||
*Beta software: this page describes version 0.1.0-beta.12.*
|
||||
*Beta software: this page describes version 0.1.0-beta.13.*
|
||||
|
||||
## Games it will not measure
|
||||
|
||||
@@ -146,3 +146,8 @@ you accept the prompt. Turn it on only if you trust everything that runs under y
|
||||
|
||||
FrameLedger's programs are **not code-signed**: Windows SmartScreen may warn when you install it, and the
|
||||
administrator prompt names an unknown publisher. Each release publishes SHA-256 checksums you can compare.
|
||||
|
||||
**An update waits while a game FrameLedger measured is still running.** The part of FrameLedger loaded into a game stays
|
||||
loaded until the game exits, and Windows will not let the update replace it; *Restart to update* says which file is held
|
||||
until you close that game ([details](docs/11_UPDATER.md)). Copies older than 0.1.0-beta.14 look only for stable
|
||||
releases unless you choose *Beta* in Settings ▸ Updates, and apply a downloaded update the next time they start.
|
||||
@@ -10,7 +10,7 @@ anti-cheat, and look after your data, a page each. What FrameLedger cannot do is
|
||||
|
||||
<!-- accuracy-block:begin -->
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-10-04.** The software is a beta; its latest
|
||||
> **pre-release is `0.1.0-beta.12`** (2026-10-04), an unsigned installer built from that tag with its
|
||||
> **pre-release is `0.1.0-beta.13`** (2026-10-04), an unsigned installer built from that tag with its
|
||||
> checksums published beside it. The source holds the desktop app
|
||||
> (library, store import, charts, settings) and the background Agent, which records a session when a
|
||||
> game in the library runs (unless you switched its recording off), injects only into games you enabled
|
||||
@@ -153,7 +153,7 @@ Elevation is **optional — for everything.** Hooked capture is the normal path
|
||||
|
||||
## Install
|
||||
|
||||
> **The latest pre-release is `v0.1.0-beta.12` (2026-10-04); before it `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read `CHANGELOG.md`'s section for the one you install — what it measures, what it does not yet, and how to update — before installing. A source build is `docs/12_BUILD.md`.
|
||||
> **The latest pre-release is `v0.1.0-beta.13` (2026-10-04); before it `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read `CHANGELOG.md`'s section for the one you install — what it measures, what it does not yet, and how to update — before installing. A source build is `docs/12_BUILD.md`.
|
||||
|
||||
1. Download the latest `FrameLedger.App-win-Setup.exe` from [Releases](https://github.com/poli0981/frameledger/releases). It installs into `%LOCALAPPDATA%\FrameLedger.App`; your data stays in `%LOCALAPPDATA%\FrameLedger`, and uninstalling asks before touching it.
|
||||
2. SmartScreen may warn — releases are not code-signed (free, open-source project). Verify the SHA-256 checksum published with each release, then **More info → Run anyway**.
|
||||
@@ -200,4 +200,4 @@ GPU telemetry is layered so the project never depends on a proprietary vendor li
|
||||
|
||||
---
|
||||
|
||||
**Status:** pre-release (beta). Twelve tagged pre-releases so far; see `CHANGELOG.md` for what each one changed and the accuracy block at the top of this file for what is and is not measured. It is not feature-complete, it certainly still has bugs, and `legal/DISCLAIMER.md` §0 says what that means for you.
|
||||
**Status:** pre-release (beta). Thirteen tagged pre-releases so far; see `CHANGELOG.md` for what each one changed and the accuracy block at the top of this file for what is and is not measured. It is not feature-complete, it certainly still has bugs, and `legal/DISCLAIMER.md` §0 says what that means for you.
|
||||
@@ -415,6 +415,7 @@ switch's rule); integers are invariant-culture within an inclusive range; choice
|
||||
| `ui.minimize_to_tray` | bool | `0` | | UI (PR-8) |
|
||||
| `ui.hide_anticheat_hooking` | bool | `1` | | UI (beta.8, 2026-09-25): the game page of an entry the guard found anti-cheat in shows the finding in place of its Hooking card (`08_UI` §Game detail) |
|
||||
| `ui.fps_decimals` | bool | `0` | | UI (beta.8, 2026-09-25): every FPS figure with two decimals ("62.40") instead of a whole number |
|
||||
| `ui.hide_scrollbars` | bool | `0` | | UI (beta.14, 2026-10-05): no scroll bar drawn anywhere; every scroller still scrolls with the wheel, the keyboard and touch (`App.Services.ScrollBarHiding`, `08_UI` §Settings) |
|
||||
| `ui.library_view` | choice `grid`\|`list` | `grid` | | UI (beta.11, 2026-10-03): the Games library as a grid of cards that fills the width, or as a list; written by the page's own switch, no Settings row (`08_UI` §Games) |
|
||||
| `capture.background` | bool | `1` | | ~~Agent~~ nobody *(corrected 2026-10-04: no Agent code ever read it, so the watcher recorded every tracked game whatever it said; beta.12 removed its switch from Settings and reserved the key — `SettingsRegistry.CaptureBackground`)* |
|
||||
| `hooking.kill_switch` | bool | `0` | | Agent (FR-2.4, since P2 PR-F) |
|
||||
@@ -423,7 +424,7 @@ switch's rule); integers are invariant-culture within an inclusive range; choice
|
||||
| `capture.min_session_s` | int | `30` | 5–600 | Agent, per session (FR-3.6) |
|
||||
| `telemetry.interval_ms` | int | `1000` | 500–2000 | Agent, per session (FR-3.5) |
|
||||
| `retention.raw_sessions_per_game` | int | `20` | 0–10000; **0 = unlimited** | Agent, per session (§Retention) |
|
||||
| `update.channel` | choice | `stable` | `stable` · `beta` | UI (P4 PR-5 reads it: `beta` = GitHub pre-releases too) |
|
||||
| `update.channel` | choice | ~~`stable`~~ `auto` (beta.14, D47) | `auto` · `stable` · `beta` | UI (P4 PR-5 reads it: `beta` = GitHub pre-releases too; `auto` follows the running copy, a pre-release asking for pre-releases — `11_UPDATER` §The update audit) |
|
||||
| `update.auto_check` | bool | `1` | | UI (P4 PR-5: the startup silent check, `11_UPDATER` §Flow "if enabled") |
|
||||
| `privacy.online_metadata` | bool | `0` | | *reserved* — no consumer and, since 2026-09-16, no toggle on Settings either: the store request it would enable has no code (CLAUDE.md rule 8), and PRIVACY_POLICY 2.2 removed the row that described it |
|
||||
| `log.debug` | bool | `0` | | UI |
|
||||
|
||||
+29
-1
@@ -552,6 +552,16 @@ Tail view of `ui-*.log` / `agent-*.log` (toggle), level filter, search (`ui:Auto
|
||||
> `PagesLoadTests`.
|
||||
|
||||
### Settings
|
||||
> **beta.14 (owner request 2026-10-05: "an option to hide the scroll bars but still scroll").** The Window section has
|
||||
> **Hide scroll bars** (`ui.hide_scrollbars`, off by default). A bar's visibility is bound inside its scroller's template,
|
||||
> which no style reaches, so `Services.ScrollBarHiding` sets the scrollers themselves: one class handler on
|
||||
> `ScrollViewer`'s Loaded (registered at start beside `DialogKeyboard`) reaches every scroller the App shows, those inside a
|
||||
> DataGrid, a TextBox, a rendered document and a dialog included. While on, an axis that is `Auto` or `Visible` becomes
|
||||
> `Hidden` — WPF's "no bar, still scrolls": wheel, keyboard and touch — and its own value is kept on it; a `Disabled` axis is
|
||||
> never touched (it lays its content out at the viewport's width). The toggle applies to the open windows at once, and off
|
||||
> puts every kept value back. Tests: `ScrollBarHidingTests` (on hides every bar and the wheel still scrolls; off restores
|
||||
> each; a scroller that loads later follows), `SettingsViewModelTests.HidingScrollBars…`.
|
||||
|
||||
> **beta.11 (owner request 2026-10-03: "remove the Settings rows that have no button or similar").** Every row has a control
|
||||
> now: the *Games with hooking on* card shows only while a game has hooking on (its empty sentence is gone); the *Elevation*
|
||||
> card is gone and its state is the third line of *Run the agent as administrator* (its explanation a tooltip on it); the
|
||||
@@ -599,7 +609,7 @@ Agent section: elevation state with a plain explanation of what elevation *optio
|
||||
> `Infrastructure.Startup.RunAtLogon` — this user's `HKCU\…\Run` value, quoted executable path, never HKLM —
|
||||
> and the Run entry is the truth the toggle loads from; "Minimize to tray on close" is stored now and honoured
|
||||
> when the tray exists. **Privacy:** ~~`privacy.online_metadata`, off by default, with the network sentence~~ — the card is not shown since 2026-09-16 (no code makes the request; the setting stays reserved).
|
||||
> **Updates:** `update.channel` is read by PR-5's updater (beta = GitHub pre-releases), and `update.auto_check` — the startup check, on by default — sits beside it. **Logging:** `log.debug` moves this app's `LoggingLevelSwitch` at
|
||||
> **Updates:** `update.channel` is read by PR-5's updater (beta = GitHub pre-releases; since beta.14 *Automatic (Beta)* or *(Stable)* first, the default, following the running copy — D47), and `update.auto_check` — the startup check, on by default — sits beside it. **Logging:** `log.debug` moves this app's `LoggingLevelSwitch` at
|
||||
> once; the Agent has no reader for the key yet, and the row says so. **Legal:** reopen is a "not yet" line
|
||||
> until PR-9's gate exists. ~~Register/Unregister the layer, Register/Repair/Remove the task~~ — PR-8b, with the
|
||||
> Agent flags they need. Tests: `SettingsViewModelTests` (seven cases), `RunAtLogonTests` (Infrastructure, under
|
||||
@@ -676,6 +686,12 @@ Agent section: elevation state with a plain explanation of what elevation *optio
|
||||
- Keyboard: ~~NavigationView items Ctrl+1…5; grids fully navigable; Esc closes flyouts/dialogs~~ — §Accessibility below, since P4 PR-8 (2026-09-15); this bullet named three behaviours and none of them was built or checked.
|
||||
- No blocking dialogs during capture; errors surface as InfoBars/tray toasts.
|
||||
- Charts and stat numbers use culture-aware formatting per active UI culture (09); colors only from theme resources or the per-theme chart palette (16 §ScottPlot).
|
||||
- **The mouse wheel scrolls whatever is under the pointer (beta.14).** Every page scrolls itself
|
||||
(`ScrollViewer.CanContentScroll="False"` on the `Page` — `16_WPFUI_SYNTAX` §Gotchas: until beta.14 the wheel scrolled
|
||||
nothing on five pages, and the Logs tail did not follow the newest line); a scroller nested in a dialog hands the wheel
|
||||
on at its ends (`ui:PassiveScrollViewer`); over a chart a plain wheel scrolls the page and **Ctrl+wheel zooms the chart**
|
||||
(`Charts/ChartWheel`, every plot through `ChartTheme.Attach`) — drag still pans and double-click still resets, as
|
||||
ScottPlot does. The import checklist scrolls inside its list and nowhere else, so its intro and its count stay put.
|
||||
|
||||
## Accessibility
|
||||
|
||||
@@ -743,6 +759,18 @@ palette per theme, chosen with the theme).
|
||||
> primary text, ≈ 12:1) but **clipping** — the pill sat in a star column with no trimming, so a sentence-length
|
||||
> qualifier overflowed the row. The qualifier text trims with an ellipsis at 260 px (the readout's tooltip carries the
|
||||
> full sentence), and the row's readout column is sized to content with the game's name trimming first.
|
||||
>
|
||||
> **A third hole, closed 2026-10-05 (beta.14; the owner's screenshot of File ▸ Import library in the dark theme: every
|
||||
> row white, its text invisible, each tick box a sliver).** A style `BasedOn="{StaticResource {x:Type DataGridRow}}"`,
|
||||
> added in beta.11 to dim the rows already in the library: WPF UI 4.3.0 keys its row style `DefaultDataGridRowStyle`
|
||||
> and defines no implicit one, so the lookup fell through to Aero2's row and its `SystemColors.WindowBrush` — a white no
|
||||
> theme reaches, under the dark theme's white text. No `#` in our XAML, no palette badge: neither check above could see
|
||||
> it, and light-theme rows read fine. The tick boxes were WPF UI's `CheckBox` (`MinWidth` 120, padding 11) in a 40 px
|
||||
> column. Held three ways: `AccessibilityTests.NoStyleIsBasedOnAnImplicitStyleTheThemeDoesNotDefine` (every `BasedOn`
|
||||
> type has a style in the App's dictionaries), `ImportReviewRenderTests` (the rendered dialog, both themes: every cell's
|
||||
> text against the composited colour painted under it ≥ 4.5:1, each ticked box drawn whole), and
|
||||
> `AccessibilityTests.NoDataGridCheckBoxColumn` (Compare's checkbox column drew an Aero2 box). Each went red on the
|
||||
> unfixed XAML before it went green.
|
||||
|
||||
### DPI
|
||||
|
||||
|
||||
+51
-2
@@ -1,6 +1,6 @@
|
||||
# 11 — Updater
|
||||
|
||||
Velopack, feeding from GitHub Releases of `https://github.com/poli0981/frameledger`. ~~Stable channel only in v1.~~ *(Corrected 2026-10-04: two channels since P4 PR-5 — `update.channel`, stable by default or beta, which adds pre-releases. Every release so far is a pre-release; see §Built, Channels.)*
|
||||
Velopack, feeding from GitHub Releases of `https://github.com/poli0981/frameledger`. ~~Stable channel only in v1.~~ *(Corrected 2026-10-04: two channels since P4 PR-5 — `update.channel`, ~~stable by default~~ or beta, which adds pre-releases. Every release so far is a pre-release; see §Built, Channels.)* *(Corrected 2026-10-05: the default is `auto` since beta.14, which follows the running copy — §The update audit, beta.14.)*
|
||||
|
||||
## Flow
|
||||
|
||||
@@ -29,7 +29,12 @@ All update HTTP goes through one `GitHubHttpClient` (also used by rules updates)
|
||||
|
||||
Binaries are not code-signed (project policy). Consequences and mitigations, documented in README and the update dialog footer:
|
||||
- SmartScreen warning on first run of a new version — expected; SHA-256 checksums (`SHA256SUMS.txt`) published with every release; CI prints them into release notes.
|
||||
- ~~Velopack delta packages reduce download size; full package fallback automatic.~~ *(Corrected 2026-10-04: no delta has been published — `release.yml` never puts the previous release in `out/release` before `vpk pack`, so every update downloads the full package; a delta needs a `vpk download github` step first.)*
|
||||
- ~~Velopack delta packages reduce download size; full package fallback automatic.~~ *(Corrected 2026-10-04: no delta has been published — `release.yml` never puts the previous release in `out/release` before `vpk pack`, so every update downloads the full package; a delta needs a `vpk download github` step first.)* **Built in beta.13:**
|
||||
`release.yml` downloads the previous release into `out/release` before `vpk pack`, so a release carries
|
||||
`FrameLedger.App-<version>-delta.nupkg` beside the full package; the previous full package is moved out (neither uploaded
|
||||
nor checksummed) and the feed lists this build alone, as `vpk upload github` would write it. Velopack applies the delta
|
||||
when the installed copy is the previous release and falls back to the full package otherwise — `0.1.0-beta.13` is the
|
||||
first release with one, so beta.12 → beta.13 is the first update that can use it (owner-only: HANDOFF item 10).
|
||||
- Never bypass or suppress OS warnings programmatically.
|
||||
|
||||
## Versioning
|
||||
@@ -106,6 +111,50 @@ flow, and the tests run the flow over a fake client because nothing here may tou
|
||||
longer claims the updater provides one.
|
||||
- ~~Release notes are rendered as plain text, not Markdown.~~ Corrected 2026-10-03: rendered since beta.12 (Markdig; HTML off, no image fetched).
|
||||
|
||||
## The update audit, beta.14 (owner request 2026-10-05: "check the update logic")
|
||||
|
||||
No failure had been reported; the audit read the flow above against Velopack 1.2.0 and the owner's own updater log
|
||||
(`%LOCALAPPDATA%\velopack\velopack_FrameLedger.App.log`, read-only) and found two defects that made the flow above
|
||||
partly fiction, and six smaller ones. Each is fixed in place:
|
||||
|
||||
- **A copy left on its defaults never found an update.** `update.channel` defaulted to `stable` while every release is a
|
||||
GitHub pre-release; the owner's log reads "No releases found" from the day their ledger (and its settings row) was reset.
|
||||
**Owner decision D47:** the default is `auto`, which follows the running copy — a pre-release asks for pre-releases, a
|
||||
release for releases (`Update/UpdateChannelPolicy`, SemVer's `-` before any `+`) — and a stored `stable` or `beta` is the
|
||||
user's choice and wins. Settings shows *Automatic (Beta)* or *(Stable)* first. Only an explicit selection ever wrote the
|
||||
row (`SettingsViewModel.Persist` is guarded while loading), so existing copies with no row move to `auto`.
|
||||
- **Velopack applied a downloaded update at the next start, behind FR-12.** `VelopackApp` applies a package waiting in
|
||||
the install folder on startup unless told not to (`SetAutoApplyOnStartup`, ON by default), and the startup check
|
||||
downloads in the background — so the next start of `FrameLedger.exe` (the Start menu, the logon Run value, a second
|
||||
click, `--diag`) applied it inside `VelopackApp.Run()`, before the single-instance claim, before FR-12 could ask
|
||||
whether a session runs, and before the Agent was asked to stop; its updater killed the Agent instead (the owner's log:
|
||||
"Auto apply is true, so restarting to apply update…", then "Killing process: …FrameLedger.Agent.exe"). Off now
|
||||
(`VelopackHooks`, pinned by `VelopackHooksTests` through the builder's private fields); a package an earlier run left
|
||||
is adopted at start — `UpdateService.AdoptPending`, from `UpdateManager.UpdatePendingRestart`, no feed request — and is
|
||||
Ready or Deferred like any other.
|
||||
- **An update Velopack starts itself** (the installer run over an installed copy) asks the Agent to stop first, as the
|
||||
uninstaller does (`OnBeforeUpdateFastCallback`, 15 s budget, a line in `logs\update.log`). The hook runs in the
|
||||
version being replaced, so it first works for the update after beta.14.
|
||||
- **The apply waits while a game still has the Overlay loaded** from the install folder (`Update/PayloadInUse`: a mapped
|
||||
image refuses an exclusive write — a file-system question, no process opened). The Overlay is never unloaded from a
|
||||
live game (`17_HOOK_ENGINE`), so after a mid-game stop the swap would fail half way after the App had quit. Asked before
|
||||
the Agent is stopped; the strip names the file.
|
||||
- **An Agent waiting on the administrator prompt** (the logon task's, the admin mode) holds only its elevation marker, not
|
||||
the instance lock; the apply now waits for either (`UpdateService.AgentHolds`).
|
||||
- **The stop budget is the Agent's own shutdown grace and five seconds** (`IpcProtocol.AgentShutdownGrace`, 15 s, which
|
||||
the Agent's host now reads too): the App waited 10 s for an Agent that took up to 15 to finalize its sessions.
|
||||
- **The offer says the download Velopack will make:** the deltas from the installed version when the feed has them
|
||||
(`UpdateInfo.DeltasToTarget`; 1.6 MB for beta.12 → beta.13) and the full package as the fallback — it said ~102 MB.
|
||||
Velopack's own lines are in the App's log since beta.14 (`velopack: …`, `VelopackSerilogLogger`), so whether a delta
|
||||
or the full package came is in the bug report too.
|
||||
- **Smaller:** an `IOException` is "offline" only from the network (`HttpIOException`, a socket error) — a full disk
|
||||
read as offline; the uninstaller removes the "Start FrameLedger with Windows" Run value, which named an executable it
|
||||
deletes.
|
||||
|
||||
**What none of this reaches:** a copy still on 0.1.0-beta.13 or older runs its own code for the update to beta.14 —
|
||||
stable by default, apply-at-start on. Its user chooses *Beta* in Settings ▸ Updates and updates with no game running
|
||||
(the beta.14 release notes say so); everything above holds from beta.14 on.
|
||||
|
||||
`UpdateServiceTests` (App.Tests/Update) cover the two skips, the channels, Deferred ↔ Ready, each error row, and
|
||||
the apply's three endings; `UpdateFailureMapperTests` the table; `UninstallHookTests` the hook; ~~a real feed has
|
||||
not been exercised — the first tag is the measurement~~ *(corrected 2026-10-04: the feed has existed since
|
||||
|
||||
+2
-1
@@ -180,6 +180,7 @@ assumed to.
|
||||
cmake --build --preset x64-release
|
||||
dotnet publish src/FrameLedger.App -c Release -r win-x64 --self-contained -p:PublishReadyToRun=true -p:FrameLedgerSourceRef={tag} -o out/app
|
||||
dotnet publish src/FrameLedger.Agent -c Release -r win-x64 --self-contained -p:PublishReadyToRun=true -o out/app
|
||||
vpk download github --repoUrl https://github.com/poli0981/frameledger --channel win --pre --outputDir out/release # beta.13: the previous release, for a delta
|
||||
vpk pack --packId FrameLedger.App --packVersion {ver} --packDir out/app --mainExe FrameLedger.exe --packTitle FrameLedger --packAuthors FrameLedger --releaseNotes out/notes.md --outputDir out/release
|
||||
```
|
||||
|
||||
@@ -223,7 +224,7 @@ vpk pack --packId FrameLedger.App --packVersion {ver} --packDir out/app --mainEx
|
||||
|
||||
- No trimming (WPF + reflection), no NativeAOT (WPF unsupported), **no obfuscation** (GPLv3 policy, and `19_SAFETY` forbids making our binaries harder to identify).
|
||||
- `SatelliteResourceLanguages=en;vi;ja`. ~~Expected package ≈ 95–130 MB self-contained.~~ **Measured 2026-09-14 (P4 PR-5): the published tree is 250 MB in 362 files** (App + Agent, self-contained, ReadyToRun roughly doubles the IL). `vpk pack` 1.2.0 over that tree, run by hand the same day with the workflow's arguments: `FrameLedger.App-win-Setup.exe` **104 MB**, the full `.nupkg` and the portable zip 100 MB each, plus `releases.win.json` / `RELEASES` / `assets.win.json`; vpk's own pre-process step verified `VelopackApp.Run()` in `FrameLedger.App.Program::Main()`. **From the hosted runner on the first tag (2026-09-16, `v0.1.0-beta.1`):** the tree 252 MB, `Setup.exe` 110 MB, the nupkg and the zip 105 MB — the same shape, a few MB heavier for two more days of code.
|
||||
- Velopack hooks (**built 2026-09-14, P4 PR-5**: `App/Update/VelopackHooks`, wired in the hand-written `Program.Main` before any window). **Install registers nothing** — the first-run flow is the offer (Agent setup), and the layer follows the ledger (§The Vulkan layer is not registered at install time); this line used to say "offer Agent setup + Vulkan layer registration", and the second half was the thing the section below forbids. Uninstall runs `UninstallHook`: `Shutdown` to a running Agent over the pipe (best effort, it holds the install directory), unregister the layer (HKCU), remove the logon task, then **ask** about the data folder — deleted on Yes only, never when it and the install overlap (`AreSeparate`), and a question unanswered inside Velopack's 30 s callback budget keeps it.
|
||||
- Velopack hooks (**built 2026-09-14, P4 PR-5**: `App/Update/VelopackHooks`, wired in the hand-written `Program.Main` before any window; since beta.14 Velopack's apply-at-start is off and an update it starts itself stops the Agent first — `11_UPDATER` §The update audit). **Install registers nothing** — the first-run flow is the offer (Agent setup), and the layer follows the ledger (§The Vulkan layer is not registered at install time); this line used to say "offer Agent setup + Vulkan layer registration", and the second half was the thing the section below forbids. Uninstall runs `UninstallHook`: `Shutdown` to a running Agent over the pipe (best effort, it holds the install directory), unregister the layer (HKCU), remove the logon task, remove the *Start FrameLedger with Windows* Run value (beta.14 — it named the executable being deleted), then **ask** about the data folder — deleted on Yes only, never when it and the install overlap (`AreSeparate`), and a question unanswered inside Velopack's 30 s callback budget keeps it.
|
||||
|
||||
## Release-time token substitution
|
||||
|
||||
|
||||
@@ -136,6 +136,11 @@ FrameLedger uses the **`poli0981/.github` ops repo** where its templates fit, an
|
||||
`versioninfo-check` lists (`FrameLedger.ProcessStats.dll` since beta.12 — corrected 2026-10-04), `rules/detection-rules.json`; `FrameLedger.CaptureHost.exe` absent (`12_BUILD`:
|
||||
exactly two roots — `package-closure-check` proves it statically, this reads the directory); `versioninfo-check`
|
||||
run again over `out/app`, because a `.targets`-staged DLL that failed to copy is a warning to `dotnet publish`.
|
||||
- **since beta.13, `vpk download github --pre` first**, so `vpk pack` finds the previous release's full package in
|
||||
`out/release` and writes a delta; after the pack, what `assets.win.json` names is kept and the rest (the previous full
|
||||
package) moves to `out/previous`, the feed and `RELEASES` are filtered to this build, and a downloaded previous package
|
||||
with no delta beside it fails the job. A failed download is a warning: the release is full-only, as every one before it
|
||||
was (`11_UPDATER` §Built).
|
||||
- `vpk pack --packId FrameLedger.App` (the `vpk` tool pinned to the library's 1.2.0) with the release notes;
|
||||
`FrameLedger.App-win-Setup.exe` must come out, because README §Install names it. **Not `--packId FrameLedger`**:
|
||||
Velopack installs into and uninstalls `%LOCALAPPDATA%\<packId>`, which with that id is the data folder
|
||||
|
||||
+14
-1
@@ -44,6 +44,18 @@ The anti-cheat guard is the one component where a bug can cost someone an accoun
|
||||
- Blob codecs round-trip for every series in `frame_blobs` (NaN forbidden — assert), including the two-pair `render_res` encoding and the three-bit `rt_flags` byte. SQLite migrations apply cleanly from an empty file to the current schema, and re-applying is a no-op. (There is no v1→v2 upgrade to test — `06_DATA_MODEL` §Migrations.)
|
||||
- IPC pipe: framing, split reads, oversize rejection, unknown fields/types ignored, protocol mismatch.
|
||||
|
||||
### What the App draws (beta.14)
|
||||
|
||||
A page or dialog that only *loads* has proved nothing about how it looks: `PagesLoadTests` counted the import list's
|
||||
rows while every row was white text on white in the dark theme (`08_UI` §Contrast). The rendered checks run on the one
|
||||
STA thread with the App's three dictionaries (`PagesLoadTests.OnStaAsync`) and look at the result: `Visuals` lays a
|
||||
control out at a window's size, pumps the dispatcher (a `NavigationViewContentPresenter`'s navigation), swaps the theme
|
||||
dictionary for one check and puts Dark back, and composites every Border and Panel background between a text and the
|
||||
window into the colour actually painted under it; `Wcag` is the arithmetic. `ImportReviewRenderTests` measures each text
|
||||
cell against that colour in both themes and counts the accent pixels of each ticked box in a `RenderTargetBitmap`; the
|
||||
paging checks navigate a real page in WPF UI's presenter and send it the wheel. Each was run red against the unfixed XAML
|
||||
first — a rendered check that cannot fail is the counted-rows check again.
|
||||
|
||||
## Integration tests (CI-runnable, no game, no anti-cheat surface)
|
||||
|
||||
`hook-harness` is what makes this architecture testable without touching a real title:
|
||||
@@ -131,7 +143,8 @@ that it was checked against anything.
|
||||
| Mode | launch mode · attach mode · mid-session settings change |
|
||||
| Safety | game with anti-cheat → toggle disabled · simulated late AC load → unhook · double-crash → auto-disable |
|
||||
| Tier | forced Tier 2 (records duration, available sensors and the reason — and nothing else) · Tier 1 → Tier 2 degradation notice |
|
||||
| Update | Velopack delta; update deferred while a game is hooked (FR-12) — *a delta needs a previous release, so this row is reachable from the second release, not the first* *(corrected 2026-10-04: no release has carried a delta — `release.yml` never fetches the previous release before `vpk pack`, `11_UPDATER` §Built — so the update leg is a full package)* |
|
||||
| Update | Velopack delta; update deferred while a game is hooked (FR-12) — *a delta needs a previous release, so this row is reachable from the second release, not the first* *(corrected 2026-10-04: no release has carried a delta — `release.yml` never fetches the previous release before `vpk pack`, `11_UPDATER` §Built — so the update leg is a full package; **since beta.13** a release carries a delta against the previous one, and the first
|
||||
update that can use it is beta.12 → beta.13 — HANDOFF owner-only item 10)* |
|
||||
|
||||
## Release smoke
|
||||
|
||||
|
||||
+30
-2
@@ -132,9 +132,9 @@ Code-behind wires services once: `navigationService.SetNavigationControl(RootNav
|
||||
| Busy | `ui:ProgressRing` | |
|
||||
| Contextual popup | `ui:Flyout` | Popup hand-rolling |
|
||||
| Hyperlink-ish | `ui:HyperlinkButton`, `ui:Anchor` | |
|
||||
| Grid of records | native `DataGrid` (WPF UI restyles it) | third-party grids |
|
||||
| Grid of records | native `DataGrid` (WPF UI restyles it — through the grid's own `RowStyle`/`CellStyle`/`ColumnHeaderStyle` setters, so a local one is based on WPF UI's keyed style: §Gotchas, added 2026-10-05) | third-party grids |
|
||||
|
||||
Native `Menu`, `TabControl`, `ComboBox`, `Slider`, `ListView` are fine — the `ControlsDictionary` restyles standard WPF controls to Fluent automatically.
|
||||
Native `Menu`, `TabControl`, `ComboBox`, `Slider`~~, `ListView`~~ are fine — the `ControlsDictionary` restyles standard WPF controls to Fluent automatically. *(Corrected 2026-10-05: 4.3.0 has no implicit style for the native `ListView`, `ListViewItem` or `GridViewColumnHeader` — only `ui:ListView` is restyled — nor for `DataGridRow`, `DataGridCell`, `DataGridColumnHeader` or `FlowDocumentScrollViewer`; read from the loaded `ControlsDictionary`.)*
|
||||
|
||||
## Icons
|
||||
|
||||
@@ -227,6 +227,34 @@ On startup and on `ApplicationThemeManager.Changed`: for every live plot set fig
|
||||
bar with no exit, which is exactly how the safety notices shipped (2026-09-14). `Styles/FrameLedger.xaml` carries
|
||||
the upstream template plus one presenter column; `PagesLoadTests.TheInfoBarTemplateRendersItsContent` renders both
|
||||
templates and turns red when upstream gains a presenter, which is when the copy comes out.
|
||||
- [ ] **WPF UI 4.3.0 keys its DataGrid parts' styles and defines no implicit one** (`DefaultDataGridRowStyle`,
|
||||
`DefaultDataGridCellStyle`, `DefaultDataGridColumnHeaderStyle`, handed to the grid by its implicit `DataGrid` style's
|
||||
`RowStyle`/`CellStyle`/`ColumnHeaderStyle` setters). A local `RowStyle` replaces WPF UI's; based on
|
||||
`{StaticResource {x:Type DataGridRow}}` it falls through to Aero2's row, whose `SystemColors.WindowBrush` no theme
|
||||
reaches: the import list was white text on white in the dark theme (owner's screenshot, beta.14). Base it on
|
||||
`DefaultDataGridRowStyle`. `AccessibilityTests.NoStyleIsBasedOnAnImplicitStyleTheThemeDoesNotDefine` refuses any
|
||||
`BasedOn` a type the App's dictionaries hold no style for, and `ImportReviewRenderTests` measures the rendered rows.
|
||||
- [ ] **WPF UI's `CheckBox` is `MinWidth` 120 with an 11 px padding**: in a narrow grid column it draws a sliver of the box.
|
||||
`MinWidth="0" Padding="0"` there. A `DataGridCheckBoxColumn` uses WPF's own element style, an Aero2 box — use a template
|
||||
column (`AccessibilityTests.NoDataGridCheckBoxColumn`).
|
||||
- [ ] **Every page sets `ScrollViewer.CanContentScroll="False"`.** `NavigationViewContentPresenter` changes that property's
|
||||
default to true for `Page` and, on each navigation, wraps a page that keeps it in a `DynamicScrollViewer`. A page with
|
||||
its own root `ScrollViewer` inside that wrapper has infinite height, nothing to scroll — and a stock `ScrollViewer`
|
||||
marks every wheel handled even then, so the wheel scrolled nothing on five pages until beta.14 (owner: "I have to drag
|
||||
the scroll bar"); the Logs tail grew to hold every line and never followed the end.
|
||||
`AccessibilityTests.EveryPageOptsOutOfTheDynamicScrollViewer`, `PagesLoadTests.ANavigatedPageIsNot…`.
|
||||
- [ ] **A stock `ScrollViewer` nested in a scroller takes the wheel at its ends too.** Inside a dialog use
|
||||
`ui:PassiveScrollViewer`, which hands the wheel on when it cannot scroll (`AccessibilityTests.NoPlainScrollViewerInsideADialog`).
|
||||
A `ContentDialog` whose content should not scroll as a whole sets `ScrollViewer.VerticalScrollBarVisibility="Disabled"`
|
||||
on the dialog: its content row then has the window's height, and a `*` row inside it can hold a list that scrolls alone
|
||||
(`ImportReviewPrompt`).
|
||||
- [ ] **ScottPlot 5 zooms on every wheel and never marks it handled.** Without `Charts/ChartWheel` a wheel over a chart
|
||||
zoomed it and scrolled the page at once; a plain wheel is the page's, Ctrl+wheel the chart's, for every plot that
|
||||
`ChartTheme.Attach` registers.
|
||||
- [ ] **A scroll bar's visibility is bound inside its scroller's template** (`ComputedVerticalScrollBarVisibility`), so a style
|
||||
on `ScrollBar` or `ui:DynamicScrollBar` cannot hide it. Set the scroller's own `ScrollBarVisibility` to `Hidden` — no
|
||||
bar, and the wheel, the keyboard and touch still scroll (`ui:PassiveScrollViewer` treats only `Disabled` as "cannot
|
||||
scroll") — as `Services.ScrollBarHiding` does for `ui.hide_scrollbars` (beta.14).
|
||||
- [ ] **No dialog in 4.3.0 closes on Esc.** Neither `ContentDialog.cs` nor `MessageBox.cs` at the 4.3.0 tag handles a
|
||||
key (read 2026-09-15), and `ContentDialog.CloseButtonText` DEFAULTS to "Close" — an empty string is how a dialog
|
||||
says it has no Close button. `MessageBox.Close()` is `[Obsolete("Use Close with MessageBoxResult instead")]` while no
|
||||
|
||||
+46
-3
@@ -1804,7 +1804,7 @@ library and the import, PR-4 delete sessions, the charts across sessions and the
|
||||
|
||||
**Owner-only, added to the list below:** item 8.
|
||||
|
||||
## **START HERE** — 2026-10-04, the beta.12 train: the game's own memory, rendered documents, a user guide, the legal split
|
||||
## ~~**START HERE**~~ — 2026-10-04, the beta.12 train: the game's own memory, rendered documents, a user guide, the legal split *(struck the same day: the head is §beta.13 below)*
|
||||
|
||||
*Status is `CHANGELOG.md` `[0.1.0-beta.12]`; this is what no other file carries. The approved plan was eight PRs: PR-0 the
|
||||
recorder test that went red on a loaded runner, PR-1 `NOTICE` and the licence header (D45), PR-2 the game's memory
|
||||
@@ -1836,7 +1836,8 @@ PR-7 the release.*
|
||||
in the local gate (`LhmRealHardwareTests` beside `PrivilegeFootprintTests`); the Agent's own read was already behind a
|
||||
catch. The two test classes share a collection now.
|
||||
- **A test reading resource text outside the culture collection** races a class that flips `Strings.Culture`; a class
|
||||
that adds many flips (`GameMemoryTextTests`) makes it likelier. `GamesViewModelTests` moved in; the rest are a chip.
|
||||
that adds many flips (`GameMemoryTextTests`) makes it likelier. `GamesViewModelTests` moved in; the rest are a chip. *(Ended in beta.13: the
|
||||
collection runs alone.)*
|
||||
- **`ShmDrainIntegrationTests.AnUnhookRequestStops…` failed once on CI at the injection step** (≈1 s, `IsAllowed`
|
||||
false) and passed on the re-run; it passed on the PR before. A flake to watch, not yet a fix.
|
||||
- **Markdig follows the table spec strictly**: a line without cells between a table's rows ends the table, and GitHub
|
||||
@@ -1863,10 +1864,46 @@ PR-7 the release.*
|
||||
- **The audits (PR-6) found code gaps the docs had been describing as built**, each left for its own PR and named
|
||||
here so it is not rediscovered: L1 telemetry is never pointed at the game's adapter (`SelectAdapter` has no caller,
|
||||
`18_GPU_VENDOR_APIS`); a machine-wide service refusal still says "detected in this game" (§S23-3, 🔴); no release
|
||||
has carried a Velopack delta (`release.yml` never fetches the previous release); there is no rules feed (§S20).
|
||||
has carried a Velopack delta (`release.yml` never fetches the previous release); there is no rules feed (§S20). *(Three of the four closed in
|
||||
beta.13 — §S23-3, the adapter, the delta; the rules feed stays.)*
|
||||
|
||||
**Owner-only, added to the list below:** item 9.
|
||||
|
||||
## **START HERE** — 2026-10-04, the beta.13 train: the four follow-ups the beta.12 audit left
|
||||
|
||||
*Status is `CHANGELOG.md` `[0.1.0-beta.13]`; this is what no other file carries. The owner asked (2026-10-04) for the
|
||||
four chips the beta.12 documentation audit had left — §S23-3's wording, the App tests' culture races, L1's adapter, the
|
||||
Velopack delta — then a release and the session closed. Two PRs: PR-1 the three code changes, PR-2 the release with the
|
||||
delta in `release.yml`.*
|
||||
|
||||
**No new owner decision.** The choices below follow rules already written: a figure from the wrong graphics card is worse
|
||||
than N/A (`FlShmHandshake.AdapterLuid`'s own comment), and a finding on the PC is not a finding in the game (§S23-3,
|
||||
2026-09-06).
|
||||
|
||||
**Traps met on the way:**
|
||||
|
||||
- **Pointing L1 at the game's adapter changes nothing visible on its own**: `CompositeTelemetrySource` merges L3 > L2 >
|
||||
L1 per field, and L2 (LibreHardwareMonitor's first GPU node) and L3 (NVAPI's first physical GPU) read their own card.
|
||||
Every layer has to agree on the card — L1 by LUID (`IGpuAdapterSelector`), the others by the adapter's vendor
|
||||
(`IGpuVendorFollower`), and L3 says nothing for an AMD or Intel adapter. Two GPUs of one vendor stay first-found.
|
||||
- **A `CaptureRefused`'s `reason` is the session's end reason** (`RefusedByGuard`), not the guard's: the App could not
|
||||
tell a service from a module until the events carried `guardReason`. A `RefusedAck`'s `Reason`, by contrast, IS the
|
||||
guard's — two "reason" fields one pipe apart that mean different things.
|
||||
- **A collection definition must be public** (xUnit1027), which CA1515 then flags in a test project that is an exe — the
|
||||
suppression carries the reason. `TestContext.Current.TestCollection.TestCollectionClassName` proves the definition
|
||||
bound, so a definition xUnit did not find fails a test instead of bringing the races back silently.
|
||||
- **`vpk download github --pre` puts the previous release's full package in `out/release`**: `vpk pack` needs it there to
|
||||
write a delta, and nothing else may ship it — `assets.win.json` names what this pack built, the rest moves to
|
||||
`out/previous`, and the feed and `RELEASES` are filtered to this build, as `vpk upload github` writes them.
|
||||
- **A 120 ms wall-clock ceiling races the second scan on a loaded runner**: the release rehearsal failed on
|
||||
`CaptureSessionTests.AGuardThatThrowsMidSessionKeepsTheRecordsItAlreadyDrained`, which ended as `Running` before the
|
||||
guard's second evaluation threw — the class beta.12's PR-0 fixed in the recorder tests. The four tests whose ending is a
|
||||
scan, a throw, the kill switch or an exit take `EndsOnItsOwn` (a 30 s safety net); a test that EXPECTS `Running` keeps
|
||||
the short ceiling, because that ceiling is its ending.
|
||||
- **The beta.12 traps about the culture race and the four code gaps are closed here** (the rules feed stays open, §S20).
|
||||
|
||||
**Owner-only, added to the list below:** item 10.
|
||||
|
||||
## Owner-only — no PR can close these
|
||||
|
||||
1. **§S23-2 — branch protection.** `Rules / validate` is not a required status check on
|
||||
@@ -1925,6 +1962,12 @@ PR-7 the release.*
|
||||
*View on GitHub* opening the `v0.1.0-beta.12` tag. (d) The `ja` strings marked `review` (the memory labels, the
|
||||
About window, the first-start summary). (e) `docs/LIST_GAME_TESTED.md` is as of beta.10: refresh it from a copy of
|
||||
the ledger, with the games' memory figures, and approve it before it is committed (D35).
|
||||
10. **beta.13 on real hardware.** (a) **The first delta:** update an installed `0.1.0-beta.12` through Help ▸ Check for
|
||||
updates — the download is a fraction of the full ~107 MB, and the App comes back as beta.13; if it downloaded the
|
||||
full package instead, say so (Velopack falls back silently). (b) **On this PC:** with an Easy Anti-Cheat service
|
||||
running for any game, start a hook-enabled game — the notice says the anti-cheat is running on this PC, not in
|
||||
the game. (c) **Two graphics cards**, if a machine with them is at hand: the Sensors chart's GPU figures are the
|
||||
game's card. (d) The `ja` review of the new safety strings, with the others still marked for it.
|
||||
|
||||
**Answered 2026-08-05, do not re-ask:** remove `gameguard` and keep `guard` (approved
|
||||
over a red `Rules` gate, with the reasoning recorded in the merge commit); vendor NVAPI
|
||||
|
||||
+7
-3
@@ -36,9 +36,13 @@ The first window walks you through four short steps:
|
||||
## Updates
|
||||
|
||||
A few seconds after it starts, FrameLedger asks GitHub whether a newer version exists. A new version downloads in the
|
||||
background and is installed only when you restart FrameLedger — never while a game is being measured. You can switch
|
||||
the check off in **Settings ▸ Updates ▸ Check for updates at startup**, and check by hand with Help ▸ Check for
|
||||
updates.
|
||||
background and is installed only when you restart FrameLedger — never while a game is being measured, and not while a
|
||||
game it measured earlier is still running. You can switch the check off in **Settings ▸ Updates ▸ Check for updates at
|
||||
startup**, and check by hand with Help ▸ Check for updates.
|
||||
|
||||
**Settings ▸ Updates ▸ Channel** is *Automatic* unless you choose: a test version (a pre-release, like every version so
|
||||
far) looks for test versions, a release looks for releases. Choose *Stable* or *Beta* to decide yourself. Before
|
||||
0.1.0-beta.14 the channel was *Stable* by default and found no version at all — on an older copy, choose *Beta* to update.
|
||||
|
||||
## Uninstall
|
||||
|
||||
|
||||
@@ -44,6 +44,9 @@ correct it by hand — your correction is labelled as yours.
|
||||
Changes to your hardware or driver are marked on it.
|
||||
- **Compare** (in the navigation on the left) — pick sessions, even of different games, and see them side by side.
|
||||
|
||||
To look closer, hold **Ctrl** and turn the mouse wheel over a chart to zoom, drag to pan, and double-click to reset. The
|
||||
wheel alone scrolls the page.
|
||||
|
||||
## Export
|
||||
|
||||
The summary's **Export CSV**, **Export JSON** and **Export PNG** buttons — or File ▸ Export — save a session to a file.
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
HTML comments are not part of the block.
|
||||
-->
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-10-04.** The software is a beta; its latest
|
||||
> **pre-release is `0.1.0-beta.12`** (2026-10-04), an unsigned installer built from that tag with its
|
||||
> **pre-release is `0.1.0-beta.13`** (2026-10-04), an unsigned installer built from that tag with its
|
||||
> checksums published beside it. The source holds the desktop app
|
||||
> (library, store import, charts, settings) and the background Agent, which records a session when a
|
||||
> game in the library runs (unless you switched its recording off), injects only into games you enabled
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ Frame timing is derived from high-resolution timestamps taken at the moment the
|
||||
|
||||
<!-- accuracy-block:begin -->
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-10-04.** The software is a beta; its latest
|
||||
> **pre-release is `0.1.0-beta.12`** (2026-10-04), an unsigned installer built from that tag with its
|
||||
> **pre-release is `0.1.0-beta.13`** (2026-10-04), an unsigned installer built from that tag with its
|
||||
> checksums published beside it. The source holds the desktop app
|
||||
> (library, store import, charts, settings) and the background Agent, which records a session when a
|
||||
> game in the library runs (unless you switched its recording off), injects only into games you enabled
|
||||
|
||||
@@ -353,7 +353,7 @@ internal static class Program
|
||||
builder.Services.AddHostedService<PipeServerHostedService>();
|
||||
// Finalize's grace on shutdown (04_CAPTURE §Threading model): a session that does not make it leaves
|
||||
// its .partial for the next start's recovery.
|
||||
builder.Services.Configure<HostOptions>(static o => o.ShutdownTimeout = TimeSpan.FromSeconds(15));
|
||||
builder.Services.Configure<HostOptions>(static o => o.ShutdownTimeout = Shared.Ipc.IpcProtocol.AgentShutdownGrace);
|
||||
|
||||
using IHost host = builder.Build();
|
||||
AgentConsole.Line($@"serve: ledger {paths.Database}; logs {paths.Logs}; pipe \.\pipe\{Shared.Ipc.IpcProtocol.PipeName}; Ctrl+C stops");
|
||||
|
||||
@@ -78,6 +78,8 @@ public partial class App : System.Windows.Application
|
||||
HookCrashHandlers();
|
||||
// 08_UI §Accessibility (P4 PR-8): Esc closes the open ContentDialog or MessageBox, before any window exists.
|
||||
DialogKeyboard.Register();
|
||||
// beta.14: ui.hide_scrollbars reaches every scroller as it loads, those in a control's template too.
|
||||
ScrollBarHiding.Register();
|
||||
_run = DiagReport.Requested(e.Args) ? DiagAsync() : RunAsync();
|
||||
}
|
||||
|
||||
@@ -102,6 +104,7 @@ public partial class App : System.Windows.Application
|
||||
var registered = new RegisteredSettings(store);
|
||||
LoggingLevel.SetDebug(await registered.GetBooleanAsync(SettingsRegistry.LogDebug).ConfigureAwait(true));
|
||||
FpsDecimals.Two = await registered.GetBooleanAsync(SettingsRegistry.UiFpsDecimals).ConfigureAwait(true);
|
||||
ScrollBarHiding.Apply(await registered.GetBooleanAsync(SettingsRegistry.UiHideScrollBars).ConfigureAwait(true));
|
||||
var closePolicy = new WindowClosePolicy { MinimizeToTray = await registered.GetBooleanAsync(SettingsRegistry.UiMinimizeToTray).ConfigureAwait(true) };
|
||||
|
||||
_host = BuildHost(_db, appearance, registered, closePolicy);
|
||||
|
||||
@@ -70,10 +70,14 @@ public static class ChartTheme
|
||||
(byte)Math.Round((top.B * a) + (under.B * (1 - a))));
|
||||
}
|
||||
|
||||
/// <summary>Registers a control so a theme change re-applies and refreshes it (weakly held; a closed window is forgotten).</summary>
|
||||
/// <summary>
|
||||
/// Registers a control so a theme change re-applies and refreshes it (weakly held; a closed window is forgotten), and
|
||||
/// gives it the App's wheel: a plain wheel scrolls the page, Ctrl+wheel zooms (<see cref="ChartWheel"/>, beta.14).
|
||||
/// </summary>
|
||||
public static void Attach(WpfPlot control)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(control);
|
||||
ChartWheel.Attach(control);
|
||||
lock (_lock)
|
||||
{
|
||||
_live.RemoveAll(static w => !w.TryGetTarget(out _));
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using ScottPlot.WPF;
|
||||
|
||||
namespace FrameLedger.App.Charts;
|
||||
|
||||
/// <summary>
|
||||
/// The mouse wheel over a chart (beta.14). ScottPlot 5's <see cref="WpfPlot"/> zooms on every wheel and never marks it
|
||||
/// handled, so with the pages scrolling again (<c>16_WPFUI_SYNTAX</c> §Gotchas: they did not until beta.14) a wheel over a
|
||||
/// chart would have zoomed it AND scrolled the page under the pointer. A plain wheel now belongs to the page — ScottPlot
|
||||
/// never sees it — and Ctrl+wheel to the chart, which zooms and keeps the page where it is. Every plot reaches this through
|
||||
/// <see cref="ChartTheme.Attach"/>.
|
||||
/// </summary>
|
||||
internal static class ChartWheel
|
||||
{
|
||||
/// <summary>Whether a wheel with these modifier keys zooms the chart rather than scrolling the page: Ctrl held.</summary>
|
||||
public static bool Zooms(ModifierKeys modifiers) => (modifiers & ModifierKeys.Control) == ModifierKeys.Control;
|
||||
|
||||
public static void Attach(WpfPlot plot)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(plot);
|
||||
plot.PreviewMouseWheel += OnPreviewMouseWheel;
|
||||
plot.MouseWheel += OnMouseWheel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The tunnelling half, before ScottPlot's own handler on its inner element: a plain wheel is taken from the plot and
|
||||
/// raised again on the plot's parent, from where it bubbles to the page's scroller as any other wheel would.
|
||||
/// </summary>
|
||||
private static void OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
if (e.Handled || Zooms(Keyboard.Modifiers) || sender is not DependencyObject plot)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
if (VisualTreeHelper.GetParent(plot) is UIElement parent)
|
||||
{
|
||||
parent.RaiseEvent(new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta) { RoutedEvent = UIElement.MouseWheelEvent, Source = sender });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The bubbling half, after ScottPlot has zoomed: Ctrl+wheel stops here, so the page does not scroll as well.</summary>
|
||||
private static void OnMouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
if (Zooms(Keyboard.Modifiers))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,8 @@
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:sp="clr-namespace:ScottPlot.WPF;assembly=ScottPlot.WPF"
|
||||
MinHeight="260">
|
||||
<!-- 08_UI §Session summary / FR-5.1: the frametime timeline, min/max decimated (FR-5.3); zoom and pan are ScottPlot's.
|
||||
<!-- 08_UI §Session summary / FR-5.1: the frametime timeline, min/max decimated (FR-5.3); zoom and pan are ScottPlot's —
|
||||
zoom with Ctrl+wheel since beta.14, a plain wheel scrolls the page (ChartWheel).
|
||||
The note above it says what the lines are not, when that is not obvious (beta.8). -->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
Safety_AdminMode_* only, versioned by AgentAdminDisclosure.Version. It states what the option adds, what it does not
|
||||
change, how Windows asks, and the risk; every colour is a theme brush.
|
||||
-->
|
||||
<ScrollViewer MaxHeight="520" VerticalScrollBarVisibility="Auto">
|
||||
<ui:PassiveScrollViewer MaxHeight="520" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel>
|
||||
<ui:TextBlock Text="{x:Static vm:AgentAdminDialogViewModel.Intro}" TextWrapping="Wrap" />
|
||||
<ui:TextBlock Margin="0,14,0,0" Text="{x:Static vm:AgentAdminDialogViewModel.Adds}" TextWrapping="Wrap" />
|
||||
@@ -34,5 +34,5 @@
|
||||
IsChecked="{Binding Accepted, Mode=TwoWay}" />
|
||||
<ui:TextBlock Margin="0,12,0,0" HorizontalAlignment="Right" Appearance="Tertiary" Text="{x:Static vm:AgentAdminDialogViewModel.Version}" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</ui:PassiveScrollViewer>
|
||||
</UserControl>
|
||||
@@ -16,7 +16,7 @@
|
||||
versioned by AntiCheatExceptionDisclosure.Version. It states why the exception is offered, the risk, what is still
|
||||
refused, how it ends, and that it turns nothing on; it recommends neither choice. Every colour is a theme brush.
|
||||
-->
|
||||
<ScrollViewer MaxHeight="520" VerticalScrollBarVisibility="Auto">
|
||||
<ui:PassiveScrollViewer MaxHeight="520" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel>
|
||||
<ui:TextBlock Text="{Binding Intro}" TextWrapping="Wrap" />
|
||||
<ui:TextBlock Margin="0,14,0,0" Text="{Binding Why}" TextWrapping="Wrap" />
|
||||
@@ -37,5 +37,5 @@
|
||||
Content="{x:Static vm:AntiCheatExceptionDialogViewModel.AcceptText}"
|
||||
IsChecked="{Binding Accepted, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</ui:PassiveScrollViewer>
|
||||
</UserControl>
|
||||
@@ -19,7 +19,7 @@
|
||||
<ui:TextBlock TextWrapping="Wrap" Text="{Binding Intro}" />
|
||||
<Border Margin="0,10,0,10" Padding="10,6" CornerRadius="6"
|
||||
Background="{DynamicResource ControlFillColorDefaultBrush}" BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}" BorderThickness="1">
|
||||
<ScrollViewer MaxHeight="220" VerticalScrollBarVisibility="Auto">
|
||||
<ui:PassiveScrollViewer MaxHeight="220" VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl ItemsSource="{Binding Entries}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@@ -27,7 +27,7 @@
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</ui:PassiveScrollViewer>
|
||||
</Border>
|
||||
<ui:HyperlinkButton Padding="0" Content="{x:Static vm:BugReportPreviewViewModel.ShowZipText}" Command="{Binding ShowZipCommand}" />
|
||||
<ui:TextBlock Margin="0,10,0,0" Appearance="Secondary" TextWrapping="Wrap" Text="{x:Static vm:BugReportPreviewViewModel.DragInstruction}" />
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
tiers are two paragraphs of the same shape, in the order enable / do-not-enable, with nothing between
|
||||
them that reads as a recommendation. Every colour is a theme brush (16_WPFUI §Theming).
|
||||
-->
|
||||
<ScrollViewer MaxHeight="520" VerticalScrollBarVisibility="Auto">
|
||||
<ui:PassiveScrollViewer MaxHeight="520" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel>
|
||||
<ui:TextBlock Text="{x:Static vm:ConsentDialogViewModel.Intro}" TextWrapping="Wrap" />
|
||||
|
||||
@@ -38,5 +38,5 @@
|
||||
Text="{Binding Typed, UpdateSourceTrigger=PropertyChanged}"
|
||||
PlaceholderText="{x:Static vm:ConsentDialogViewModel.Phrase}" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</ui:PassiveScrollViewer>
|
||||
</UserControl>
|
||||
@@ -16,15 +16,30 @@
|
||||
or has no executable cannot be ticked (its box is disabled since beta.11 - before, a tick was taken and ignored).
|
||||
Rows already in the library are hidden unless "Show the N games already in the library" is ticked, and then
|
||||
dimmed. Import never enables hooking (the intro says so).
|
||||
|
||||
beta.14 (owner's screenshot, dark theme): every row was white with white text and every tick box a sliver. The row
|
||||
style was based on {x:Type DataGridRow}, which WPF UI 4.3.0 does not define - it keys its row style
|
||||
DefaultDataGridRowStyle and hands it to the grid through the DataGrid style's RowStyle - so the lookup fell through
|
||||
to Aero2's row template and its SystemColors.WindowBrush, which no theme reaches. The sliver is WPF UI's CheckBox
|
||||
style, MinWidth 120 and padding 11, in a 40 px column: MinWidth 0 and no padding draw the whole box. And the list
|
||||
no longer scrolls inside a dialog that scrolls too: ImportReviewPrompt turns the dialog's own
|
||||
scrolling off, so the grid takes the height the window leaves and is the one thing that scrolls - the intro and the
|
||||
count stay where they are (ImportReviewRenderTests).
|
||||
-->
|
||||
<StackPanel>
|
||||
<ui:TextBlock TextWrapping="Wrap" Text="{x:Static vm:ImportReviewViewModel.Intro}" />
|
||||
<CheckBox Margin="0,8,0,0" Content="{Binding ShowExistingText}" IsChecked="{Binding ShowExisting, Mode=TwoWay}"
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" MinHeight="120" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ui:TextBlock Grid.Row="0" TextWrapping="Wrap" Text="{x:Static vm:ImportReviewViewModel.Intro}" />
|
||||
<CheckBox Grid.Row="1" Margin="0,8,0,0" Content="{Binding ShowExistingText}" IsChecked="{Binding ShowExisting, Mode=TwoWay}"
|
||||
Visibility="{Binding HasExisting, Converter={StaticResource BoolToVis}}" />
|
||||
<DataGrid Margin="0,10,0,8" MaxHeight="360" AutoGenerateColumns="False" CanUserAddRows="False" HeadersVisibility="Column"
|
||||
<DataGrid x:Name="Candidates" Grid.Row="2" Margin="0,10,0,8" AutoGenerateColumns="False" CanUserAddRows="False" HeadersVisibility="Column"
|
||||
ItemsSource="{Binding Shown}" SelectionMode="Single" IsReadOnly="False">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}">
|
||||
<Style TargetType="DataGridRow" BasedOn="{StaticResource DefaultDataGridRowStyle}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsExisting}" Value="True">
|
||||
<Setter Property="Opacity" Value="0.55" />
|
||||
@@ -36,7 +51,7 @@
|
||||
<DataGridTemplateColumn Width="40">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox HorizontalAlignment="Center" IsEnabled="{Binding CanImport}"
|
||||
<CheckBox MinWidth="0" Padding="0" HorizontalAlignment="Center" IsEnabled="{Binding CanImport}"
|
||||
AutomationProperties.Name="{Binding Name}"
|
||||
IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
@@ -48,12 +63,12 @@
|
||||
<DataGridTextColumn Header="{x:Static vm:ImportReviewViewModel.ColumnNote}" Binding="{Binding Note}" IsReadOnly="True" Width="Auto" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<DockPanel>
|
||||
<DockPanel Grid.Row="3">
|
||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
|
||||
<ui:HyperlinkButton Padding="4,0" Content="{x:Static res:Strings.Import_SelectAll}" Command="{Binding SelectAllCommand}" xmlns:res="clr-namespace:FrameLedger.App" />
|
||||
<ui:HyperlinkButton Padding="4,0" Content="{x:Static res:Strings.Import_SelectNone}" Command="{Binding SelectNoneCommand}" xmlns:res="clr-namespace:FrameLedger.App" />
|
||||
</StackPanel>
|
||||
<ui:TextBlock Appearance="Secondary" VerticalAlignment="Center" Text="{Binding SelectedText}" />
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -8,9 +8,10 @@
|
||||
xmlns:res="clr-namespace:FrameLedger.App"
|
||||
xmlns:vm="clr-namespace:FrameLedger.App.ViewModels"
|
||||
xmlns:charts="clr-namespace:FrameLedger.App.Charts"
|
||||
Title="{x:Static res:Strings.Compare_Header}">
|
||||
Title="{x:Static res:Strings.Compare_Header}"
|
||||
ScrollViewer.CanContentScroll="False">
|
||||
<!-- 08_UI §Compare: the picker (2–5, cross-game), the overlaid percentile curves, the stat table; FR-6.2's guard is the view model's. -->
|
||||
<ScrollViewer>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Style="{StaticResource PageRoot}">
|
||||
<ui:TextBlock FontTypography="Title" Text="{x:Static vm:CompareViewModel.Header}" />
|
||||
<ui:TextBlock Margin="0,16,0,0" Appearance="Secondary" TextWrapping="Wrap" Text="{x:Static vm:CompareViewModel.EmptyText}"
|
||||
@@ -32,7 +33,16 @@
|
||||
ItemsSource="{Binding ViewModel.Candidates}" SelectionMode="Single"
|
||||
Visibility="{Binding ViewModel.IsEmpty, Converter={StaticResource InverseBoolToVis}}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn Binding="{Binding IsSelected, UpdateSourceTrigger=PropertyChanged}" Width="40" />
|
||||
<!-- A template column, not DataGridCheckBoxColumn: that one's element style is WPF's own, an Aero2 box on the Fluent grid; MinWidth 0
|
||||
and no padding, or WPF UI's CheckBox (MinWidth 120, padding 11) draws a sliver of the box in 40 px (beta.14). -->
|
||||
<DataGridTemplateColumn Width="40">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:CompareCandidateViewModel}">
|
||||
<CheckBox MinWidth="0" Padding="0" HorizontalAlignment="Center" AutomationProperties.Name="{Binding Label}"
|
||||
IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="{x:Static res:Strings.Compare_Col_Game}" Binding="{Binding GameName}" IsReadOnly="True" Width="2*" />
|
||||
<DataGridTextColumn Header="{x:Static res:Strings.Compare_Col_Date}" Binding="{Binding DateText}" IsReadOnly="True" Width="*" />
|
||||
<DataGridTextColumn Header="{x:Static res:Strings.Compare_Col_Tier}" Binding="{Binding TierText}" IsReadOnly="True" Width="Auto" />
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
xmlns:res="clr-namespace:FrameLedger.App"
|
||||
xmlns:vm="clr-namespace:FrameLedger.App.ViewModels"
|
||||
xmlns:controls="clr-namespace:FrameLedger.App.Controls"
|
||||
Title="{x:Static res:Strings.Dashboard_Header}">
|
||||
<ScrollViewer>
|
||||
Title="{x:Static res:Strings.Dashboard_Header}"
|
||||
ScrollViewer.CanContentScroll="False">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Style="{StaticResource PageRoot}">
|
||||
<ui:TextBlock FontTypography="Title" Text="{x:Static vm:DashboardViewModel.Header}" />
|
||||
|
||||
|
||||
@@ -9,13 +9,14 @@
|
||||
xmlns:vm="clr-namespace:FrameLedger.App.ViewModels"
|
||||
xmlns:controls="clr-namespace:FrameLedger.App.Controls"
|
||||
xmlns:charts="clr-namespace:FrameLedger.App.Charts"
|
||||
Title="{x:Static res:Strings.Games_Header}">
|
||||
Title="{x:Static res:Strings.Games_Header}"
|
||||
ScrollViewer.CanContentScroll="False">
|
||||
<!--
|
||||
08_UI §Games › Game detail. The two rows — Supports (files on disk) and Last session measured (the
|
||||
hooks) — are two cards and never mixed. The hooking control opens FR-2.1's dialog; a blocked pre-scan
|
||||
disables it with the reason inline; a refusal is a persistent InfoBar on this page, never a toast.
|
||||
-->
|
||||
<ScrollViewer>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Style="{StaticResource PageRoot}">
|
||||
<ui:HyperlinkButton Padding="0" Command="{Binding ViewModel.BackCommand}" Content="{x:Static vm:GameDetailViewModel.BackText}" Icon="{ui:SymbolIcon ArrowLeft24}" />
|
||||
|
||||
|
||||
@@ -10,14 +10,15 @@
|
||||
xmlns:controls="clr-namespace:FrameLedger.App.Controls"
|
||||
Title="{x:Static res:Strings.Games_Header}"
|
||||
AllowDrop="True"
|
||||
Drop="OnDrop">
|
||||
Drop="OnDrop"
|
||||
ScrollViewer.CanContentScroll="False">
|
||||
<!--
|
||||
08_UI §Games: search, sort, FR-1.1 add by pick or by dropping an .exe here. Since beta.11 (owner requests 2026-10-03):
|
||||
the count in the title; a grid of cards that fills the width (UniformWrapPanel - a WrapPanel of 300 px cards left a
|
||||
card's width unused at the right) or a list (ui.library_view); Refresh reads the library again, offers the games the
|
||||
stores installed since, and marks the entries whose executable is gone.
|
||||
-->
|
||||
<ScrollViewer>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Style="{StaticResource PageRoot}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:res="clr-namespace:FrameLedger.App"
|
||||
xmlns:vm="clr-namespace:FrameLedger.App.ViewModels"
|
||||
Title="{x:Static res:Strings.Logs_Header}">
|
||||
Title="{x:Static res:Strings.Logs_Header}"
|
||||
ScrollViewer.CanContentScroll="False">
|
||||
<Grid Margin="24,16,24,16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:res="clr-namespace:FrameLedger.App"
|
||||
xmlns:vm="clr-namespace:FrameLedger.App.ViewModels"
|
||||
Title="{x:Static res:Strings.Settings_Header}">
|
||||
<ScrollViewer>
|
||||
Title="{x:Static res:Strings.Settings_Header}"
|
||||
ScrollViewer.CanContentScroll="False">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Style="{StaticResource PageRoot}">
|
||||
<ui:TextBlock FontTypography="Title" Text="{x:Static vm:SettingsViewModel.Header}" />
|
||||
|
||||
@@ -310,6 +311,17 @@
|
||||
</ui:CardControl.Header>
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{x:Static res:Strings.Settings_FpsDecimals_Label}" IsChecked="{Binding ViewModel.FpsTwoDecimals, Mode=TwoWay}" />
|
||||
</ui:CardControl>
|
||||
<!-- beta.14 (owner request 2026-10-05): no scroll bars drawn; the wheel, the keyboard and touch still scroll. -->
|
||||
<ui:CardControl Margin="0,8,0,0" Icon="{ui:SymbolIcon ArrowSortDownLines24}">
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
<ui:TextBlock FontTypography="BodyStrong" Text="{x:Static res:Strings.Settings_HideScrollBars_Label}" />
|
||||
<ui:TextBlock MaxWidth="520" HorizontalAlignment="Left" Appearance="Secondary" TextWrapping="Wrap"
|
||||
Text="{x:Static res:Strings.Settings_HideScrollBars_Body}" />
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{x:Static res:Strings.Settings_HideScrollBars_Label}" IsChecked="{Binding ViewModel.HideScrollBars, Mode=TwoWay}" />
|
||||
</ui:CardControl>
|
||||
|
||||
<!--
|
||||
Updates, logging, legal. The Privacy card — the `privacy.online_metadata` toggle — is not shown
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using FrameLedger.App.Dialogs;
|
||||
using FrameLedger.App.ViewModels;
|
||||
@@ -10,7 +11,11 @@ using Wpf.Ui.Controls;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>FR-1.2's review checklist in WPF UI: a <c>ContentDialog</c> whose primary button follows the tick count; Cancel adds nothing.</summary>
|
||||
/// <summary>
|
||||
/// FR-1.2's review checklist in WPF UI: a <c>ContentDialog</c> whose primary button follows the tick count; Cancel adds nothing.
|
||||
/// The dialog's own scrolling is off (beta.14): its content row then has the height the window leaves, the list fills it and is
|
||||
/// the one thing that scrolls — a scrolling list inside a scrolling dialog pushed the intro out of sight at the list's end.
|
||||
/// </summary>
|
||||
public sealed class ImportReviewPrompt : IImportReview
|
||||
{
|
||||
private readonly IContentDialogService _dialogs;
|
||||
@@ -21,18 +26,24 @@ public sealed class ImportReviewPrompt : IImportReview
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(candidates);
|
||||
var viewModel = new ImportReviewViewModel(candidates);
|
||||
var dialog = new ContentDialog
|
||||
{
|
||||
Title = ImportReviewViewModel.Title,
|
||||
Content = new ImportReviewContent(viewModel),
|
||||
PrimaryButtonText = Strings.Import_Add,
|
||||
CloseButtonText = Strings.Common_Cancel,
|
||||
DefaultButton = ContentDialogButton.Primary,
|
||||
DialogMaxWidth = 900,
|
||||
};
|
||||
ContentDialog dialog = Create(viewModel);
|
||||
_ = dialog.SetBinding(ContentDialog.IsPrimaryButtonEnabledProperty, new Binding(nameof(ImportReviewViewModel.CanImport)) { Source = viewModel, Mode = BindingMode.OneWay });
|
||||
|
||||
ContentDialogResult result = await _dialogs.ShowAsync(dialog, ct).ConfigureAwait(true);
|
||||
return result == ContentDialogResult.Primary ? viewModel.Selected : null;
|
||||
}
|
||||
|
||||
/// <summary>The dialog as shown, without a host: a test lays it out in one of its own.</summary>
|
||||
internal static ContentDialog Create(ImportReviewViewModel viewModel, ContentDialogHost? host = null)
|
||||
{
|
||||
ContentDialog dialog = host is null ? new ContentDialog() : new ContentDialog(host);
|
||||
dialog.Title = ImportReviewViewModel.Title;
|
||||
dialog.Content = new ImportReviewContent(viewModel);
|
||||
dialog.PrimaryButtonText = Strings.Import_Add;
|
||||
dialog.CloseButtonText = Strings.Common_Cancel;
|
||||
dialog.DefaultButton = ContentDialogButton.Primary;
|
||||
dialog.DialogMaxWidth = 900;
|
||||
ScrollViewer.SetVerticalScrollBarVisibility(dialog, ScrollBarVisibility.Disabled);
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>
|
||||
/// <c>ui.hide_scrollbars</c> (beta.14, owner request 2026-10-05): the App draws no scroll bars, and every scroller still
|
||||
/// scrolls — with the wheel, the keyboard and touch. A bar's visibility is bound in its scroller's template, so no style can
|
||||
/// reach it; this sets the scroller's own <see cref="ScrollBarVisibility"/> instead. One class handler on
|
||||
/// <see cref="ScrollViewer"/>'s <c>Loaded</c>, registered at start beside <see cref="DialogKeyboard"/>, sees every scroller the
|
||||
/// App shows, those inside a control's template too (a DataGrid's, a TextBox's, a rendered document's, a dialog's). While
|
||||
/// on, an axis whose bar is <see cref="ScrollBarVisibility.Auto"/> or <see cref="ScrollBarVisibility.Visible"/> becomes
|
||||
/// <see cref="ScrollBarVisibility.Hidden"/> — WPF's "no bar, still scrolls" — and its own value is remembered on it;
|
||||
/// <see cref="ScrollBarVisibility.Disabled"/> is never touched, because a disabled axis lays its content out at the viewport's
|
||||
/// size and wraps text. Off puts every remembered value back, on screen at once and on the next load for the rest.
|
||||
/// </summary>
|
||||
public static class ScrollBarHiding
|
||||
{
|
||||
private static readonly DependencyProperty _ownVerticalProperty =
|
||||
DependencyProperty.RegisterAttached("OwnVertical", typeof(ScrollBarVisibility?), typeof(ScrollBarHiding), new PropertyMetadata(null));
|
||||
|
||||
private static readonly DependencyProperty _ownHorizontalProperty =
|
||||
DependencyProperty.RegisterAttached("OwnHorizontal", typeof(ScrollBarVisibility?), typeof(ScrollBarHiding), new PropertyMetadata(null));
|
||||
|
||||
private static volatile bool _hidden;
|
||||
private static int _registered;
|
||||
|
||||
/// <summary>Whether the bars are hidden right now.</summary>
|
||||
public static bool Hidden => _hidden;
|
||||
|
||||
/// <summary>Registers the class handler, once per process.</summary>
|
||||
public static void Register()
|
||||
{
|
||||
if (Interlocked.Exchange(ref _registered, 1) == 0)
|
||||
{
|
||||
EventManager.RegisterClassHandler(typeof(ScrollViewer), FrameworkElement.LoadedEvent, new RoutedEventHandler(OnLoaded), handledEventsToo: true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the preference and applies it to every scroller of every open window — at once on the App's own thread, where
|
||||
/// Settings changes it; from any other thread the windows are visited when that thread's dispatcher next runs.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD001:Avoid legacy thread switching APIs", Justification = "a WPF application has no JoinableTaskFactory; the windows belong to the dispatcher's thread, and posting to it never blocks (UiThread does the same)")]
|
||||
public static void Apply(bool hidden)
|
||||
{
|
||||
_hidden = hidden;
|
||||
if (System.Windows.Application.Current is not { } app)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (app.Dispatcher.CheckAccess())
|
||||
{
|
||||
ApplyToWindows(app);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = app.Dispatcher.InvokeAsync(() => ApplyToWindows(app));
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplyToWindows(System.Windows.Application app)
|
||||
{
|
||||
foreach (Window window in app.Windows)
|
||||
{
|
||||
ApplyUnder(window);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Applies the current preference to every scroller under <paramref name="root"/>: an open window, or a test's tree.</summary>
|
||||
public static void ApplyUnder(DependencyObject root)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(root);
|
||||
if (root is ScrollViewer viewer)
|
||||
{
|
||||
Set(viewer);
|
||||
}
|
||||
|
||||
int count = VisualTreeHelper.GetChildrenCount(root);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
ApplyUnder(VisualTreeHelper.GetChild(root, i));
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is ScrollViewer viewer)
|
||||
{
|
||||
Set(viewer);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Set(ScrollViewer viewer)
|
||||
{
|
||||
Axis(viewer, ScrollViewer.VerticalScrollBarVisibilityProperty, _ownVerticalProperty);
|
||||
Axis(viewer, ScrollViewer.HorizontalScrollBarVisibilityProperty, _ownHorizontalProperty);
|
||||
}
|
||||
|
||||
private static void Axis(ScrollViewer viewer, DependencyProperty axis, DependencyProperty own)
|
||||
{
|
||||
var remembered = (ScrollBarVisibility?)viewer.GetValue(own);
|
||||
if (_hidden)
|
||||
{
|
||||
if (remembered is null && viewer.GetValue(axis) is ScrollBarVisibility current and (ScrollBarVisibility.Auto or ScrollBarVisibility.Visible))
|
||||
{
|
||||
viewer.SetValue(own, current);
|
||||
viewer.SetCurrentValue(axis, ScrollBarVisibility.Hidden);
|
||||
}
|
||||
}
|
||||
else if (remembered is { } value)
|
||||
{
|
||||
viewer.ClearValue(own);
|
||||
viewer.SetCurrentValue(axis, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+15
@@ -749,6 +749,7 @@ public static class Strings
|
||||
nameof(Settings_AutoCheck_Body),
|
||||
nameof(Settings_AutoCheck_Label),
|
||||
nameof(Settings_Capture_Header),
|
||||
nameof(Settings_Channel_Auto_Format),
|
||||
nameof(Settings_Channel_Beta),
|
||||
nameof(Settings_Channel_Stable),
|
||||
nameof(Settings_Data_Header),
|
||||
@@ -769,6 +770,8 @@ public static class Strings
|
||||
nameof(Settings_Header),
|
||||
nameof(Settings_HideAntiCheatHooking_Body),
|
||||
nameof(Settings_HideAntiCheatHooking_Label),
|
||||
nameof(Settings_HideScrollBars_Body),
|
||||
nameof(Settings_HideScrollBars_Label),
|
||||
nameof(Settings_HookedGames_Label),
|
||||
nameof(Settings_HookedGames_Revoke),
|
||||
nameof(Settings_Interval_Body),
|
||||
@@ -953,6 +956,7 @@ public static class Strings
|
||||
nameof(Uninstall_DataFolder_Body),
|
||||
nameof(Uninstall_DataFolder_Title),
|
||||
nameof(Update_AgentStillRunning),
|
||||
nameof(Update_Available_Body_Delta_Format),
|
||||
nameof(Update_Available_Body_Format),
|
||||
nameof(Update_Available_Title_Format),
|
||||
nameof(Update_Banner_Applying_Format),
|
||||
@@ -974,6 +978,7 @@ public static class Strings
|
||||
nameof(Update_Notes_Header),
|
||||
nameof(Update_NotInstalled),
|
||||
nameof(Update_OpenReleases),
|
||||
nameof(Update_PayloadInUse_Format),
|
||||
nameof(Update_Toast_Body_Format),
|
||||
nameof(Update_Toast_Title),
|
||||
nameof(Update_Unsigned_Footer),
|
||||
@@ -2423,6 +2428,8 @@ public static class Strings
|
||||
|
||||
public static string Settings_Capture_Header => ResourceManager.GetString(nameof(Settings_Capture_Header), Culture) ?? nameof(Settings_Capture_Header);
|
||||
|
||||
public static string Settings_Channel_Auto_Format => ResourceManager.GetString(nameof(Settings_Channel_Auto_Format), Culture) ?? nameof(Settings_Channel_Auto_Format);
|
||||
|
||||
public static string Settings_Channel_Beta => ResourceManager.GetString(nameof(Settings_Channel_Beta), Culture) ?? nameof(Settings_Channel_Beta);
|
||||
|
||||
public static string Settings_Channel_Stable => ResourceManager.GetString(nameof(Settings_Channel_Stable), Culture) ?? nameof(Settings_Channel_Stable);
|
||||
@@ -2463,6 +2470,10 @@ public static class Strings
|
||||
|
||||
public static string Settings_HideAntiCheatHooking_Label => ResourceManager.GetString(nameof(Settings_HideAntiCheatHooking_Label), Culture) ?? nameof(Settings_HideAntiCheatHooking_Label);
|
||||
|
||||
public static string Settings_HideScrollBars_Body => ResourceManager.GetString(nameof(Settings_HideScrollBars_Body), Culture) ?? nameof(Settings_HideScrollBars_Body);
|
||||
|
||||
public static string Settings_HideScrollBars_Label => ResourceManager.GetString(nameof(Settings_HideScrollBars_Label), Culture) ?? nameof(Settings_HideScrollBars_Label);
|
||||
|
||||
public static string Settings_HookedGames_Label => ResourceManager.GetString(nameof(Settings_HookedGames_Label), Culture) ?? nameof(Settings_HookedGames_Label);
|
||||
|
||||
public static string Settings_HookedGames_Revoke => ResourceManager.GetString(nameof(Settings_HookedGames_Revoke), Culture) ?? nameof(Settings_HookedGames_Revoke);
|
||||
@@ -2831,6 +2842,8 @@ public static class Strings
|
||||
|
||||
public static string Update_AgentStillRunning => ResourceManager.GetString(nameof(Update_AgentStillRunning), Culture) ?? nameof(Update_AgentStillRunning);
|
||||
|
||||
public static string Update_Available_Body_Delta_Format => ResourceManager.GetString(nameof(Update_Available_Body_Delta_Format), Culture) ?? nameof(Update_Available_Body_Delta_Format);
|
||||
|
||||
public static string Update_Available_Body_Format => ResourceManager.GetString(nameof(Update_Available_Body_Format), Culture) ?? nameof(Update_Available_Body_Format);
|
||||
|
||||
public static string Update_Available_Title_Format => ResourceManager.GetString(nameof(Update_Available_Title_Format), Culture) ?? nameof(Update_Available_Title_Format);
|
||||
@@ -2873,6 +2886,8 @@ public static class Strings
|
||||
|
||||
public static string Update_OpenReleases => ResourceManager.GetString(nameof(Update_OpenReleases), Culture) ?? nameof(Update_OpenReleases);
|
||||
|
||||
public static string Update_PayloadInUse_Format => ResourceManager.GetString(nameof(Update_PayloadInUse_Format), Culture) ?? nameof(Update_PayloadInUse_Format);
|
||||
|
||||
public static string Update_Toast_Body_Format => ResourceManager.GetString(nameof(Update_Toast_Body_Format), Culture) ?? nameof(Update_Toast_Body_Format);
|
||||
|
||||
public static string Update_Toast_Title => ResourceManager.GetString(nameof(Update_Toast_Title), Culture) ?? nameof(Update_Toast_Title);
|
||||
|
||||
@@ -2050,7 +2050,7 @@
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_UpdateChannel_Body" xml:space="preserve">
|
||||
<value>安定版のみ、または安定版とプレリリース。見つかった更新はバックグラウンドでダウンロードされ、再起動時にのみ適用されます。ゲームがフックされている間は適用されません。</value>
|
||||
<value>自動は、このコピーに合わせます。プレリリース版はプレリリースを、正式版は正式リリースを探します。安定版、またはベータ(安定版とプレリリース)を選ぶこともできます。見つかった更新はバックグラウンドでダウンロードされ、再起動時にのみ適用されます。ゲームがフックされている間は適用されません。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_UpdateChannel_Label" xml:space="preserve">
|
||||
@@ -3841,4 +3841,24 @@
|
||||
<value>FrameLedger に対するあなたのライセンスです。参考として表示しています。プログラムを実行するために同意する必要はありません(GPLv3 第 9 条)。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_HideScrollBars_Label" xml:space="preserve">
|
||||
<value>スクロール バーを非表示にする</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_HideScrollBars_Body" xml:space="preserve">
|
||||
<value>アプリ内のどこにもスクロール バーを表示しません。マウス ホイール、キーボード、タッチでのスクロールは引き続き使えます。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_Channel_Auto_Format" xml:space="preserve">
|
||||
<value>自動({0})</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Update_Available_Body_Delta_Format" xml:space="preserve">
|
||||
<value>バージョン {0} を今すぐダウンロードできます:約 {1} MB(お使いのバージョンからの変更分のみ。適用できない場合は {2} MB の完全なパッケージ)。適用は FrameLedger の再起動時のみで、ゲームがフックされている間は行われません。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Update_PayloadInUse_Format" xml:space="preserve">
|
||||
<value>{0} は FrameLedger が計測したゲームにまだ読み込まれているため、更新は途中で失敗します。そのゲームを終了してから、再起動して更新してください。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1543,7 +1543,7 @@
|
||||
<value>Start FrameLedger with Windows</value>
|
||||
</data>
|
||||
<data name="Settings_UpdateChannel_Body" xml:space="preserve">
|
||||
<value>Stable, or stable plus pre-releases. A found update downloads in the background and is applied only when you restart — never while a game is hooked.</value>
|
||||
<value>Automatic follows this copy: a pre-release looks for pre-releases, a release for releases. Or choose Stable, or Beta (stable plus pre-releases). A found update downloads in the background and is applied only when you restart — never while a game is hooked.</value>
|
||||
</data>
|
||||
<data name="Settings_UpdateChannel_Label" xml:space="preserve">
|
||||
<value>Channel</value>
|
||||
@@ -2891,4 +2891,19 @@ The documents below are the full terms; this summary does not replace them.</val
|
||||
<data name="FirstRun_Doc_InformationNote" xml:space="preserve">
|
||||
<value>Your licence to FrameLedger, shown for information: you do not need to accept it to run the program (GPLv3 section 9).</value>
|
||||
</data>
|
||||
<data name="Settings_HideScrollBars_Label" xml:space="preserve">
|
||||
<value>Hide scroll bars</value>
|
||||
</data>
|
||||
<data name="Settings_HideScrollBars_Body" xml:space="preserve">
|
||||
<value>No scroll bars are drawn anywhere in the app. Everything still scrolls with the mouse wheel, the keyboard and touch.</value>
|
||||
</data>
|
||||
<data name="Settings_Channel_Auto_Format" xml:space="preserve">
|
||||
<value>Automatic ({0})</value>
|
||||
</data>
|
||||
<data name="Update_Available_Body_Delta_Format" xml:space="preserve">
|
||||
<value>Version {0} can be downloaded now: about {1} MB — only what changed since your version, or the full {2} MB package if that cannot be applied. It is applied only when you restart FrameLedger, and never while a game is hooked.</value>
|
||||
</data>
|
||||
<data name="Update_PayloadInUse_Format" xml:space="preserve">
|
||||
<value>{0} is still loaded in a game FrameLedger measured, and the update would fail half way. Close that game, then restart to update.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1538,7 +1538,7 @@
|
||||
<value>Khởi động FrameLedger cùng Windows</value>
|
||||
</data>
|
||||
<data name="Settings_UpdateChannel_Body" xml:space="preserve">
|
||||
<value>Ổn định, hoặc ổn định kèm bản tiền phát hành. Bản cập nhật tìm thấy sẽ tải ở nền và chỉ được áp dụng khi bạn khởi động lại — không bao giờ khi game đang được hook.</value>
|
||||
<value>Tự động theo bản đang dùng: bản tiền phát hành tìm bản tiền phát hành, bản chính thức tìm bản chính thức. Hoặc chọn Ổn định, hay Beta (ổn định kèm bản tiền phát hành). Bản cập nhật tìm thấy sẽ tải ở nền và chỉ được áp dụng khi bạn khởi động lại — không bao giờ khi game đang được hook.</value>
|
||||
</data>
|
||||
<data name="Settings_UpdateChannel_Label" xml:space="preserve">
|
||||
<value>Kênh</value>
|
||||
@@ -2886,4 +2886,19 @@ Các văn bản bên dưới là điều khoản đầy đủ; bản tóm tắt
|
||||
<data name="FirstRun_Doc_InformationNote" xml:space="preserve">
|
||||
<value>Giấy phép của bạn đối với FrameLedger, hiển thị để bạn biết: bạn không cần chấp nhận nó để chạy chương trình (GPLv3 mục 9).</value>
|
||||
</data>
|
||||
<data name="Settings_HideScrollBars_Label" xml:space="preserve">
|
||||
<value>Ẩn thanh cuộn</value>
|
||||
</data>
|
||||
<data name="Settings_HideScrollBars_Body" xml:space="preserve">
|
||||
<value>Không vẽ thanh cuộn ở bất kỳ đâu trong ứng dụng. Mọi thứ vẫn cuộn được bằng con lăn chuột, bàn phím và cảm ứng.</value>
|
||||
</data>
|
||||
<data name="Settings_Channel_Auto_Format" xml:space="preserve">
|
||||
<value>Tự động ({0})</value>
|
||||
</data>
|
||||
<data name="Update_Available_Body_Delta_Format" xml:space="preserve">
|
||||
<value>Có thể tải phiên bản {0} ngay bây giờ: khoảng {1} MB — chỉ phần thay đổi so với phiên bản của bạn, hoặc gói đầy đủ {2} MB nếu phần đó không áp dụng được. Bản cập nhật chỉ được áp dụng khi bạn khởi động lại FrameLedger, và không bao giờ khi game đang được hook.</value>
|
||||
</data>
|
||||
<data name="Update_PayloadInUse_Format" xml:space="preserve">
|
||||
<value>{0} vẫn đang được nạp trong một game mà FrameLedger đã đo, và bản cập nhật sẽ thất bại giữa chừng. Hãy đóng game đó, rồi khởi động lại để cập nhật.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -16,6 +16,12 @@ public interface IUpdateClient
|
||||
/// <summary>The installed version as the package manifest states it, or null when not installed.</summary>
|
||||
string? CurrentVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A package an earlier run downloaded and nobody applied, or null — read from the install folder, no feed request
|
||||
/// (beta.14: with Velopack's own apply-at-start switched off, the App offers it as any other).
|
||||
/// </summary>
|
||||
UpdateCandidate? FindPendingRestart();
|
||||
|
||||
/// <summary>One feed request; null when the installed version is current.</summary>
|
||||
/// <exception cref="UpdateException">The feed could not be read.</exception>
|
||||
Task<UpdateCandidate?> CheckAsync(bool includePrereleases, CancellationToken ct = default);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.IO;
|
||||
|
||||
namespace FrameLedger.App.Update;
|
||||
|
||||
/// <summary>
|
||||
/// Whether a library FrameLedger loads into games is still loaded in one (beta.14). The Overlay is never unloaded from a live
|
||||
/// game (<c>17_HOOK_ENGINE</c>), so after a capture is stopped mid-game, or an Agent is restarted, the game keeps
|
||||
/// <c>current\FrameLedger.Overlay.dll</c> mapped until it exits — and Velopack, which swaps the whole install folder, then
|
||||
/// fails half way, after the App has already quit. A mapped image cannot be opened for writing (Windows answers with a
|
||||
/// sharing violation), so the check asks the file system and opens no process: nothing about the game is read.
|
||||
/// </summary>
|
||||
public static class PayloadInUse
|
||||
{
|
||||
/// <summary>The libraries a game can hold: the Overlay FrameLedger injects, and the Vulkan layer a Vulkan game loads.</summary>
|
||||
public static IReadOnlyList<string> Files { get; } = ["FrameLedger.Overlay.dll", "FrameLedger.VkLayer.dll"];
|
||||
|
||||
private const int _sharingViolation = unchecked((int)0x80070020);
|
||||
private const int _lockViolation = unchecked((int)0x80070021);
|
||||
private const int _userMappedFile = unchecked((int)0x800704C8);
|
||||
|
||||
/// <summary>The first of <see cref="Files"/> under <paramref name="directory"/> that something still holds, or null.</summary>
|
||||
public static string? Find(string directory)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(directory);
|
||||
foreach (string name in Files)
|
||||
{
|
||||
string path = Path.Combine(directory, name);
|
||||
if (File.Exists(path) && IsHeld(path))
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool IsHeld(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (IOException ex) when (ex.HResult is _sharingViolation or _lockViolation or _userMappedFile)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
// Not writable to this user: the updater could not replace it either.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,8 @@ namespace FrameLedger.App.Update;
|
||||
|
||||
/// <summary>
|
||||
/// The uninstall hook's decisions (<c>12_BUILD</c> §Publish & package: "uninstalled → unregister the layer, remove
|
||||
/// the scheduled task, ask about the data folder"), over delegates so a test runs it without a pipe, a registry, a
|
||||
/// the scheduled task, ask about the data folder" — and since beta.14 remove "Start FrameLedger with Windows", which named an
|
||||
/// executable the uninstaller deletes), over delegates so a test runs it without a pipe, a registry, a
|
||||
/// Task Scheduler or a data folder. Every step is independent: a failure in one is logged and the next still
|
||||
/// runs, and the data folder is deleted only on an explicit yes — a question that goes unanswered inside
|
||||
/// Velopack's 30 s budget leaves the folder where it is.
|
||||
@@ -14,6 +15,7 @@ public sealed class UninstallHook(
|
||||
Func<bool> stopAgent,
|
||||
Func<bool> unregisterLayer,
|
||||
Func<bool> removeTask,
|
||||
Func<bool> removeRunValue,
|
||||
Func<bool> askDeleteData,
|
||||
Action deleteData,
|
||||
Action<string> log)
|
||||
@@ -23,6 +25,7 @@ public sealed class UninstallHook(
|
||||
bool agent = Step("agent shutdown", stopAgent);
|
||||
bool layer = Step("vulkan layer unregister", unregisterLayer);
|
||||
bool task = Step("logon task remove", removeTask);
|
||||
bool run = Step("start with windows remove", removeRunValue);
|
||||
bool asked = false;
|
||||
bool deleted = false;
|
||||
if (Step("data folder question", () =>
|
||||
@@ -38,7 +41,7 @@ public sealed class UninstallHook(
|
||||
});
|
||||
}
|
||||
|
||||
var outcome = new UninstallOutcome(agent, layer, task, asked, deleted);
|
||||
var outcome = new UninstallOutcome(agent, layer, task, run, asked, deleted);
|
||||
log("uninstall: " + outcome);
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
namespace FrameLedger.App.Update;
|
||||
|
||||
/// <summary>What the uninstall hook did, for its log line and its test.</summary>
|
||||
public sealed record UninstallOutcome(bool AgentAsked, bool LayerUnregistered, bool TaskRemoved, bool DataAsked, bool DataDeleted);
|
||||
public sealed record UninstallOutcome(bool AgentAsked, bool LayerUnregistered, bool TaskRemoved, bool RunValueRemoved, bool DataAsked, bool DataDeleted);
|
||||
@@ -3,5 +3,13 @@
|
||||
|
||||
namespace FrameLedger.App.Update;
|
||||
|
||||
/// <summary>A release newer than the installed one, as the feed describes it: the version, its notes (the GitHub release body, Markdown), the full package's size.</summary>
|
||||
public sealed record UpdateCandidate(string Version, string? NotesMarkdown, long SizeBytes);
|
||||
/// <summary>
|
||||
/// A release newer than the installed one, as the feed describes it: the version, its notes (the GitHub release body,
|
||||
/// Markdown), the full package's size, and — since beta.14 — the size of the delta packages from the installed version
|
||||
/// when the feed has them (<see cref="DeltaBytes"/>), which is what Velopack downloads unless they fail to apply.
|
||||
/// </summary>
|
||||
public sealed record UpdateCandidate(string Version, string? NotesMarkdown, long SizeBytes)
|
||||
{
|
||||
/// <summary>The deltas' size together, or null when there is none and the full package is the download.</summary>
|
||||
public long? DeltaBytes { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.App.Update;
|
||||
|
||||
/// <summary>
|
||||
/// Which releases a check asks for (beta.14, owner decision D47). <c>update.channel</c> is <c>auto</c> unless the user chose:
|
||||
/// a copy that is itself a pre-release looks for pre-releases and a release looks for releases. Until beta.14 the default was
|
||||
/// <c>stable</c> while every release so far is a GitHub pre-release, so a copy left on its defaults never found an update —
|
||||
/// the owner's own updater log read "No releases found" from the day the ledger was reset. A stored <c>stable</c> or
|
||||
/// <c>beta</c> is a choice the user made, and it wins.
|
||||
/// </summary>
|
||||
public static class UpdateChannelPolicy
|
||||
{
|
||||
public const string Automatic = "auto";
|
||||
|
||||
public const string Stable = "stable";
|
||||
|
||||
public const string Beta = "beta";
|
||||
|
||||
/// <summary>Whether a version is a pre-release in SemVer's sense: a <c>-</c> before any build metadata (<c>0.1.0-beta.14</c>).</summary>
|
||||
public static bool IsPrerelease(string? version)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(version))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int build = version.IndexOf('+', StringComparison.Ordinal);
|
||||
int dash = version.IndexOf('-', StringComparison.Ordinal);
|
||||
return dash > 0 && (build < 0 || dash < build);
|
||||
}
|
||||
|
||||
/// <summary>Whether a check on <paramref name="channel"/> asks for pre-releases, for a copy running <paramref name="runningVersion"/>.</summary>
|
||||
public static bool IncludesPrereleases(string? channel, string? runningVersion) => channel switch
|
||||
{
|
||||
Beta => true,
|
||||
Stable => false,
|
||||
_ => IsPrerelease(runningVersion),
|
||||
};
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Sockets;
|
||||
@@ -12,7 +11,7 @@ namespace FrameLedger.App.Update;
|
||||
/// <summary>
|
||||
/// <c>11_UPDATER</c> §Error mapping as a function of the exception Velopack's client threw: the HTTP status when
|
||||
/// there is one (404 → <see cref="UpdateFailure.NotFound"/>, 403/429 → <see cref="UpdateFailure.RateLimited"/>,
|
||||
/// 5xx → <see cref="UpdateFailure.Server"/>), the transport failures → <see cref="UpdateFailure.Offline"/>, a
|
||||
/// 5xx → <see cref="UpdateFailure.Server"/>), the transport failures (never a local disk's) → <see cref="UpdateFailure.Offline"/>, a
|
||||
/// checksum → <see cref="UpdateFailure.Corrupt"/>, the rest → <see cref="UpdateFailure.Unknown"/>. Walks the inner
|
||||
/// chain, because the source wraps what its downloader threw.
|
||||
/// </summary>
|
||||
@@ -40,7 +39,9 @@ public static class UpdateFailureMapper
|
||||
HttpRequestException { StatusCode: { } status } when (int)status >= 500 => UpdateFailure.Server,
|
||||
HttpRequestException { StatusCode: null } => UpdateFailure.Offline,
|
||||
HttpRequestException => UpdateFailure.Unknown,
|
||||
TaskCanceledException or TimeoutException or SocketException or IOException => UpdateFailure.Offline,
|
||||
// An I/O error is "offline" only from the network (beta.14): a full disk or a locked file is not, and an IOException
|
||||
// that wraps a socket error is classified at the socket, one step down the chain.
|
||||
TaskCanceledException or TimeoutException or SocketException or HttpIOException => UpdateFailure.Offline,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using Serilog;
|
||||
namespace FrameLedger.App.Update;
|
||||
|
||||
/// <summary>
|
||||
/// The startup leg of <c>11_UPDATER</c> §Flow: the silent check 5 s after the host is up (the spec's "5 s after UI
|
||||
/// The startup leg of <c>11_UPDATER</c> §Flow: a package an earlier run left downloaded offered at once (beta.14), the silent check 5 s after the host is up (the spec's "5 s after UI
|
||||
/// idle", measured from start because the shell shows synchronously inside it), and — on the first run after an
|
||||
/// update — the logon task's action path re-validated, because the updater rewrote the install directory
|
||||
/// (<c>LogonTaskState.Stale</c> is the signal; <c>--install-task</c> the repair, this user's own task).
|
||||
@@ -27,6 +27,8 @@ internal sealed class UpdateHostedService(UpdateService updates, IMaintenanceSta
|
||||
await RepairTaskAsync(stoppingToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
// A package an earlier run downloaded is offered first, from the install folder; the check then has nothing to do.
|
||||
updates.AdoptPending();
|
||||
await Task.Delay(_startupDelay, stoppingToken).ConfigureAwait(false);
|
||||
await updates.CheckSilentlyAsync(stoppingToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public sealed class UpdatePrompts(IUrlOpener urls, BugReportFlow bugReports) : I
|
||||
var body = new StackPanel();
|
||||
body.Children.Add(new System.Windows.Controls.TextBlock
|
||||
{
|
||||
Text = string.Format(CultureInfo.CurrentCulture, Strings.Update_Available_Body_Format, candidate.Version, candidate.SizeBytes / (1024 * 1024)),
|
||||
Text = OfferText(candidate),
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
});
|
||||
if (!string.IsNullOrWhiteSpace(candidate.NotesMarkdown))
|
||||
@@ -50,6 +50,27 @@ public sealed class UpdatePrompts(IUrlOpener urls, BugReportFlow bugReports) : I
|
||||
return result == MessageBoxResult.Primary;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The offer's first line. Since beta.14 it says the download Velopack will make: the deltas from the installed version
|
||||
/// when the feed has them — 1.6 MB for beta.12 → beta.13 — with the full package named as the fallback; it said the full
|
||||
/// package's ~102 MB even when the delta was what came.
|
||||
/// </summary>
|
||||
public static string OfferText(UpdateCandidate candidate)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(candidate);
|
||||
string full = Megabytes(candidate.SizeBytes);
|
||||
return candidate.DeltaBytes is { } delta && delta < candidate.SizeBytes
|
||||
? string.Format(CultureInfo.CurrentCulture, Strings.Update_Available_Body_Delta_Format, candidate.Version, Megabytes(delta), full)
|
||||
: string.Format(CultureInfo.CurrentCulture, Strings.Update_Available_Body_Format, candidate.Version, full);
|
||||
}
|
||||
|
||||
/// <summary>Whole megabytes, one decimal under ten ("1.5", "102").</summary>
|
||||
private static string Megabytes(long bytes)
|
||||
{
|
||||
double mb = bytes / (1024.0 * 1024.0);
|
||||
return mb.ToString(mb < 10 ? "0.#" : "0", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
public Task UpToDateAsync(string version, CancellationToken ct = default) =>
|
||||
ShowAsync(Strings.Menu_Help_CheckUpdates, string.Format(CultureInfo.CurrentCulture, Strings.Update_UpToDate_Format, version), ct);
|
||||
|
||||
|
||||
@@ -20,12 +20,22 @@ namespace FrameLedger.App.Update;
|
||||
/// the host once the pipe has dropped; Velopack waits for the exit, applies, and restarts the App, which starts
|
||||
/// the Agent beside itself as it always does.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// beta.14 (the update audit): Velopack's own apply-at-start is off (<see cref="VelopackHooks"/>), so a package an earlier
|
||||
/// run downloaded is adopted here (<see cref="AdoptPending"/>) and goes through FR-12 and the Agent's stop like any other —
|
||||
/// until then the next start applied it inside <c>VelopackApp.Run</c>, killing the Agent, before any of this ran. The
|
||||
/// channel follows the running copy unless the user chose one (<see cref="UpdateChannelPolicy"/>, D47); an apply waits
|
||||
/// while a game still has the Overlay loaded (<see cref="PayloadInUse"/>) and while an Agent waits on the administrator
|
||||
/// prompt; the stop budget outlasts the Agent's own shutdown grace.
|
||||
/// </remarks>
|
||||
public sealed partial class UpdateService : ObservableObject, IDisposable
|
||||
{
|
||||
private static readonly TimeSpan _defaultAgentStopTimeout = TimeSpan.FromSeconds(10);
|
||||
/// <summary>The Agent's own shutdown grace (it finalizes its sessions inside it), and five seconds to leave after it.</summary>
|
||||
internal static readonly TimeSpan DefaultAgentStopTimeout = IpcProtocol.AgentShutdownGrace + TimeSpan.FromSeconds(5);
|
||||
|
||||
private readonly TimeSpan _agentStopTimeout;
|
||||
private readonly Func<bool> _agentHeld;
|
||||
private readonly Func<string?> _payloadInUse;
|
||||
private readonly IUpdateClient _client;
|
||||
private readonly IAgentLink _agent;
|
||||
private readonly RegisteredSettings _settings;
|
||||
@@ -47,14 +57,17 @@ public sealed partial class UpdateService : ObservableObject, IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// The flow over its ports; subscribes to the Agent link for the session facts FR-12 needs. <paramref name="agentStopTimeout"/>
|
||||
/// is how long the apply waits for the Agent to stop after <c>Shutdown</c> (10 s), overridable as a test's clock;
|
||||
/// <paramref name="agentHeld"/> is whether an Agent process still holds the data folder (the instance lock), a test's own.
|
||||
/// is how long the apply waits for the Agent to stop after <c>Shutdown</c> (<see cref="DefaultAgentStopTimeout"/>), overridable
|
||||
/// as a test's clock; <paramref name="agentHeld"/> is whether an Agent process still holds the data folder — its instance
|
||||
/// lock, or the marker of one waiting on the administrator prompt — and <paramref name="payloadInUse"/> which library a game
|
||||
/// still has loaded from the install folder, both a test's own.
|
||||
/// </summary>
|
||||
public UpdateService(IUpdateClient client, IAgentLink agent, RegisteredSettings settings, IUpdatePrompts prompts, IShellPresence shell, IMessageStrip strip,
|
||||
TimeSpan? agentStopTimeout = null, Func<bool>? agentHeld = null)
|
||||
TimeSpan? agentStopTimeout = null, Func<bool>? agentHeld = null, Func<string?>? payloadInUse = null)
|
||||
{
|
||||
_agentStopTimeout = agentStopTimeout ?? _defaultAgentStopTimeout;
|
||||
_agentHeld = agentHeld ?? (static () => Infrastructure.Startup.AgentInstanceLock.IsHeld(Services.UiPaths.DataDirectory));
|
||||
_agentStopTimeout = agentStopTimeout ?? DefaultAgentStopTimeout;
|
||||
_agentHeld = agentHeld ?? (static () => AgentHolds(Services.UiPaths.DataDirectory));
|
||||
_payloadInUse = payloadInUse ?? (static () => PayloadInUse.Find(AppContext.BaseDirectory));
|
||||
_client = client ?? throw new ArgumentNullException(nameof(client));
|
||||
_agent = agent ?? throw new ArgumentNullException(nameof(agent));
|
||||
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
|
||||
@@ -82,6 +95,34 @@ public sealed partial class UpdateService : ObservableObject, IDisposable
|
||||
_agent.EventReceived -= OnAgentEvent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether an Agent holds <paramref name="dataDirectory"/>: its instance lock, or — since beta.14 — the marker of one waiting on
|
||||
/// the administrator prompt, which holds no lock yet and was stopped by nothing (Velopack's updater killed it).
|
||||
/// </summary>
|
||||
internal static bool AgentHolds(string dataDirectory) =>
|
||||
Infrastructure.Startup.AgentInstanceLock.IsHeld(dataDirectory) || Infrastructure.Startup.ElevationMarker.IsHeld(dataDirectory);
|
||||
|
||||
/// <summary>
|
||||
/// A package an earlier run downloaded and nobody applied (beta.14): Ready, or Deferred while a session runs — no feed request.
|
||||
/// Velopack applied it at the next start until then, before FR-12 or the Agent's stop could run. Called before the startup check.
|
||||
/// </summary>
|
||||
public void AdoptPending()
|
||||
{
|
||||
if (!_client.IsInstalled || Stage != UpdateStage.Idle || _client.FindPendingRestart() is not { } pending)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Log.Information("update: {Version} was downloaded by an earlier run and is waiting for a restart", pending.Version);
|
||||
_pending = pending;
|
||||
Post(() =>
|
||||
{
|
||||
Version = pending.Version;
|
||||
Percent = 100;
|
||||
Settle();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>The startup check: skipped for an uninstalled copy and when the setting is off; every failure is a log line, never a dialog (NFR-10).</summary>
|
||||
public async Task CheckSilentlyAsync(CancellationToken ct = default)
|
||||
{
|
||||
@@ -172,6 +213,7 @@ public sealed partial class UpdateService : ObservableObject, IDisposable
|
||||
/// Then <c>Shutdown</c> to the Agent, the relaunch held, the pipe watched until it drops, the updater told to
|
||||
/// wait for this process, and the host ended. An Agent that does not stop in time leaves everything as it was.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format string is a resource that follows the UI culture, which changes at runtime")]
|
||||
public async Task RestartToUpdateAsync(CancellationToken ct = default)
|
||||
{
|
||||
UpdateCandidate? pending = _pending;
|
||||
@@ -187,6 +229,16 @@ public sealed partial class UpdateService : ObservableObject, IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
// A game FrameLedger measured earlier can still have the Overlay loaded from the install folder; the swap would fail
|
||||
// half way after this App had quit. Asked before the Agent is stopped, so a refusal leaves it running.
|
||||
if (_payloadInUse() is { } held)
|
||||
{
|
||||
Log.Information("update: {File} is still loaded by a running game; the apply waits", held);
|
||||
Stage = UpdateStage.Ready;
|
||||
_strip.Warn(Strings.Update_Banner_Title, string.Format(System.Globalization.CultureInfo.CurrentCulture, Strings.Update_PayloadInUse_Format, held));
|
||||
return;
|
||||
}
|
||||
|
||||
Stage = UpdateStage.Applying;
|
||||
_agent.SetLaunchHold(true);
|
||||
if (!await StopAgentAsync(ct).ConfigureAwait(true))
|
||||
@@ -217,7 +269,9 @@ public sealed partial class UpdateService : ObservableObject, IDisposable
|
||||
private async Task<UpdateCandidate?> CheckCoreAsync(CancellationToken ct)
|
||||
{
|
||||
Post(() => Stage = UpdateStage.Checking);
|
||||
bool prereleases = string.Equals(await _settings.GetAsync(SettingsRegistry.UpdateChannel, ct).ConfigureAwait(false), "beta", StringComparison.Ordinal);
|
||||
// D47 (beta.14): `auto` follows this copy; a stored `stable` or `beta` is the user's choice.
|
||||
string channel = await _settings.GetAsync(SettingsRegistry.UpdateChannel, ct).ConfigureAwait(false);
|
||||
bool prereleases = UpdateChannelPolicy.IncludesPrereleases(channel, _client.CurrentVersion ?? UiIdentity.Version);
|
||||
UpdateCandidate? candidate = await _client.CheckAsync(prereleases, ct).ConfigureAwait(false);
|
||||
if (candidate is null)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,15 @@ namespace FrameLedger.App.Update;
|
||||
/// is <see cref="UninstallHook"/> over the real pieces. A restart after an update sets <see cref="UpdateRestart"/>
|
||||
/// so the host re-validates the logon task's action path.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// beta.14 (the update audit). <b>Velopack's apply-at-start is off</b>: it is on by default, and a package the startup check
|
||||
/// downloaded was applied by the next start of this executable inside <see cref="VelopackApp.Run"/> — before FR-12 could
|
||||
/// ask whether a session runs and before the Agent could be stopped; its updater killed the Agent instead ("Killing
|
||||
/// process: …FrameLedger.Agent.exe", the owner's own log). <c>UpdateService.AdoptPending</c> offers such a package now.
|
||||
/// Velopack's own diagnostics go to this App's log (<see cref="VelopackSerilogLogger"/>). An update Velopack starts itself — the
|
||||
/// installer run over an installed copy — asks the Agent to stop first, as the uninstaller does; that hook runs in the
|
||||
/// version being replaced, so it first works for the update after beta.14.
|
||||
/// </remarks>
|
||||
internal static class VelopackHooks
|
||||
{
|
||||
/// <summary>
|
||||
@@ -34,9 +43,19 @@ internal static class VelopackHooks
|
||||
private static readonly TimeSpan _exitTimeout = TimeSpan.FromSeconds(5);
|
||||
|
||||
public static VelopackApp Configure(VelopackApp app) => app
|
||||
.SetAutoApplyOnStartup(false)
|
||||
.SetLogger(new VelopackSerilogLogger())
|
||||
.OnRestarted(static _ => UpdateRestart.Detected = true)
|
||||
.OnBeforeUpdateFastCallback(static _ => BeforeUpdate())
|
||||
.OnBeforeUninstallFastCallback(static _ => BeforeUninstall());
|
||||
|
||||
/// <summary>Velopack is about to replace this version: the Agent finalizes its sessions and leaves, rather than being killed.</summary>
|
||||
private static void BeforeUpdate()
|
||||
{
|
||||
bool asked = StopAgent();
|
||||
Log("update.log", "before update: " + (asked ? "the Agent was asked to stop" : "no Agent answered; nothing to stop"));
|
||||
}
|
||||
|
||||
private static void BeforeUninstall()
|
||||
{
|
||||
string manifest = Path.Combine(VkLayerLaunchEnvironment.DefaultDirectory, VkLayerLaunchEnvironment.ManifestFileName);
|
||||
@@ -44,11 +63,22 @@ internal static class VelopackHooks
|
||||
stopAgent: StopAgent,
|
||||
unregisterLayer: () => new VkLayerRegistration().Unregister(manifest),
|
||||
removeTask: static () => new LogonTask().Remove() is null,
|
||||
removeRunValue: static () =>
|
||||
{
|
||||
var run = new RunAtLogonRegistry();
|
||||
if (!run.IsSet)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
run.Apply(enabled: false);
|
||||
return true;
|
||||
},
|
||||
askDeleteData: static () => UninstallHook.AreSeparate(UiPaths.DataDirectory, AppContext.BaseDirectory)
|
||||
? System.Windows.MessageBox.Show(Strings.Uninstall_DataFolder_Body, Strings.Uninstall_DataFolder_Title, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes
|
||||
: throw new InvalidOperationException($"the install ({AppContext.BaseDirectory}) and the data folder ({UiPaths.DataDirectory}) overlap; nothing is deleted"),
|
||||
deleteData: static () => Directory.Delete(UiPaths.DataDirectory, recursive: true),
|
||||
log: Log);
|
||||
log: static line => Log("uninstall.log", line));
|
||||
hook.Run();
|
||||
}
|
||||
|
||||
@@ -109,7 +139,7 @@ internal static class VelopackHooks
|
||||
}
|
||||
|
||||
/// <summary>Serilog is not configured this early; the hook's own file under <c>logs/</c>, appended, never thrown from.</summary>
|
||||
private static void Log(string line)
|
||||
private static void Log(string file, string line)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -120,7 +150,7 @@ internal static class VelopackHooks
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(UiPaths.Logs);
|
||||
File.AppendAllText(Path.Combine(UiPaths.Logs, "uninstall.log"), $"[{DateTimeOffset.UtcNow:O}] {line}{Environment.NewLine}");
|
||||
File.AppendAllText(Path.Combine(UiPaths.Logs, file), $"[{DateTimeOffset.UtcNow:O}] {line}{Environment.NewLine}");
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using Velopack.Logging;
|
||||
|
||||
namespace FrameLedger.App.Update;
|
||||
|
||||
/// <summary>
|
||||
/// Velopack's own diagnostics in the App's log (beta.14), each line prefixed <c>velopack:</c> — whether an update came as a
|
||||
/// delta or as the full package, which processes it stopped, why an apply failed. Until then they were only in Velopack's
|
||||
/// file under <c>%LOCALAPPDATA%\velopack</c>, which the bug report does not collect. Set in <c>Program.Main</c>, before Serilog
|
||||
/// is configured: each line reads <see cref="Log.Logger"/> when it is written, so the early ones go nowhere and the rest arrive.
|
||||
/// </summary>
|
||||
internal sealed class VelopackSerilogLogger : IVelopackLogger
|
||||
{
|
||||
public void Log(VelopackLogLevel logLevel, string? message, Exception? exception) =>
|
||||
Serilog.Log.Logger.Write(Level(logLevel), exception, "velopack: {Message}", message ?? string.Empty);
|
||||
|
||||
internal static LogEventLevel Level(VelopackLogLevel level) => level switch
|
||||
{
|
||||
VelopackLogLevel.Trace => LogEventLevel.Verbose,
|
||||
VelopackLogLevel.Debug => LogEventLevel.Debug,
|
||||
VelopackLogLevel.Information => LogEventLevel.Information,
|
||||
VelopackLogLevel.Warning => LogEventLevel.Warning,
|
||||
VelopackLogLevel.Error => LogEventLevel.Error,
|
||||
_ => LogEventLevel.Fatal,
|
||||
};
|
||||
}
|
||||
@@ -12,7 +12,8 @@ namespace FrameLedger.App.Update;
|
||||
/// (<c>11_UPDATER</c>): the stable channel is the releases GitHub does not mark pre-release, the beta channel adds the
|
||||
/// ones it does (<c>13_CI_CD</c> §Branch & release policy — <c>vX.Y.Z-beta.N</c>). One manager per check, because
|
||||
/// the channel is a constructor argument there; the <see cref="UpdateInfo"/> a check returned is held for the
|
||||
/// download and the apply that follow it.
|
||||
/// download and the apply that follow it — or, since beta.14, the package an earlier run left downloaded
|
||||
/// (<see cref="FindPendingRestart"/>), which is applied without a download.
|
||||
/// </summary>
|
||||
public sealed class VelopackUpdateClient : IUpdateClient
|
||||
{
|
||||
@@ -20,12 +21,37 @@ public sealed class VelopackUpdateClient : IUpdateClient
|
||||
public const string RepositoryUrl = "https://github.com/poli0981/frameledger";
|
||||
|
||||
private readonly Lock _lock = new();
|
||||
private (UpdateManager Manager, UpdateInfo Info, string Version)? _held;
|
||||
private (UpdateManager Manager, UpdateInfo? Info, VelopackAsset Asset, string Version)? _held;
|
||||
|
||||
public bool IsInstalled => Probe(static m => m.IsInstalled, false);
|
||||
|
||||
public string? CurrentVersion => Probe(static m => m.CurrentVersion?.ToString(), null);
|
||||
|
||||
public UpdateCandidate? FindPendingRestart()
|
||||
{
|
||||
try
|
||||
{
|
||||
UpdateManager manager = Create(false);
|
||||
if (manager.UpdatePendingRestart is not { } pending)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string version = pending.Version.ToString();
|
||||
lock (_lock)
|
||||
{
|
||||
_held = (manager, null, pending, version);
|
||||
}
|
||||
|
||||
return new UpdateCandidate(version, pending.NotesMarkdown, pending.Size);
|
||||
}
|
||||
catch (Exception ex) when (ex is not OutOfMemoryException)
|
||||
{
|
||||
Serilog.Log.Debug(ex, "update: the install folder's pending package could not be read");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<UpdateCandidate?> CheckAsync(bool includePrereleases, CancellationToken ct = default)
|
||||
{
|
||||
ct.ThrowIfCancellationRequested();
|
||||
@@ -42,10 +68,13 @@ public sealed class VelopackUpdateClient : IUpdateClient
|
||||
string version = target.Version.ToString();
|
||||
lock (_lock)
|
||||
{
|
||||
_held = (manager, info, version);
|
||||
_held = (manager, info, target, version);
|
||||
}
|
||||
|
||||
return new UpdateCandidate(version, target.NotesMarkdown, target.Size);
|
||||
// Velopack downloads the deltas from the installed version when the feed has them (beta.13 on), the full
|
||||
// package when it has none or a delta fails to apply; the offer says the first and names the second.
|
||||
long? delta = info.DeltasToTarget is { Length: > 0 } deltas ? deltas.Sum(static d => d.Size) : null;
|
||||
return new UpdateCandidate(version, target.NotesMarkdown, target.Size) { DeltaBytes = delta };
|
||||
}
|
||||
catch (Exception ex) when (IsFailure(ex, ct))
|
||||
{
|
||||
@@ -55,7 +84,14 @@ public sealed class VelopackUpdateClient : IUpdateClient
|
||||
|
||||
public async Task DownloadAsync(UpdateCandidate candidate, IProgress<int>? progress, CancellationToken ct = default)
|
||||
{
|
||||
(UpdateManager manager, UpdateInfo info) = Held(candidate);
|
||||
(UpdateManager manager, UpdateInfo? info, _) = Held(candidate);
|
||||
if (info is null)
|
||||
{
|
||||
// The package an earlier run downloaded: already in place, verified when it was downloaded.
|
||||
progress?.Report(100);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await manager.DownloadUpdatesAsync(info, p => progress?.Report(p), ct).ConfigureAwait(false);
|
||||
@@ -69,8 +105,8 @@ public sealed class VelopackUpdateClient : IUpdateClient
|
||||
/// <summary>Velopack's updater waits up to 60 s for this process to exit; the caller ends the host right after.</summary>
|
||||
public void ApplyOnExit(UpdateCandidate candidate)
|
||||
{
|
||||
(UpdateManager manager, UpdateInfo info) = Held(candidate);
|
||||
manager.WaitExitThenApplyUpdates(info.TargetFullRelease, silent: false, restart: true);
|
||||
(UpdateManager manager, _, VelopackAsset asset) = Held(candidate);
|
||||
manager.WaitExitThenApplyUpdates(asset, silent: false, restart: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -99,14 +135,14 @@ public sealed class VelopackUpdateClient : IUpdateClient
|
||||
}
|
||||
}
|
||||
|
||||
private (UpdateManager Manager, UpdateInfo Info) Held(UpdateCandidate candidate)
|
||||
private (UpdateManager Manager, UpdateInfo? Info, VelopackAsset Asset) Held(UpdateCandidate candidate)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(candidate);
|
||||
lock (_lock)
|
||||
{
|
||||
if (_held is { } held && string.Equals(held.Version, candidate.Version, StringComparison.Ordinal))
|
||||
{
|
||||
return (held.Manager, held.Info);
|
||||
return (held.Manager, held.Info, held.Asset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,10 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private bool _fpsTwoDecimals;
|
||||
|
||||
/// <summary><c>ui.hide_scrollbars</c> (beta.14): no scroll bars drawn; every scroller still scrolls.</summary>
|
||||
[ObservableProperty]
|
||||
private bool _hideScrollBars;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _onlineMetadata;
|
||||
|
||||
@@ -206,10 +210,16 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
new("ja", "日本語"),
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// D47 (beta.14): Automatic first, its label saying what it resolves to for this copy — "Automatic (Beta)" on a
|
||||
/// pre-release — then the two explicit choices, either of which wins over the copy.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<Choice<string>> UpdateChannels { get; } =
|
||||
[
|
||||
new("stable", Strings.Settings_Channel_Stable),
|
||||
new("beta", Strings.Settings_Channel_Beta),
|
||||
new(Update.UpdateChannelPolicy.Automatic, string.Format(CultureInfo.CurrentCulture, Strings.Settings_Channel_Auto_Format,
|
||||
Update.UpdateChannelPolicy.IsPrerelease(UiIdentity.Version) ? Strings.Settings_Channel_Beta : Strings.Settings_Channel_Stable)),
|
||||
new(Update.UpdateChannelPolicy.Stable, Strings.Settings_Channel_Stable),
|
||||
new(Update.UpdateChannelPolicy.Beta, Strings.Settings_Channel_Beta),
|
||||
];
|
||||
|
||||
public static double MinSessionMinimum => SettingsRegistry.CaptureMinSessionSeconds.Minimum;
|
||||
@@ -385,6 +395,18 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
Persist(SettingsRegistry.UiFpsDecimals, value);
|
||||
}
|
||||
|
||||
partial void OnHideScrollBarsChanged(bool value)
|
||||
{
|
||||
if (_loading)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// On screen at once — this page's own bars included — and on every scroller that loads from now on.
|
||||
ScrollBarHiding.Apply(value);
|
||||
Persist(SettingsRegistry.UiHideScrollBars, value);
|
||||
}
|
||||
|
||||
partial void OnMinimizeToTrayChanged(bool value)
|
||||
{
|
||||
if (!_loading)
|
||||
@@ -497,6 +519,7 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
UserModeExceptions = await _settings.GetBooleanAsync(SettingsRegistry.HookingUserModeExceptions).ConfigureAwait(true);
|
||||
RunElevated = await _settings.GetBooleanAsync(SettingsRegistry.CaptureRunElevated).ConfigureAwait(true);
|
||||
FpsTwoDecimals = await _settings.GetBooleanAsync(SettingsRegistry.UiFpsDecimals).ConfigureAwait(true);
|
||||
HideScrollBars = await _settings.GetBooleanAsync(SettingsRegistry.UiHideScrollBars).ConfigureAwait(true);
|
||||
OnlineMetadata = await _settings.GetBooleanAsync(SettingsRegistry.PrivacyOnlineMetadata).ConfigureAwait(true);
|
||||
UpdateChannel = await _settings.GetAsync(SettingsRegistry.UpdateChannel).ConfigureAwait(true);
|
||||
AutoCheckUpdates = await _settings.GetBooleanAsync(SettingsRegistry.UpdateAutoCheck).ConfigureAwait(true);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<ui:TitleBar Grid.Row="0" Title="{Binding ViewModel.Title}" ShowMaximize="True" ShowMinimize="True" />
|
||||
<ScrollViewer Grid.Row="1">
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Style="{StaticResource PageRoot}">
|
||||
<ui:TextBlock Appearance="Secondary" TextWrapping="Wrap" Text="{x:Static vm:SessionSummaryViewModel.NotFoundText}"
|
||||
Visibility="{Binding ViewModel.NotFound, Converter={StaticResource BoolToVis}}" />
|
||||
|
||||
@@ -66,6 +66,17 @@ public static class SettingsRegistry
|
||||
Default = "0",
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Whether the App draws no scroll bars (beta.14, owner request 2026-10-05): every scroller still scrolls with the wheel,
|
||||
/// the keyboard and touch, it only stops showing its bar. Off by default — the bars are what every page showed until then.
|
||||
/// </summary>
|
||||
public static readonly SettingDefinition UiHideScrollBars = new()
|
||||
{
|
||||
Key = "ui.hide_scrollbars",
|
||||
Kind = SettingKind.Boolean,
|
||||
Default = "0",
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// How the Games library is shown (beta.11, owner request 2026-10-03): a grid of cards that fills the width, or a list.
|
||||
/// The page's own switch writes it; Settings has no row for it.
|
||||
@@ -163,13 +174,18 @@ public static class SettingsRegistry
|
||||
AgentReads = true,
|
||||
};
|
||||
|
||||
/// <summary><c>11_UPDATER</c>: the release feed's channel — <c>stable</c> is the releases GitHub does not mark pre-release, <c>beta</c> adds the ones it does (P4 PR-5 reads it).</summary>
|
||||
/// <summary>
|
||||
/// <c>11_UPDATER</c>: the release feed's channel — <c>stable</c> is the releases GitHub does not mark pre-release, <c>beta</c>
|
||||
/// adds the ones it does (P4 PR-5 reads it). <c>auto</c>, the default since beta.14 (owner decision D47), follows the
|
||||
/// running copy: a pre-release asks for pre-releases. The default was <c>stable</c> until then, while every release is a
|
||||
/// pre-release — a copy left on its defaults never found one.
|
||||
/// </summary>
|
||||
public static readonly SettingDefinition UpdateChannel = new()
|
||||
{
|
||||
Key = "update.channel",
|
||||
Kind = SettingKind.Choice,
|
||||
Default = "stable",
|
||||
Choices = ["stable", "beta"],
|
||||
Default = "auto",
|
||||
Choices = ["auto", "stable", "beta"],
|
||||
};
|
||||
|
||||
/// <summary><c>11_UPDATER</c> §Flow: the startup silent check, "if enabled" — on by default, one request to GitHub Releases after start (P4 PR-5).</summary>
|
||||
@@ -199,7 +215,7 @@ public static class SettingsRegistry
|
||||
/// <summary>Every definition, in the order <c>06_DATA_MODEL</c> lists them.</summary>
|
||||
public static IReadOnlyList<SettingDefinition> All { get; } =
|
||||
[
|
||||
UiLanguage, UiTheme, UiStartWithWindows, UiMinimizeToTray, UiHideAntiCheatHooking, UiFpsDecimals, UiLibraryView,
|
||||
UiLanguage, UiTheme, UiStartWithWindows, UiMinimizeToTray, UiHideAntiCheatHooking, UiFpsDecimals, UiHideScrollBars, UiLibraryView,
|
||||
CaptureBackground, HookingKillSwitch, HookingUserModeExceptions, CaptureRunElevated, CaptureMinSessionSeconds, TelemetryIntervalMs, RetentionRawSessionsPerGame,
|
||||
UpdateChannel, UpdateAutoCheck, PrivacyOnlineMetadata, LogDebug,
|
||||
];
|
||||
|
||||
@@ -31,4 +31,10 @@ public static class IpcProtocol
|
||||
|
||||
/// <summary>The client's keepalive cadence (<c>Ping</c> → <c>Pong</c>).</summary>
|
||||
public static readonly TimeSpan Keepalive = TimeSpan.FromSeconds(15);
|
||||
|
||||
/// <summary>
|
||||
/// How long the Agent's host gives its services to stop after <c>Shutdown</c> — a session's finalize included — before it
|
||||
/// exits anyway. One constant (beta.14): the App's update waited 10 s for an Agent that took up to 15.
|
||||
/// </summary>
|
||||
public static readonly TimeSpan AgentShutdownGrace = TimeSpan.FromSeconds(15);
|
||||
}
|
||||
@@ -111,6 +111,92 @@ public sealed class AccessibilityTests
|
||||
found.Should().BeEmpty("08_UI §Accessibility, contrast: colours come from the WPF UI theme dictionaries, whose Fluent themes meet contrast in both modes");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The import list's rows were white on white in the dark theme (beta.14): a row style <c>BasedOn="{StaticResource
|
||||
/// {x:Type DataGridRow}}"</c>, which WPF UI 4.3.0 does not define — it keys its row style <c>DefaultDataGridRowStyle</c> —
|
||||
/// so the lookup fell through to Aero2's, whose <c>SystemColors.WindowBrush</c> no theme reaches and no colour scan can see.
|
||||
/// Every type a style is based on must have a style in the App's own dictionaries.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task NoStyleIsBasedOnAnImplicitStyleTheThemeDoesNotDefine()
|
||||
{
|
||||
var typeKeyed = new Regex(@"^\{StaticResource \{x:Type (?:\w+:)?(?<type>\w+)\}\}$", RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant, TimeSpan.FromSeconds(1));
|
||||
var wanted = new List<(string File, string Type)>();
|
||||
foreach ((string file, XDocument xaml) in AppXaml())
|
||||
{
|
||||
foreach (XAttribute basedOn in xaml.Descendants().Attributes().Where(static a => string.Equals(a.Name.LocalName, "BasedOn", StringComparison.Ordinal)))
|
||||
{
|
||||
Match match = typeKeyed.Match(basedOn.Value.Trim());
|
||||
if (match.Success)
|
||||
{
|
||||
wanted.Add((file, match.Groups["type"].Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HashSet<string> defined = await PagesLoadTests.OnStaAsync(() => TypeKeyedStyles(System.Windows.Application.Current.Resources));
|
||||
|
||||
wanted.Where(w => !defined.Contains(w.Type)).Select(static w => $"{w.File}: BasedOn {{x:Type {w.Type}}}").Should().BeEmpty(
|
||||
"WPF UI defines no implicit style for that type, so the style would be based on Aero2's — base it on WPF UI's keyed style (DefaultDataGridRowStyle, …)");
|
||||
}
|
||||
|
||||
/// <summary>The names of the types the dictionary (and those merged into it) has an implicit style for.</summary>
|
||||
private static HashSet<string> TypeKeyedStyles(ResourceDictionary dictionary)
|
||||
{
|
||||
var names = new HashSet<string>(StringComparer.Ordinal);
|
||||
foreach (object key in dictionary.Keys)
|
||||
{
|
||||
if (key is Type type)
|
||||
{
|
||||
_ = names.Add(type.Name);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ResourceDictionary merged in dictionary.MergedDictionaries)
|
||||
{
|
||||
names.UnionWith(TypeKeyedStyles(merged));
|
||||
}
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
/// <summary>A <c>DataGridCheckBoxColumn</c>'s box is WPF's own element style — an Aero2 box on the Fluent grid (beta.14).</summary>
|
||||
[Fact]
|
||||
public void NoDataGridCheckBoxColumn()
|
||||
{
|
||||
AppXaml().SelectMany(static x => x.Xaml.Descendants().Where(static e => string.Equals(e.Name.LocalName, "DataGridCheckBoxColumn", StringComparison.Ordinal)).Select(_ => x.File))
|
||||
.Should().BeEmpty("a template column with a CheckBox (MinWidth=\"0\" Padding=\"0\") draws the theme's box");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WPF UI 4.3.0 wraps a page in a <c>DynamicScrollViewer</c> unless the page sets <c>ScrollViewer.CanContentScroll</c> to
|
||||
/// false; inside it the page's own root scroller has nothing to scroll and takes every wheel (beta.14: "the wheel does not
|
||||
/// scroll"). Every page opts out and scrolls itself.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EveryPageOptsOutOfTheDynamicScrollViewer()
|
||||
{
|
||||
List<string> pages = [.. AppXaml().Where(static x => string.Equals(x.Xaml.Root!.Name.LocalName, "Page", StringComparison.Ordinal)).Select(static x => x.File)];
|
||||
List<string> wrapped = [.. AppXaml().Where(static x => string.Equals(x.Xaml.Root!.Name.LocalName, "Page", StringComparison.Ordinal)
|
||||
&& !string.Equals(x.Xaml.Root.Attribute("ScrollViewer.CanContentScroll")?.Value, "False", StringComparison.Ordinal))
|
||||
.Select(static x => x.File)];
|
||||
|
||||
pages.Should().HaveCountGreaterThanOrEqualTo(6);
|
||||
wrapped.Should().BeEmpty("a page without ScrollViewer.CanContentScroll=\"False\" is wrapped in WPF UI's scroller, and its own root swallows the wheel");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A stock <c>ScrollViewer</c> takes every wheel, even with nothing left to scroll; inside a dialog that scrolls, the wheel
|
||||
/// then stops at it. WPF UI's <c>PassiveScrollViewer</c> hands the wheel on at its ends (beta.14).
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void NoPlainScrollViewerInsideADialog()
|
||||
{
|
||||
AppXaml().Where(static x => x.File.StartsWith("Dialogs" + Path.DirectorySeparatorChar, StringComparison.Ordinal))
|
||||
.SelectMany(static x => x.Xaml.Descendants().Where(static e => string.Equals(e.Name.LocalName, "ScrollViewer", StringComparison.Ordinal)).Select(_ => x.File))
|
||||
.Should().BeEmpty("use ui:PassiveScrollViewer inside a dialog");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheManifestIsPerMonitorV2()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Charts;
|
||||
using ScottPlot.WPF;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// The wheel over a chart (beta.14): ScottPlot zooms on every wheel and never marks it handled, so on a page that scrolls a
|
||||
/// wheel over a chart zoomed it AND scrolled the page. A plain wheel is the page's now and Ctrl+wheel the chart's. The Ctrl
|
||||
/// half reads <see cref="Keyboard.Modifiers"/>, which a test cannot press, so it is held by the pure rule; the plain half is
|
||||
/// driven end to end.
|
||||
/// </summary>
|
||||
public sealed class ChartWheelTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(ModifierKeys.None, false)]
|
||||
[InlineData(ModifierKeys.Shift, false)]
|
||||
[InlineData(ModifierKeys.Alt, false)]
|
||||
[InlineData(ModifierKeys.Control, true)]
|
||||
[InlineData(ModifierKeys.Control | ModifierKeys.Shift, true)]
|
||||
public void OnlyCtrlZooms(ModifierKeys modifiers, bool zooms) => ChartWheel.Zooms(modifiers).Should().Be(zooms);
|
||||
|
||||
/// <summary>
|
||||
/// A plain wheel over the plot reaches the page and never the plot's drawing surface, where ScottPlot listens: the probe
|
||||
/// subscribes to the surface's wheel exactly as ScottPlot does, so it is called whenever ScottPlot would zoom.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task APlainWheelOverAChartScrollsThePageAndNotTheChart()
|
||||
{
|
||||
(double Offset, int SurfaceWheels) result = await PagesLoadTests.OnStaAsync(() =>
|
||||
{
|
||||
var plot = new WpfPlot { Height = 300 };
|
||||
ChartTheme.Attach(plot);
|
||||
var page = new ScrollViewer
|
||||
{
|
||||
Height = 400,
|
||||
Content = new StackPanel { Children = { new Border { Height = 200 }, plot, new Border { Height = 900 } } },
|
||||
};
|
||||
Visuals.Layout(page, 800, 400);
|
||||
|
||||
UIElement surface = Visuals.FindAll<FrameworkElement>(plot).First(static e => string.Equals(e.GetType().Name, "SKElement", StringComparison.Ordinal));
|
||||
int surfaceWheels = 0;
|
||||
surface.MouseWheel += (_, _) => surfaceWheels++;
|
||||
var wheel = new MouseWheelEventArgs(Mouse.PrimaryDevice, Environment.TickCount, -120) { RoutedEvent = UIElement.PreviewMouseWheelEvent };
|
||||
surface.RaiseEvent(wheel);
|
||||
wheel.RoutedEvent = UIElement.MouseWheelEvent;
|
||||
surface.RaiseEvent(wheel);
|
||||
page.UpdateLayout();
|
||||
return (page.VerticalOffset, surfaceWheels);
|
||||
});
|
||||
|
||||
result.Offset.Should().BeGreaterThan(0, "a plain wheel over a chart scrolls the page it is on");
|
||||
result.SurfaceWheels.Should().Be(0, "and never reaches the surface ScottPlot zooms from: zoom is Ctrl+wheel");
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,6 @@ namespace FrameLedger.App.Tests;
|
||||
/// </summary>
|
||||
public sealed class ContrastTests
|
||||
{
|
||||
private const double _aa = 4.5;
|
||||
|
||||
private static readonly string[] _paletteAppearances = ["Info", "Caution", "Danger", "Success"];
|
||||
|
||||
/// <summary>
|
||||
@@ -91,73 +89,33 @@ public sealed class ContrastTests
|
||||
{
|
||||
var themed = new ThemesDictionary { Theme = theme };
|
||||
ApplicationAccentColorManager.Apply(_defaultAccent, theme, systemGlassColor: false, systemAccentColor: true);
|
||||
Color window = Resolve(themed, "ApplicationBackgroundColor");
|
||||
Color card = Over(Resolve(themed, "CardBackgroundFillColorDefault"), window);
|
||||
Color pillOff = Over(Resolve(themed, "ControlFillColorDefault"), card);
|
||||
Color accent = Over(Resolve(themed, "AccentFillColorDefaultBrush"), card);
|
||||
Color caution = Over(Resolve(themed, "SystemFillColorCautionBackground"), card);
|
||||
Color window = Wcag.Resolve(themed, "ApplicationBackgroundColor");
|
||||
Color card = Wcag.Over(Wcag.Resolve(themed, "CardBackgroundFillColorDefault"), window);
|
||||
Color pillOff = Wcag.Over(Wcag.Resolve(themed, "ControlFillColorDefault"), card);
|
||||
Color accent = Wcag.Over(Wcag.Resolve(themed, "AccentFillColorDefaultBrush"), card);
|
||||
Color caution = Wcag.Over(Wcag.Resolve(themed, "SystemFillColorCautionBackground"), card);
|
||||
return new Dictionary<string, double>(StringComparer.Ordinal)
|
||||
{
|
||||
["hooking off: secondary text on the pill"] = Ratio(Over(Resolve(themed, "TextFillColorSecondary"), pillOff), pillOff),
|
||||
["hooking on: on-accent text on the accent"] = Ratio(Over(Resolve(themed, "TextOnAccentFillColorPrimaryBrush"), accent), accent),
|
||||
["qualifier warning: primary text on caution"] = Ratio(Over(Resolve(themed, "TextFillColorPrimary"), caution), caution),
|
||||
["the Info badge, for the record"] = Ratio(Over(Resolve(themed, "TextFillColorPrimary"), PaletteLightBlue()), PaletteLightBlue()),
|
||||
["hooking off: secondary text on the pill"] = Wcag.Ratio(Wcag.Over(Wcag.Resolve(themed, "TextFillColorSecondary"), pillOff), pillOff),
|
||||
["hooking on: on-accent text on the accent"] = Wcag.Ratio(Wcag.Over(Wcag.Resolve(themed, "TextOnAccentFillColorPrimaryBrush"), accent), accent),
|
||||
["qualifier warning: primary text on caution"] = Wcag.Ratio(Wcag.Over(Wcag.Resolve(themed, "TextFillColorPrimary"), caution), caution),
|
||||
["the Info badge, for the record"] = Wcag.Ratio(Wcag.Over(Wcag.Resolve(themed, "TextFillColorPrimary"), PaletteLightBlue()), PaletteLightBlue()),
|
||||
};
|
||||
});
|
||||
|
||||
using (new FluentAssertions.Execution.AssertionScope(theme.ToString()))
|
||||
{
|
||||
ratios["hooking off: secondary text on the pill"].Should().BeGreaterThanOrEqualTo(_aa);
|
||||
ratios["hooking on: on-accent text on the accent"].Should().BeGreaterThanOrEqualTo(_aa);
|
||||
ratios["qualifier warning: primary text on caution"].Should().BeGreaterThanOrEqualTo(_aa);
|
||||
ratios["hooking off: secondary text on the pill"].Should().BeGreaterThanOrEqualTo(Wcag.AA);
|
||||
ratios["hooking on: on-accent text on the accent"].Should().BeGreaterThanOrEqualTo(Wcag.AA);
|
||||
ratios["qualifier warning: primary text on caution"].Should().BeGreaterThanOrEqualTo(Wcag.AA);
|
||||
}
|
||||
|
||||
if (theme == ApplicationTheme.Dark)
|
||||
{
|
||||
ratios["the Info badge, for the record"].Should().BeLessThan(_aa, "the pair this class exists for, white on #03A9F4, is what the check must be able to refuse");
|
||||
ratios["the Info badge, for the record"].Should().BeLessThan(Wcag.AA, "the pair this class exists for, white on #03A9F4, is what the check must be able to refuse");
|
||||
}
|
||||
}
|
||||
|
||||
private static Color Resolve(ResourceDictionary themed, string key)
|
||||
{
|
||||
object value = themed[key] ?? System.Windows.Application.Current.Resources[key] ?? throw new InvalidOperationException($"{key} is in neither the theme nor the merged dictionaries");
|
||||
return value switch
|
||||
{
|
||||
Color c => c,
|
||||
SolidColorBrush b => b.Color,
|
||||
_ => throw new InvalidOperationException($"{key} is not a Color or SolidColorBrush in the theme dictionary (got {value.GetType().Name})"),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>WPF UI's Palette.xaml value, the same in both themes; read from the merged dictionaries rather than typed, so a palette change upstream is measured.</summary>
|
||||
private static Color PaletteLightBlue() => Resolve(new ResourceDictionary(), "PaletteLightBlueBrush");
|
||||
|
||||
/// <summary>Source-over compositing of <paramref name="top"/> on an opaque <paramref name="under"/>.</summary>
|
||||
private static Color Over(Color top, Color under)
|
||||
{
|
||||
double a = top.A / 255.0;
|
||||
return Color.FromRgb(
|
||||
(byte)Math.Round(top.R * a + under.R * (1 - a)),
|
||||
(byte)Math.Round(top.G * a + under.G * (1 - a)),
|
||||
(byte)Math.Round(top.B * a + under.B * (1 - a)));
|
||||
}
|
||||
|
||||
/// <summary>WCAG 2.1 contrast ratio between two opaque colours.</summary>
|
||||
private static double Ratio(Color a, Color b)
|
||||
{
|
||||
double la = Luminance(a);
|
||||
double lb = Luminance(b);
|
||||
return (Math.Max(la, lb) + 0.05) / (Math.Min(la, lb) + 0.05);
|
||||
}
|
||||
|
||||
private static double Luminance(Color c)
|
||||
{
|
||||
static double Channel(byte v)
|
||||
{
|
||||
double s = v / 255.0;
|
||||
return s <= 0.03928 ? s / 12.92 : Math.Pow((s + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
|
||||
return (0.2126 * Channel(c.R)) + (0.7152 * Channel(c.G)) + (0.0722 * Channel(c.B));
|
||||
}
|
||||
private static Color PaletteLightBlue() => Wcag.Resolve(new ResourceDictionary(), "PaletteLightBlueBrush");
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Services;
|
||||
using FrameLedger.App.ViewModels;
|
||||
using FrameLedger.Application.Import;
|
||||
using Wpf.Ui.Appearance;
|
||||
using Wpf.Ui.Markup;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// The import checklist as the owner saw it (beta.14, a screenshot in the dark theme): every row white with white text, the
|
||||
/// tick boxes cut to slivers at the left edge, and a list scrolling inside a dialog that scrolled too, which carried the
|
||||
/// intro out of sight. Each check renders the dialog itself (<see cref="ImportReviewPrompt.Create"/>) laid out at a
|
||||
/// window's size under the App's dictionaries — <c>PagesLoadTests</c>' check counted the rows and looked at nothing.
|
||||
/// </summary>
|
||||
public sealed class ImportReviewRenderTests
|
||||
{
|
||||
private static ImportReviewViewModel Candidates(int count)
|
||||
{
|
||||
var list = new List<ImportCandidate>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
string dir = string.Create(CultureInfo.InvariantCulture, $@"C:\Games\Game {i}");
|
||||
string? exe = i == 1 ? null : string.Create(CultureInfo.InvariantCulture, $@"{dir}\game{i}.exe");
|
||||
list.Add(new ImportCandidate(new StoreGame("steam", i.ToString(CultureInfo.InvariantCulture), "Game " + i.ToString(CultureInfo.InvariantCulture), dir, exe, null),
|
||||
exe, AlreadyInLibrary: i == 2, ExecutableGuessed: false));
|
||||
}
|
||||
|
||||
return new ImportReviewViewModel(list) { ShowExisting = true };
|
||||
}
|
||||
|
||||
/// <summary>The dialog in a host the size of the window's dialog area, laid out.</summary>
|
||||
private static (Wpf.Ui.Controls.ContentDialog Dialog, Grid Host) Shown(ImportReviewViewModel vm, double height)
|
||||
{
|
||||
Wpf.Ui.Controls.ContentDialog dialog = ImportReviewPrompt.Create(vm);
|
||||
var host = new Grid { Width = 1000, Height = height, Children = { dialog } };
|
||||
Visuals.Layout(host, 1000, height);
|
||||
return (dialog, host);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text of every text cell against what is painted under it, composited down to the window (the tick box's glyph is an icon, not text). A row of a game already in the
|
||||
/// library is drawn at 0.55 opacity on purpose (inactive: its box cannot be ticked) and is measured as drawn before that dimming.
|
||||
/// </summary>
|
||||
[Theory]
|
||||
[InlineData(ApplicationTheme.Dark)]
|
||||
[InlineData(ApplicationTheme.Light)]
|
||||
public async Task EveryImportRowIsReadable(ApplicationTheme theme)
|
||||
{
|
||||
List<(string Text, double Ratio)> cells = await PagesLoadTests.OnStaAsync(() => Visuals.UnderTheme(theme, () =>
|
||||
{
|
||||
Color window = Wcag.Resolve(new ThemesDictionary { Theme = theme }, "ApplicationBackgroundColor");
|
||||
(Wpf.Ui.Controls.ContentDialog dialog, Grid host) = Shown(Candidates(4), 760);
|
||||
DataGrid grid = Visuals.Find<DataGrid>(dialog)!;
|
||||
var measured = new List<(string, double)>();
|
||||
foreach (DataGridCell cell in Visuals.FindAll<DataGridCell>(grid).Where(static c => c.Column is DataGridTextColumn))
|
||||
{
|
||||
foreach (TextBlock text in Visuals.FindAll<TextBlock>(cell).Where(static t => t.Text.Length > 0))
|
||||
{
|
||||
Color under = Visuals.PaintedUnder(text, host, window);
|
||||
measured.Add((text.Text, Wcag.Ratio(Visuals.TextOver(text, under), under)));
|
||||
}
|
||||
}
|
||||
|
||||
return measured;
|
||||
}));
|
||||
|
||||
cells.Should().NotBeEmpty("the rows were rendered and their cells hold text");
|
||||
cells.Should().OnlyContain(static c => c.Ratio >= Wcag.AA, $"08_UI §Contrast: every row reads at WCAG AA in the {theme} theme (the beta.11 rows were white on white in Dark)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The owner's screenshot showed each tick box as a sliver at the row's left edge: WPF UI's CheckBox style (MinWidth 120,
|
||||
/// padding 11) in a 40 px column. Counted in the rendered pixels: a ticked box is the accent's 20×20 square, about 380 accent-blue pixels when
|
||||
/// it is drawn whole and about 140 when it is the sliver.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task TheTickBoxesAreDrawnWhole()
|
||||
{
|
||||
List<int> accentPixels = await PagesLoadTests.OnStaAsync(() =>
|
||||
{
|
||||
(Wpf.Ui.Controls.ContentDialog dialog, Grid host) = Shown(Candidates(4), 760);
|
||||
var bitmap = new System.Windows.Media.Imaging.RenderTargetBitmap(1000, 760, 96, 96, PixelFormats.Pbgra32);
|
||||
bitmap.Render(host);
|
||||
byte[] pixels = new byte[1000 * 760 * 4];
|
||||
bitmap.CopyPixels(pixels, 1000 * 4, 0);
|
||||
var counts = new List<int>();
|
||||
foreach (DataGridCell cell in Visuals.FindAll<DataGridCell>(Visuals.Find<DataGrid>(dialog)!))
|
||||
{
|
||||
if (Visuals.Find<CheckBox>(cell) is { IsChecked: true } box)
|
||||
{
|
||||
// Half a row of slack above and below: the dialog's opening transform moves what is drawn a few pixels
|
||||
// from where layout puts it, and the rows on either side hold no ticked box.
|
||||
Rect area = box.TransformToAncestor(host).TransformBounds(new Rect(box.RenderSize));
|
||||
area.Inflate(0, 16);
|
||||
counts.Add(AccentPixels(pixels, 1000, area));
|
||||
}
|
||||
}
|
||||
|
||||
return counts;
|
||||
});
|
||||
|
||||
accentPixels.Should().HaveCount(2, "rows 0 and 3 start ticked; row 1 has no executable and row 2 is already in the library");
|
||||
accentPixels.Should().OnlyContain(static n => n >= 250, "a ticked box is drawn whole (about 380 accent pixels), not as a sliver (about 140)");
|
||||
}
|
||||
|
||||
/// <summary>Pixels in <paramref name="area"/> of a Pbgra32 bitmap that read as the accent's blue.</summary>
|
||||
private static int AccentPixels(byte[] pixels, int width, Rect area)
|
||||
{
|
||||
int count = 0;
|
||||
for (int y = (int)Math.Max(0, area.Top); y < (int)area.Bottom; y++)
|
||||
{
|
||||
for (int x = (int)Math.Max(0, area.Left); x < (int)Math.Min(width, area.Right); x++)
|
||||
{
|
||||
int i = ((y * width) + x) * 4;
|
||||
byte blue = pixels[i];
|
||||
byte red = pixels[i + 2];
|
||||
if (blue > 150 && red < 110)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ALongListScrollsInsideTheListAndTheIntroStaysVisible()
|
||||
{
|
||||
(double DialogScrollable, double ListScrollable, double FooterBottom, double Viewport) layout = await PagesLoadTests.OnStaAsync(() =>
|
||||
{
|
||||
(Wpf.Ui.Controls.ContentDialog dialog, _) = Shown(Candidates(60), 600);
|
||||
var body = (ScrollViewer)dialog.Template.FindName("PART_ContentScroll", dialog);
|
||||
var content = (FrameworkElement)body.Content;
|
||||
DataGrid grid = Visuals.Find<DataGrid>(content)!;
|
||||
ScrollViewer list = Visuals.Find<ScrollViewer>(grid)!;
|
||||
FrameworkElement footer = Visuals.FindAll<Wpf.Ui.Controls.TextBlock>(content).Last();
|
||||
double footerBottom = footer.TransformToAncestor(body).Transform(new Point(0, footer.ActualHeight)).Y;
|
||||
return (body.ScrollableHeight, list.ScrollableHeight, footerBottom, body.ViewportHeight);
|
||||
});
|
||||
|
||||
layout.DialogScrollable.Should().Be(0, "the dialog's own body does not scroll: nothing above the list can be carried away");
|
||||
layout.ListScrollable.Should().BeGreaterThan(0, "sixty rows scroll inside the list");
|
||||
layout.FooterBottom.Should().BeLessThanOrEqualTo(layout.Viewport + 0.5, "the selection count under the list is inside the dialog, not cut off");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Pages;
|
||||
using FrameLedger.App.Services;
|
||||
using FrameLedger.App.ViewModels;
|
||||
using FrameLedger.Infrastructure.Persistence;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// The mouse wheel on the pages (beta.14, owner: "the wheel does not scroll, I have to drag the scroll bar"). WPF UI 4.3.0's
|
||||
/// <see cref="NavigationViewContentPresenter"/> wraps a page in a <c>DynamicScrollViewer</c> unless the page sets
|
||||
/// <c>ScrollViewer.CanContentScroll="False"</c>; inside it the page's own root scroller had infinite height, nothing to
|
||||
/// scroll, and took every wheel all the same. Each check hosts a page the way the App does — navigated in the presenter.
|
||||
/// </summary>
|
||||
public sealed partial class PagesLoadTests
|
||||
{
|
||||
/// <summary>A page navigated in WPF UI's presenter and laid out in an area the size of the window's.</summary>
|
||||
private static NavigationViewContentPresenter Navigated(System.Windows.Controls.Page page, double height)
|
||||
{
|
||||
var presenter = new NavigationViewContentPresenter();
|
||||
var area = new Grid { Width = 1000, Height = height, Children = { presenter } };
|
||||
Visuals.Layout(area, 1000, height);
|
||||
_ = presenter.Navigate(page);
|
||||
Visuals.Pump();
|
||||
Visuals.Layout(area, 1000, height);
|
||||
Visuals.Pump();
|
||||
area.UpdateLayout();
|
||||
return presenter;
|
||||
}
|
||||
|
||||
private static void Wheel(UIElement over, int delta)
|
||||
{
|
||||
var wheel = new MouseWheelEventArgs(Mouse.PrimaryDevice, Environment.TickCount, delta) { RoutedEvent = UIElement.PreviewMouseWheelEvent };
|
||||
over.RaiseEvent(wheel);
|
||||
wheel.RoutedEvent = UIElement.MouseWheelEvent;
|
||||
over.RaiseEvent(wheel);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ANavigatedPageIsNotWrappedInTheDynamicScrollViewerAndTheWheelScrollsIt()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
var consent = new HookingConsent(new NoAgent(), new NoPrompt());
|
||||
(SettingsViewModel settings, LogsViewModel logs) = await SettingsAndLogsAsync(s, consent, new NoStrip());
|
||||
using LogsViewModel ownedLogs = logs;
|
||||
|
||||
(bool Wrapped, double Offset) result = await OnStaAsync(() =>
|
||||
{
|
||||
var page = new SettingsPage(settings, new SystemInfoViewModel(new FixedHardware(), new NoClipboard(), new NoStrip()));
|
||||
NavigationViewContentPresenter presenter = Navigated(page, 500);
|
||||
System.Windows.Controls.ScrollViewer root = Visuals.Find<System.Windows.Controls.ScrollViewer>(page)!;
|
||||
Wheel(Visuals.Leaf((UIElement)root.Content), -120);
|
||||
presenter.UpdateLayout();
|
||||
return (presenter.IsDynamicScrollViewerEnabled, root.VerticalOffset);
|
||||
});
|
||||
|
||||
result.Wrapped.Should().BeFalse("the page opts out of WPF UI's wrapper (ScrollViewer.CanContentScroll=\"False\")");
|
||||
result.Offset.Should().BeGreaterThan(0, "the wheel over the page's text scrolls the page");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TheLogsTailIsBoundedAndFollowsTheEnd()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
var consent = new HookingConsent(new NoAgent(), new NoPrompt());
|
||||
(_, LogsViewModel logs) = await SettingsAndLogsAsync(s, consent, new NoStrip());
|
||||
using LogsViewModel ownedLogs = logs;
|
||||
|
||||
(double Height, double Offset) tail = await OnStaAsync(() =>
|
||||
{
|
||||
var page = new LogsPage(logs);
|
||||
_ = Navigated(page, 500);
|
||||
page.Tail.Text = string.Join(Environment.NewLine, Enumerable.Range(1, 400).Select(static i => "line " + i.ToString(System.Globalization.CultureInfo.InvariantCulture)));
|
||||
page.UpdateLayout();
|
||||
page.Tail.ScrollToEnd();
|
||||
page.UpdateLayout();
|
||||
return (page.Tail.ActualHeight, page.Tail.VerticalOffset);
|
||||
});
|
||||
|
||||
tail.Height.Should().BeLessThan(500, "the tail has the height the page leaves it, not one tall enough for every line");
|
||||
tail.Offset.Should().BeGreaterThan(0, "so it scrolls, and ScrollToEnd (autoscroll) shows the newest line");
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace FrameLedger.App.Tests;
|
||||
/// binding typo or a missing resource key produces is a XamlParseException at first navigation, which no
|
||||
/// view-model test sees. Runs on an STA thread with an <c>Application</c> of its own.
|
||||
/// </summary>
|
||||
public sealed class PagesLoadTests
|
||||
public sealed partial class PagesLoadTests
|
||||
{
|
||||
private sealed class NoAgent : IAgentLink
|
||||
{
|
||||
@@ -563,20 +563,29 @@ public sealed class PagesLoadTests
|
||||
(SettingsViewModel settings, LogsViewModel logs) = await SettingsAndLogsAsync(s, consent, strip);
|
||||
using LogsViewModel _ = logs;
|
||||
|
||||
string loaded = await OnStaAsync(() =>
|
||||
(string loaded, List<string> wrapped) = await OnStaAsync(() =>
|
||||
{
|
||||
Render(new DashboardPage(dashboard));
|
||||
Render(new GamesPage(games));
|
||||
Render(new GameDetailPage(detail));
|
||||
Render(new ComparePage(compare));
|
||||
Render(new SettingsPage(settings, new SystemInfoViewModel(new FixedHardware(), new NoClipboard(), strip)));
|
||||
Render(new LogsPage(logs));
|
||||
// WPF UI changes ScrollViewer.CanContentScroll's default for Page to true when its content presenter is first
|
||||
// used, as the App's NavigationView does at start-up; a page that keeps it is wrapped in a scroller (beta.14).
|
||||
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(typeof(Wpf.Ui.Controls.NavigationViewContentPresenter).TypeHandle);
|
||||
System.Windows.Controls.Page[] pages =
|
||||
[
|
||||
new DashboardPage(dashboard), new GamesPage(games), new GameDetailPage(detail), new ComparePage(compare),
|
||||
new SettingsPage(settings, new SystemInfoViewModel(new FixedHardware(), new NoClipboard(), strip)), new LogsPage(logs),
|
||||
];
|
||||
foreach (System.Windows.Controls.Page page in pages)
|
||||
{
|
||||
Render(page);
|
||||
}
|
||||
|
||||
RenderFirstRun(s);
|
||||
RenderControls(detail);
|
||||
return "dashboard,games,detail,settings,logs,firstrun,readout,chip";
|
||||
return ("dashboard,games,detail,settings,logs,firstrun,readout,chip",
|
||||
pages.Where(static p => System.Windows.Controls.ScrollViewer.GetCanContentScroll(p)).Select(static p => p.GetType().Name).ToList());
|
||||
});
|
||||
|
||||
loaded.Should().Be("dashboard,games,detail,settings,logs,firstrun,readout,chip");
|
||||
wrapped.Should().BeEmpty("every page sets ScrollViewer.CanContentScroll=\"False\", or WPF UI wraps it in a scroller its own root swallows the wheel for (16_WPFUI_SYNTAX §Gotchas)");
|
||||
settings.MinSessionSeconds.Should().Be(30);
|
||||
games.Games.Should().ContainSingle();
|
||||
detail.Sessions.Should().HaveCount(2);
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Services;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// <c>ui.hide_scrollbars</c> (beta.14, owner request 2026-10-05: "an option to hide the scroll bars but still scroll"). Each
|
||||
/// check builds the scrollers the App shows — a plain one, a DataGrid's, a multi-line TextBox's, a rendered document's, and
|
||||
/// one whose axis is Disabled — and turns the option on and off within one job on the STA thread. The option is process-wide
|
||||
/// state, so the class runs with the other classes that write such state, one at a time.
|
||||
/// </summary>
|
||||
[Collection(StringsCultureCollection.Name)]
|
||||
public sealed class ScrollBarHidingTests
|
||||
{
|
||||
/// <summary>Every kind of scroller the App has, each with more content than its height, laid out in a column.</summary>
|
||||
private static (StackPanel Root, ScrollViewer Plain, ScrollViewer Disabled) Scrollers()
|
||||
{
|
||||
var plain = new ScrollViewer { Height = 120, VerticalScrollBarVisibility = ScrollBarVisibility.Auto, Content = new Border { Height = 600 } };
|
||||
var disabled = new ScrollViewer { Height = 120, VerticalScrollBarVisibility = ScrollBarVisibility.Disabled, Content = new TextBlock { Text = "wraps" } };
|
||||
var grid = new DataGrid { Height = 120, ItemsSource = Enumerable.Range(1, 50).Select(static i => new { Row = i }).ToList() };
|
||||
var text = new TextBox
|
||||
{
|
||||
Height = 120,
|
||||
AcceptsReturn = true,
|
||||
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
|
||||
Text = string.Join(Environment.NewLine, Enumerable.Range(1, 60).Select(static i => "line " + i.ToString(System.Globalization.CultureInfo.InvariantCulture))),
|
||||
};
|
||||
var document = new FlowDocumentScrollViewer { Height = 120, Document = new FlowDocument(new Paragraph(new Run(string.Join(" ", Enumerable.Repeat("word", 600))))) };
|
||||
var root = new StackPanel { Width = 600, Children = { plain, disabled, grid, text, document } };
|
||||
Visuals.Layout(root, 600, 900);
|
||||
return (root, plain, disabled);
|
||||
}
|
||||
|
||||
private static List<ScrollViewer> All(DependencyObject root) => [.. Visuals.FindAll<ScrollViewer>(root)];
|
||||
|
||||
[Fact]
|
||||
public async Task OnHidesEveryBarAndTheWheelStillScrolls()
|
||||
{
|
||||
(int Viewers, List<string> Shown, ScrollBarVisibility DisabledAxis, double Offset) result = await PagesLoadTests.OnStaAsync(() =>
|
||||
{
|
||||
(StackPanel root, ScrollViewer plain, ScrollViewer disabled) = Scrollers();
|
||||
try
|
||||
{
|
||||
ScrollBarHiding.Apply(true);
|
||||
ScrollBarHiding.ApplyUnder(root);
|
||||
root.UpdateLayout();
|
||||
List<ScrollViewer> viewers = All(root);
|
||||
List<string> shown = [.. viewers.Where(static v => v.ComputedVerticalScrollBarVisibility == Visibility.Visible || v.ComputedHorizontalScrollBarVisibility == Visibility.Visible)
|
||||
.Select(static v => (v.TemplatedParent ?? v).GetType().Name)];
|
||||
|
||||
var wheel = new MouseWheelEventArgs(Mouse.PrimaryDevice, Environment.TickCount, -120) { RoutedEvent = UIElement.MouseWheelEvent };
|
||||
((UIElement)plain.Content).RaiseEvent(wheel);
|
||||
root.UpdateLayout();
|
||||
return (viewers.Count, shown, disabled.VerticalScrollBarVisibility, plain.VerticalOffset);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ScrollBarHiding.Apply(false);
|
||||
}
|
||||
});
|
||||
|
||||
result.Viewers.Should().BeGreaterThanOrEqualTo(5, "the plain scroller, the disabled one and those inside the grid, the box and the document");
|
||||
result.Shown.Should().BeEmpty("no scroller draws a bar while the option is on");
|
||||
result.DisabledAxis.Should().Be(ScrollBarVisibility.Disabled, "a disabled axis lays its content out at the viewport's size, and is left alone");
|
||||
result.Offset.Should().BeGreaterThan(0, "a hidden bar is still a scroller: the wheel moves it");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task OffRestoresWhatEachViewerHad()
|
||||
{
|
||||
(List<ScrollBarVisibility> Before, List<ScrollBarVisibility> Hidden, List<ScrollBarVisibility> After) result = await PagesLoadTests.OnStaAsync(() =>
|
||||
{
|
||||
(StackPanel root, _, _) = Scrollers();
|
||||
List<ScrollBarVisibility> Read() => [.. All(root).Select(static v => v.VerticalScrollBarVisibility)];
|
||||
List<ScrollBarVisibility> before = Read();
|
||||
try
|
||||
{
|
||||
ScrollBarHiding.Apply(true);
|
||||
ScrollBarHiding.ApplyUnder(root);
|
||||
List<ScrollBarVisibility> hidden = Read();
|
||||
ScrollBarHiding.Apply(false);
|
||||
ScrollBarHiding.ApplyUnder(root);
|
||||
return (before, hidden, Read());
|
||||
}
|
||||
finally
|
||||
{
|
||||
ScrollBarHiding.Apply(false);
|
||||
}
|
||||
});
|
||||
|
||||
result.Hidden.Should().NotEqual(result.Before, "the option changed something");
|
||||
result.After.Should().Equal(result.Before, "off puts back every scroller's own setting");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AScrollerThatLoadsWhileOnIsHiddenAndOneThatLoadsAfterOffIsLeftAlone()
|
||||
{
|
||||
(ScrollBarVisibility WhileOn, ScrollBarVisibility FirstAfterOff, ScrollBarVisibility LoadedAfterOff) result = await PagesLoadTests.OnStaAsync(() =>
|
||||
{
|
||||
ScrollBarHiding.Register();
|
||||
try
|
||||
{
|
||||
ScrollBarHiding.Apply(true);
|
||||
var first = new ScrollViewer { VerticalScrollBarVisibility = ScrollBarVisibility.Auto };
|
||||
first.RaiseEvent(new RoutedEventArgs(FrameworkElement.LoadedEvent, first));
|
||||
ScrollBarVisibility whileOn = first.VerticalScrollBarVisibility;
|
||||
|
||||
ScrollBarHiding.Apply(false);
|
||||
first.RaiseEvent(new RoutedEventArgs(FrameworkElement.LoadedEvent, first));
|
||||
var second = new ScrollViewer { VerticalScrollBarVisibility = ScrollBarVisibility.Visible };
|
||||
second.RaiseEvent(new RoutedEventArgs(FrameworkElement.LoadedEvent, second));
|
||||
return (whileOn, first.VerticalScrollBarVisibility, second.VerticalScrollBarVisibility);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ScrollBarHiding.Apply(false);
|
||||
}
|
||||
});
|
||||
|
||||
result.WhileOn.Should().Be(ScrollBarVisibility.Hidden, "the class handler reaches a scroller as it loads");
|
||||
result.FirstAfterOff.Should().Be(ScrollBarVisibility.Auto, "and gives it back its own setting on its next load after off");
|
||||
result.LoadedAfterOff.Should().Be(ScrollBarVisibility.Visible, "a scroller the option never touched keeps what it has");
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,7 @@ public sealed class SettingsViewModelTests
|
||||
h.Vm.MinSessionSeconds.Should().Be(30);
|
||||
h.Vm.TelemetryIntervalMs.Should().Be(1000);
|
||||
h.Vm.RetentionRawSessions.Should().Be(20);
|
||||
h.Vm.UpdateChannel.Should().Be("stable");
|
||||
h.Vm.UpdateChannel.Should().Be("auto", "D47 (beta.14): the channel follows the running copy unless the user chose one");
|
||||
h.Vm.LogDebug.Should().BeFalse();
|
||||
h.Vm.KillSwitchState.Should().Be(Strings.Settings_KillSwitch_Off);
|
||||
h.Vm.VulkanLayerText.Should().Be(Strings.Settings_VkLayer_NotStaged, "no layer DLL in the fake");
|
||||
@@ -419,6 +419,28 @@ public sealed class SettingsViewModelTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HidingScrollBarsIsOffByDefaultAndItsToggleIsPersistedAndAppliedAtOnce()
|
||||
{
|
||||
// beta.14 (owner request 2026-10-05): ui.hide_scrollbars, default 0; the scrollers on screen follow it at once.
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
Harness h = await OpenAsync(s);
|
||||
h.Vm.HideScrollBars.Should().BeFalse();
|
||||
try
|
||||
{
|
||||
h.Vm.HideScrollBars = true;
|
||||
Task pending = h.Vm.Pending;
|
||||
await pending;
|
||||
|
||||
(await h.Settings.GetBooleanAsync(SettingsRegistry.UiHideScrollBars, Ct)).Should().BeTrue();
|
||||
ScrollBarHiding.Hidden.Should().BeTrue();
|
||||
}
|
||||
finally
|
||||
{
|
||||
ScrollBarHiding.Apply(false);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ARevokeTheAgentCannotTakeStaysInTheListAndSaysWhy()
|
||||
{
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace FrameLedger.App.Tests;
|
||||
/// first gate run on xUnit.net v3 4.0.1 (2026-09-21) read "Settings" where it had just written <c>vi</c>. The race was
|
||||
/// always there; the new scheduler found it. An implicit collection: no fixture, so no definition class is needed.
|
||||
/// Since beta.8 it also holds the classes that write <c>FpsDecimals.Two</c> or read FPS text the setting changes — the
|
||||
/// same kind of process-wide formatting state.
|
||||
/// same kind of process-wide formatting state — and since beta.14 <see cref="ScrollBarHidingTests"/>, whose option is a
|
||||
/// process-wide flag that <c>SettingsViewModelTests</c> writes too.
|
||||
/// </summary>
|
||||
internal static class StringsCultureCollection
|
||||
{
|
||||
|
||||
@@ -12,6 +12,9 @@ internal sealed class FakeUpdateClient : IUpdateClient
|
||||
|
||||
public string? CurrentVersion { get; set; } = "0.1.0";
|
||||
|
||||
/// <summary>A package an earlier run left downloaded (beta.14), or null.</summary>
|
||||
public UpdateCandidate? Pending { get; set; }
|
||||
|
||||
/// <summary>What the next check returns; null is "current".</summary>
|
||||
public UpdateCandidate? Next { get; set; }
|
||||
|
||||
@@ -29,6 +32,8 @@ internal sealed class FakeUpdateClient : IUpdateClient
|
||||
|
||||
public List<string> Applied { get; } = [];
|
||||
|
||||
public UpdateCandidate? FindPendingRestart() => Pending;
|
||||
|
||||
public Task<UpdateCandidate?> CheckAsync(bool includePrereleases, CancellationToken ct = default)
|
||||
{
|
||||
Checks.Add(includePrereleases);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.IO;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Update;
|
||||
|
||||
namespace FrameLedger.App.Tests.Update;
|
||||
|
||||
/// <summary>
|
||||
/// beta.14: an update waits while a game still holds a library FrameLedger loads into games. A file another process keeps
|
||||
/// open stands in for a mapped image here — both refuse the exclusive write the check asks for.
|
||||
/// </summary>
|
||||
public sealed class PayloadInUseTests : IDisposable
|
||||
{
|
||||
private readonly string _dir = Path.Combine(Path.GetTempPath(), "fl-payload-" + Guid.NewGuid().ToString("N"));
|
||||
|
||||
public PayloadInUseTests()
|
||||
{
|
||||
Directory.CreateDirectory(_dir);
|
||||
foreach (string name in PayloadInUse.Files)
|
||||
{
|
||||
File.WriteAllBytes(Path.Combine(_dir, name), [0x4D, 0x5A]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose() => Directory.Delete(_dir, recursive: true);
|
||||
|
||||
[Fact]
|
||||
public void NothingHoldsThePayloadAfterTheGamesHaveExited() => PayloadInUse.Find(_dir).Should().BeNull();
|
||||
|
||||
[Fact]
|
||||
public void AnOverlayAGameStillHoldsIsNamed()
|
||||
{
|
||||
using var game = new FileStream(Path.Combine(_dir, "FrameLedger.Overlay.dll"), FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
|
||||
|
||||
PayloadInUse.Find(_dir).Should().Be("FrameLedger.Overlay.dll");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AFolderWithoutThePayloadHoldsNothing() => PayloadInUse.Find(Path.GetTempPath()).Should().BeNull("a library that is not there is not in use");
|
||||
}
|
||||
@@ -17,6 +17,8 @@ public sealed class UninstallHookTests
|
||||
|
||||
public int Task { get; set; }
|
||||
|
||||
public int RunValue { get; set; }
|
||||
|
||||
public int Asked { get; set; }
|
||||
|
||||
public int Deleted { get; set; }
|
||||
@@ -43,6 +45,11 @@ public sealed class UninstallHookTests
|
||||
Task++;
|
||||
return true;
|
||||
},
|
||||
removeRunValue: () =>
|
||||
{
|
||||
RunValue++;
|
||||
return true;
|
||||
},
|
||||
askDeleteData: () =>
|
||||
{
|
||||
Asked++;
|
||||
@@ -68,8 +75,8 @@ public sealed class UninstallHookTests
|
||||
|
||||
UninstallOutcome outcome = p.Hook().Run();
|
||||
|
||||
outcome.Should().Be(new UninstallOutcome(true, true, true, true, true));
|
||||
(p.Agent, p.Layer, p.Task, p.Asked, p.Deleted).Should().Be((1, 1, 1, 1, 1));
|
||||
outcome.Should().Be(new UninstallOutcome(true, true, true, true, true, true));
|
||||
(p.Agent, p.Layer, p.Task, p.RunValue, p.Asked, p.Deleted).Should().Be((1, 1, 1, 1, 1, 1), "beta.14: the Run value named an executable the uninstaller deletes");
|
||||
p.Log.Should().Contain(static l => l.Contains("data folder delete: done", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
@@ -80,7 +87,7 @@ public sealed class UninstallHookTests
|
||||
|
||||
UninstallOutcome outcome = p.Hook().Run();
|
||||
|
||||
outcome.Should().Be(new UninstallOutcome(true, true, true, true, false));
|
||||
outcome.Should().Be(new UninstallOutcome(true, true, true, true, true, false));
|
||||
p.Deleted.Should().Be(0, "the folder is the user's; only a yes removes it");
|
||||
(p.Layer, p.Task).Should().Be((1, 1));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Update;
|
||||
|
||||
namespace FrameLedger.App.Tests.Update;
|
||||
|
||||
/// <summary>
|
||||
/// D47 (beta.14): the update channel follows the running copy unless the user chose one. Every release so far is a GitHub
|
||||
/// pre-release, and the old default — stable — found none of them.
|
||||
/// </summary>
|
||||
public sealed class UpdateChannelPolicyTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("0.1.0-beta.14", true)]
|
||||
[InlineData("0.1.0-beta.9", true)]
|
||||
[InlineData("1.0.0-rc.1+abc123", true)]
|
||||
[InlineData("0.1.0", false)]
|
||||
[InlineData("1.2.3+build-7", false)]
|
||||
[InlineData("", false)]
|
||||
[InlineData(null, false)]
|
||||
public void APrereleaseHasADashBeforeAnyBuildMetadata(string? version, bool prerelease) =>
|
||||
UpdateChannelPolicy.IsPrerelease(version).Should().Be(prerelease);
|
||||
|
||||
[Theory]
|
||||
[InlineData("auto", "0.1.0-beta.14", true)]
|
||||
[InlineData("auto", "0.1.0", false)]
|
||||
[InlineData("stable", "0.1.0-beta.14", false)]
|
||||
[InlineData("beta", "0.1.0", true)]
|
||||
[InlineData("auto", null, false)]
|
||||
public void AutomaticFollowsTheCopyAndAChoiceWins(string channel, string? running, bool prereleases) =>
|
||||
UpdateChannelPolicy.IncludesPrereleases(channel, running).Should().Be(prereleases);
|
||||
}
|
||||
@@ -24,6 +24,10 @@ public sealed class UpdateFailureMapperTests
|
||||
{ new TaskCanceledException("timeout"), UpdateFailure.Offline },
|
||||
{ new SocketException(10060), UpdateFailure.Offline },
|
||||
{ new TimeoutException(), UpdateFailure.Offline },
|
||||
{ new HttpIOException(HttpRequestError.ResponseEnded, "the response ended prematurely"), UpdateFailure.Offline },
|
||||
{ new System.IO.IOException("Unable to read data from the transport connection", new SocketException(10054)), UpdateFailure.Offline },
|
||||
// beta.14: an I/O error that is not the network's — a full disk, a file held by another process — is not "offline".
|
||||
{ new System.IO.IOException("There is not enough space on the disk."), UpdateFailure.Unknown },
|
||||
{ new InvalidOperationException("wrapped by the source", new HttpRequestException("gone", null, HttpStatusCode.NotFound)), UpdateFailure.NotFound },
|
||||
{ new HttpRequestException("odd", null, HttpStatusCode.Unauthorized), UpdateFailure.Unknown },
|
||||
{ new InvalidOperationException("no idea"), UpdateFailure.Unknown },
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Globalization;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Update;
|
||||
|
||||
namespace FrameLedger.App.Tests.Update;
|
||||
|
||||
/// <summary>
|
||||
/// beta.14: the offer says the download Velopack will make. With deltas in the feed (beta.13 on) that is a few megabytes,
|
||||
/// and the offer said the full package's ~102 MB.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the expected texts are resources that follow the UI culture")]
|
||||
public sealed class UpdatePromptsTests
|
||||
{
|
||||
[Fact]
|
||||
public void WithADeltaTheOfferSaysItsSizeAndNamesTheFullPackageAsTheFallback()
|
||||
{
|
||||
var candidate = new UpdateCandidate("0.1.0-beta.14", null, 107_131_729) { DeltaBytes = 1_599_033 };
|
||||
|
||||
UpdatePrompts.OfferText(candidate).Should().Be(string.Format(CultureInfo.CurrentCulture, Strings.Update_Available_Body_Delta_Format,
|
||||
"0.1.0-beta.14", 1.5.ToString("0.#", CultureInfo.CurrentCulture), "102"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WithoutADeltaTheOfferSaysTheFullPackage()
|
||||
{
|
||||
var candidate = new UpdateCandidate("0.1.0-beta.14", null, 107_131_729);
|
||||
|
||||
UpdatePrompts.OfferText(candidate).Should().Be(string.Format(CultureInfo.CurrentCulture, Strings.Update_Available_Body_Format, "0.1.0-beta.14", "102"));
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ namespace FrameLedger.App.Tests.Update;
|
||||
/// and the apply — <c>Shutdown</c> to the Agent, the relaunch held, the updater told, the host ended — or refused
|
||||
/// with everything left as it was.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the expected texts are resources that follow the UI culture")]
|
||||
public sealed class UpdateServiceTests
|
||||
{
|
||||
private static CancellationToken Ct => TestContext.Current.CancellationToken;
|
||||
@@ -53,9 +54,12 @@ public sealed class UpdateServiceTests
|
||||
/// <summary>Whether an Agent process still holds the data folder (beta.10) — this test's, never the real folder's lock.</summary>
|
||||
public bool AgentHeld { get; set; }
|
||||
|
||||
/// <summary>A library a game still has loaded from the install folder (beta.14) — this test's, never the real folder's.</summary>
|
||||
public string? PayloadHeld { get; set; }
|
||||
|
||||
public Harness(TimeSpan? agentStop = null)
|
||||
{
|
||||
Service = new UpdateService(Client, Agent, new RegisteredSettings(Store), Prompts, Shell, Strip, agentStop, () => AgentHeld);
|
||||
Service = new UpdateService(Client, Agent, new RegisteredSettings(Store), Prompts, Shell, Strip, agentStop, () => AgentHeld, () => PayloadHeld);
|
||||
Service.Available += (_, e) => Available.Add(e.Version);
|
||||
}
|
||||
}
|
||||
@@ -97,7 +101,7 @@ public sealed class UpdateServiceTests
|
||||
|
||||
await h.Service.CheckSilentlyAsync(Ct);
|
||||
|
||||
h.Client.Checks.Should().ContainSingle().Which.Should().BeFalse("the stable channel asks for no pre-releases");
|
||||
h.Client.Checks.Should().ContainSingle().Which.Should().BeFalse("the automatic channel on a release copy (0.1.0) asks for no pre-releases");
|
||||
h.Service.Stage.Should().Be(UpdateStage.Idle);
|
||||
h.Prompts.Offered.Should().BeEmpty();
|
||||
h.Prompts.UpToDate.Should().BeEmpty("silent means silent");
|
||||
@@ -120,6 +124,106 @@ public sealed class UpdateServiceTests
|
||||
h.Prompts.Offered.Should().BeEmpty("the startup check never asks; the banner offers the restart");
|
||||
}
|
||||
|
||||
/// <summary>D47 (beta.14): with no choice stored, a pre-release copy asks for pre-releases — the stable default found none.</summary>
|
||||
[Fact]
|
||||
public async Task APrereleaseCopyWithNoChoiceAsksForPrereleases()
|
||||
{
|
||||
var h = new Harness();
|
||||
h.Client.CurrentVersion = "0.1.0-beta.13";
|
||||
|
||||
await h.Service.CheckSilentlyAsync(Ct);
|
||||
|
||||
h.Client.Checks.Should().ContainSingle().Which.Should().BeTrue("every release so far is a GitHub pre-release");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AnExplicitStableChoiceWinsOnAPrereleaseCopy()
|
||||
{
|
||||
var h = new Harness();
|
||||
h.Client.CurrentVersion = "0.1.0-beta.13";
|
||||
h.Store.Rows[SettingsRegistry.UpdateChannel.Key] = "stable";
|
||||
|
||||
await h.Service.CheckSilentlyAsync(Ct);
|
||||
|
||||
h.Client.Checks.Should().ContainSingle().Which.Should().BeFalse("the user chose stable");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.14: Velopack applied a package an earlier run had downloaded at the next start, before FR-12 or the Agent's stop.
|
||||
/// With that switched off the App offers it — Ready at once, no feed request — and applies it the usual way.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task APackageDownloadedBeforeARestartIsReadyWithoutAFeedRequest()
|
||||
{
|
||||
var h = new Harness();
|
||||
h.Agent.IsConnected = false;
|
||||
h.Client.Pending = Candidate();
|
||||
|
||||
h.Service.AdoptPending();
|
||||
await h.Service.CheckSilentlyAsync(Ct);
|
||||
|
||||
h.Service.Stage.Should().Be(UpdateStage.Ready);
|
||||
h.Service.Version.Should().Be("0.2.0");
|
||||
h.Client.Checks.Should().BeEmpty("the startup check has nothing to do while a package waits");
|
||||
|
||||
await h.Service.RestartToUpdateAsync(Ct);
|
||||
|
||||
h.Client.Applied.Should().Equal("0.2.0");
|
||||
h.Shell.Quits.Should().Be(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void APendingPackageWhileASessionRunsIsDeferred()
|
||||
{
|
||||
var h = new Harness();
|
||||
h.Agent.Status = Status("capturing", 1);
|
||||
h.Agent.RaiseChanged();
|
||||
h.Client.Pending = Candidate();
|
||||
|
||||
h.Service.AdoptPending();
|
||||
|
||||
h.Service.Stage.Should().Be(UpdateStage.Deferred, "FR-12 holds for a package an earlier run downloaded, as for any other");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.14: a game measured earlier can still have the Overlay loaded from the install folder; the updater would fail half
|
||||
/// way after the App had quit. The apply waits, says why, and leaves the Agent running.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task AGameThatStillHasTheOverlayMappedKeepsTheUpdateReadyAndSaysWhy()
|
||||
{
|
||||
var h = new Harness { PayloadHeld = "FrameLedger.Overlay.dll" };
|
||||
h.Client.Next = Candidate();
|
||||
await h.Service.CheckSilentlyAsync(Ct);
|
||||
|
||||
await h.Service.RestartToUpdateAsync(Ct);
|
||||
|
||||
h.Client.Applied.Should().BeEmpty();
|
||||
h.Agent.Sent.Should().BeEmpty("the Agent is not stopped for an update that cannot run");
|
||||
h.Agent.Holds.Should().BeEmpty();
|
||||
h.Shell.Quits.Should().Be(0);
|
||||
h.Service.Stage.Should().Be(UpdateStage.Ready);
|
||||
h.Strip.Shown.Should().ContainSingle().Which.Body.Should().Be(string.Format(System.Globalization.CultureInfo.CurrentCulture, Strings.Update_PayloadInUse_Format, "FrameLedger.Overlay.dll"));
|
||||
}
|
||||
|
||||
/// <summary>beta.14: an Agent started by the logon task waits on the administrator prompt holding only its marker — and is not updated under.</summary>
|
||||
[Fact]
|
||||
public void AnAgentWaitingOnTheAdministratorPromptHoldsTheFolder()
|
||||
{
|
||||
string folder = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "fl-elevating-" + Guid.NewGuid().ToString("N"));
|
||||
UpdateService.AgentHolds(folder).Should().BeFalse();
|
||||
using (Infrastructure.Startup.ElevationMarker.TryAcquire(folder) ?? throw new InvalidOperationException("the marker could not be taken"))
|
||||
{
|
||||
UpdateService.AgentHolds(folder).Should().BeTrue("the marker is the Agent's until its lock exists");
|
||||
}
|
||||
|
||||
UpdateService.AgentHolds(folder).Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheStopBudgetOutlastsTheAgentsOwnShutdownGrace() =>
|
||||
UpdateService.DefaultAgentStopTimeout.Should().BeGreaterThan(IpcProtocol.AgentShutdownGrace, "the App waited 10 s for an Agent whose host gives its sessions 15 to finalize");
|
||||
|
||||
[Fact]
|
||||
public async Task TheBetaChannelAsksForPrereleases()
|
||||
{
|
||||
@@ -316,6 +420,8 @@ public sealed class UpdateServiceTests
|
||||
|
||||
public string? CurrentVersion => "0.1.0";
|
||||
|
||||
public UpdateCandidate? FindPendingRestart() => null;
|
||||
|
||||
public Task<UpdateCandidate?> CheckAsync(bool includePrereleases, CancellationToken ct = default) =>
|
||||
Task.FromException<UpdateCandidate?>(new InvalidOperationException("not wrapped"));
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Reflection;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Update;
|
||||
using Velopack;
|
||||
|
||||
namespace FrameLedger.App.Tests.Update;
|
||||
|
||||
/// <summary>
|
||||
/// beta.14 (the update audit): what <see cref="VelopackHooks.Configure"/> hands Velopack. Read through Velopack 1.2.0's private
|
||||
/// fields, because the builder exposes no getters — pinned to that version (<c>Directory.Packages.props</c>): an upgrade that
|
||||
/// renames them turns this red rather than letting the apply-at-start come back unseen.
|
||||
/// </summary>
|
||||
public sealed class VelopackHooksTests
|
||||
{
|
||||
private static object? Field(VelopackApp app, string name) =>
|
||||
typeof(VelopackApp).GetField(name, BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(app)
|
||||
?? throw new InvalidOperationException($"VelopackApp.{name} is gone: re-read the pinned version's builder");
|
||||
|
||||
[Fact]
|
||||
public void ADownloadedUpdateIsNeverAppliedAtStartBehindTheAppsBack()
|
||||
{
|
||||
VelopackApp app = VelopackHooks.Configure(VelopackApp.Build());
|
||||
|
||||
Field(app, "_autoApply").Should().Be(false, "Velopack applied a downloaded package at the next start, before FR-12 or the Agent's stop could run");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void VelopacksDiagnosticsGoToTheAppsLogAndTheAgentIsAskedToStopBeforeAnUpdate()
|
||||
{
|
||||
VelopackApp app = VelopackHooks.Configure(VelopackApp.Build());
|
||||
|
||||
Field(app, "_customLogger").Should().BeOfType<VelopackSerilogLogger>();
|
||||
Field(app, "_obsolete").Should().NotBeNull("OnBeforeUpdateFastCallback stops the Agent before Velopack replaces the version");
|
||||
Field(app, "_uninstall").Should().NotBeNull();
|
||||
Field(app, "_restarted").Should().NotBeNull();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using Wpf.Ui.Appearance;
|
||||
using Wpf.Ui.Markup;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Visual-tree helpers for the rendered checks (beta.14), all run on <see cref="PagesLoadTests.OnStaAsync{T}"/>'s thread:
|
||||
/// find elements, pump the dispatcher, lay out at a size, swap the theme for one check, and the colour actually painted
|
||||
/// under an element — the stack of backgrounds a pixel shows, composited, rather than one control's Background property.
|
||||
/// </summary>
|
||||
internal static class Visuals
|
||||
{
|
||||
public static T? Find<T>(DependencyObject root)
|
||||
where T : DependencyObject => FindAll<T>(root).FirstOrDefault();
|
||||
|
||||
public static IEnumerable<T> FindAll<T>(DependencyObject root)
|
||||
where T : DependencyObject
|
||||
{
|
||||
int count = VisualTreeHelper.GetChildrenCount(root);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
DependencyObject child = VisualTreeHelper.GetChild(root, i);
|
||||
if (child is T hit)
|
||||
{
|
||||
yield return hit;
|
||||
}
|
||||
|
||||
foreach (T deeper in FindAll<T>(child))
|
||||
{
|
||||
yield return deeper;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The innermost element under <paramref name="root"/> along first children — where a pointer over it would land.</summary>
|
||||
public static UIElement Leaf(UIElement root)
|
||||
{
|
||||
UIElement current = root;
|
||||
while (VisualTreeHelper.GetChildrenCount(current) > 0 && VisualTreeHelper.GetChild(current, 0) is UIElement child)
|
||||
{
|
||||
current = child;
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
/// <summary>Runs the dispatcher's queue down to background priority — a Frame's navigation, Loaded, a deferred layout.</summary>
|
||||
public static void Pump()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
var frame = new DispatcherFrame();
|
||||
#pragma warning disable VSTHRD001 // a test's own STA thread: no JoinableTaskFactory exists here, and the frame is what is waited on
|
||||
_ = Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(_ =>
|
||||
{
|
||||
frame.Continue = false;
|
||||
return null;
|
||||
}), null);
|
||||
#pragma warning restore VSTHRD001
|
||||
Dispatcher.PushFrame(frame);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Layout(FrameworkElement element, double width, double height)
|
||||
{
|
||||
element.Measure(new Size(width, height));
|
||||
element.Arrange(new Rect(0, 0, width, height));
|
||||
element.UpdateLayout();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs <paramref name="work"/> with the App's theme dictionary swapped for <paramref name="theme"/>, and puts Dark back:
|
||||
/// elements made inside take the theme's resources when they are created.
|
||||
/// </summary>
|
||||
public static T UnderTheme<T>(ApplicationTheme theme, Func<T> work)
|
||||
{
|
||||
System.Collections.ObjectModel.Collection<ResourceDictionary> merged = System.Windows.Application.Current.Resources.MergedDictionaries;
|
||||
int index = merged.ToList().FindIndex(static d => d is ThemesDictionary);
|
||||
ResourceDictionary original = merged[index];
|
||||
merged[index] = new ThemesDictionary { Theme = theme };
|
||||
try
|
||||
{
|
||||
return work();
|
||||
}
|
||||
finally
|
||||
{
|
||||
merged[index] = original;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The colour painted under <paramref name="element"/>: every Border's and Panel's background from <paramref name="root"/>
|
||||
/// down to the element, composited over <paramref name="window"/> — what a template's parts draw, which is what the eye sees.
|
||||
/// </summary>
|
||||
public static Color PaintedUnder(DependencyObject element, DependencyObject root, Color window)
|
||||
{
|
||||
var chain = new List<Brush?>();
|
||||
for (DependencyObject? at = element; at is not null; at = VisualTreeHelper.GetParent(at))
|
||||
{
|
||||
chain.Add(at switch
|
||||
{
|
||||
Border b => b.Background,
|
||||
Panel p => p.Background,
|
||||
_ => null,
|
||||
});
|
||||
if (ReferenceEquals(at, root))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Color painted = window;
|
||||
for (int i = chain.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (chain[i] is SolidColorBrush { Color.A: > 0 } solid)
|
||||
{
|
||||
painted = Wcag.Over(Color.FromArgb((byte)Math.Round(solid.Color.A * solid.Opacity), solid.Color.R, solid.Color.G, solid.Color.B), painted);
|
||||
}
|
||||
}
|
||||
|
||||
return painted;
|
||||
}
|
||||
|
||||
/// <summary>A TextBlock's text colour as drawn over <paramref name="under"/>.</summary>
|
||||
public static Color TextOver(TextBlock text, Color under) =>
|
||||
text.Foreground is SolidColorBrush brush ? Wcag.Over(brush.Color, under) : throw new InvalidOperationException("a text whose foreground is not a solid colour");
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// WCAG 2.1 contrast arithmetic for the App's colour checks (<c>08_UI</c> §Contrast): a theme key resolved to a colour,
|
||||
/// source-over compositing of a translucent colour on an opaque one, and the contrast ratio. Shared by
|
||||
/// <see cref="ContrastTests"/> and the rendered checks since beta.14.
|
||||
/// </summary>
|
||||
internal static class Wcag
|
||||
{
|
||||
/// <summary>WCAG AA for body text.</summary>
|
||||
public const double AA = 4.5;
|
||||
|
||||
public static Color Resolve(ResourceDictionary themed, string key)
|
||||
{
|
||||
object value = themed[key] ?? System.Windows.Application.Current.Resources[key] ?? throw new InvalidOperationException($"{key} is in neither the theme nor the merged dictionaries");
|
||||
return value switch
|
||||
{
|
||||
Color c => c,
|
||||
SolidColorBrush b => b.Color,
|
||||
_ => throw new InvalidOperationException($"{key} is not a Color or SolidColorBrush in the theme dictionary (got {value.GetType().Name})"),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Source-over compositing of <paramref name="top"/> on an opaque <paramref name="under"/>.</summary>
|
||||
public static Color Over(Color top, Color under)
|
||||
{
|
||||
double a = top.A / 255.0;
|
||||
return Color.FromRgb(
|
||||
(byte)Math.Round(top.R * a + under.R * (1 - a)),
|
||||
(byte)Math.Round(top.G * a + under.G * (1 - a)),
|
||||
(byte)Math.Round(top.B * a + under.B * (1 - a)));
|
||||
}
|
||||
|
||||
/// <summary>WCAG 2.1 contrast ratio between two opaque colours.</summary>
|
||||
public static double Ratio(Color a, Color b)
|
||||
{
|
||||
double la = Luminance(a);
|
||||
double lb = Luminance(b);
|
||||
return (Math.Max(la, lb) + 0.05) / (Math.Min(la, lb) + 0.05);
|
||||
}
|
||||
|
||||
private static double Luminance(Color c)
|
||||
{
|
||||
static double Channel(byte v)
|
||||
{
|
||||
double s = v / 255.0;
|
||||
return s <= 0.03928 ? s / 12.92 : Math.Pow((s + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
|
||||
return (0.2126 * Channel(c.R)) + (0.7152 * Channel(c.G)) + (0.0722 * Channel(c.B));
|
||||
}
|
||||
}
|
||||
@@ -353,6 +353,23 @@ public sealed class CaptureSessionTests : IAsyncDisposable
|
||||
tolerance: tolerance,
|
||||
display: display);
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="Loop"/>'s options with a 30 s ceiling instead of 120 ms, for a test whose session must end on something
|
||||
/// else — a refusal at the re-scan, a guard that throws, the kill switch, an exit. A wall-clock ceiling that short lost
|
||||
/// the race to the second scan on a loaded runner and the session ended as <c>Running</c> (the beta.13 release rehearsal,
|
||||
/// 2026-10-04, <see cref="AGuardThatThrowsMidSessionKeepsTheRecordsItAlreadyDrained"/>); here the ceiling is a safety
|
||||
/// net, never the ending under test.
|
||||
/// </summary>
|
||||
private static CaptureOptions EndsOnItsOwn => new()
|
||||
{
|
||||
DrainInterval = TimeSpan.FromMilliseconds(1),
|
||||
ScanInterval = TimeSpan.FromMilliseconds(5),
|
||||
AttachBudget = TimeSpan.FromMilliseconds(50),
|
||||
MaxDuration = TimeSpan.FromSeconds(30),
|
||||
HoldInterval = TimeSpan.FromMilliseconds(1),
|
||||
LogFlushGrace = TimeSpan.FromMilliseconds(1),
|
||||
};
|
||||
|
||||
private static readonly bool[] _pauseThenResume = [true, false];
|
||||
|
||||
private sealed class SwitchablePause : ICapturePauseSource
|
||||
@@ -803,7 +820,7 @@ public sealed class CaptureSessionTests : IAsyncDisposable
|
||||
};
|
||||
using var sink = new FakeSink();
|
||||
IGameConsentStore store = await StoreWithAsync();
|
||||
CaptureSession loop = Loop(store, guard, sink);
|
||||
CaptureSession loop = Loop(store, guard, sink, options: EndsOnItsOwn);
|
||||
|
||||
CaptureOutcome r = await loop.RunAsync(_exe, Fingerprint, "payload.dll", TestContext.Current.CancellationToken);
|
||||
|
||||
@@ -850,7 +867,7 @@ public sealed class CaptureSessionTests : IAsyncDisposable
|
||||
var guard = new CountingGuard();
|
||||
using var sink = new FakeSink();
|
||||
using var alive = new FakeLiveness { HasExited = true };
|
||||
CaptureSession loop = Loop(await StoreWithAsync(), guard, sink, alive);
|
||||
CaptureSession loop = Loop(await StoreWithAsync(), guard, sink, alive, options: EndsOnItsOwn);
|
||||
|
||||
CaptureOutcome r = await loop.RunAsync(_exe, Fingerprint, "payload.dll", TestContext.Current.CancellationToken);
|
||||
|
||||
@@ -1011,7 +1028,7 @@ public sealed class CaptureSessionTests : IAsyncDisposable
|
||||
// the capture side and is correct; losing the whole session's records with the stack is not.
|
||||
var guard = new CountingGuard();
|
||||
using var sink = new FakeSink(recordsToServe: 40);
|
||||
CaptureSession loop = Loop(await StoreWithAsync(), guard, sink);
|
||||
CaptureSession loop = Loop(await StoreWithAsync(), guard, sink, options: EndsOnItsOwn);
|
||||
guard.EvaluateThrowsAfter = 1;
|
||||
|
||||
CaptureOutcome r = await loop.RunAsync(_exe, Fingerprint, "payload.dll", TestContext.Current.CancellationToken);
|
||||
@@ -1041,7 +1058,7 @@ public sealed class CaptureSessionTests : IAsyncDisposable
|
||||
var flipsAfterTwo = new DelegateKillSwitch(() => ++asks > 2);
|
||||
using var sink = new FakeSink(recordsToServe: 3);
|
||||
var stopped = new CountingGuard();
|
||||
CaptureOutcome result = await Loop(await StoreWithAsync(), stopped, sink, killSwitch: flipsAfterTwo)
|
||||
CaptureOutcome result = await Loop(await StoreWithAsync(), stopped, sink, options: EndsOnItsOwn, killSwitch: flipsAfterTwo)
|
||||
.RunAsync(_exe, Fingerprint, "payload.dll", TestContext.Current.CancellationToken);
|
||||
|
||||
result.Reason.Should().Be(SessionEndReason.KillSwitchEngaged);
|
||||
|
||||
@@ -24,6 +24,29 @@ public sealed class SettingsRegistryTests
|
||||
}
|
||||
|
||||
/// <summary>D33: the exception option is off unless the user turns it on — and exactly "1" is on.</summary>
|
||||
[Fact]
|
||||
public void TheUpdateChannelFollowsTheRunningCopyUnlessTheUserChose()
|
||||
{
|
||||
// D47 (beta.14): stable by default found no release while every release is a pre-release.
|
||||
SettingDefinition d = SettingsRegistry.UpdateChannel;
|
||||
d.Default.Should().Be("auto");
|
||||
d.Choices.Should().Equal("auto", "stable", "beta");
|
||||
d.Validate("stable").Should().BeNull("a choice stored before beta.14 stays valid");
|
||||
d.AgentReads.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HidingScrollBarsIsOffByDefaultAndTheAgentNeverReadsIt()
|
||||
{
|
||||
// beta.14: ui.hide_scrollbars is the App's alone; the bars are what every page showed until then.
|
||||
SettingDefinition d = SettingsRegistry.UiHideScrollBars;
|
||||
d.Key.Should().Be("ui.hide_scrollbars");
|
||||
d.Kind.Should().Be(SettingKind.Boolean);
|
||||
d.Default.Should().Be("0");
|
||||
d.AgentReads.Should().BeFalse();
|
||||
SettingsRegistry.Find("ui.hide_scrollbars").Should().BeSameAs(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheUserModeExceptionOptionIsOffByDefault()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user