From 6837e14bde68b744d224929874e17aa7896e3b9f Mon Sep 17 00:00:00 2001 From: Peterson Fernandes Date: Fri, 13 Nov 2026 00:18:15 -0300 Subject: [PATCH 1/2] chore: move the app to .NET 11 and Avalonia 12.1.6 Retarget the app and tests to net11.0/net11.0-windows, build the five libraries for net11.0 as well, bump Avalonia to 12.1.6, SharpCompress to 0.50.9 and the analyzers to 3.0.339, and update the CI, release, docs and version tables to match. --- .github/workflows/ci.yml | 6 +-- .github/workflows/codeql.yml | 2 +- .github/workflows/release.yml | 18 ++++---- AGENTS.md | 61 ++++++++++++++++---------- CCDSharp/CCDSharp.csproj | 6 +-- CCDSharp/README.md | 8 ++-- CHDStudio.Tests/CHDStudio.Tests.csproj | 7 +-- CHDStudio/CHDStudio.csproj | 29 ++++++++---- CHDStudio/Services/BugReportService.cs | 3 -- CHDStudio/Services/StatsService.cs | 4 -- CSOSharp/CSOSharp.csproj | 6 +-- CSOSharp/README.md | 8 ++-- ISZSharp/ISZSharp.csproj | 8 ++-- ISZSharp/README.md | 6 +-- MDSSharp/MDSSharp.csproj | 6 +-- MDSSharp/README.md | 6 +-- PBPSharp/PBPSharp.csproj | 6 +-- PBPSharp/README.md | 8 ++-- ReadMe.md | 6 +-- docs/02-getting-started.md | 18 ++++---- docs/03-architecture.md | 14 +++--- docs/08-utilities-reference.md | 4 +- docs/10-libraries.md | 2 +- docs/11-testing.md | 4 +- docs/14-release-and-deployment.md | 24 +++++----- docs/index.md | 4 +- global.json | 2 +- 27 files changed, 147 insertions(+), 129 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0c27db..20bef43 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: - name: Set up .NET uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6 with: - dotnet-version: 10.0.x + dotnet-version: 11.0.x - name: Set up Node 24 uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 @@ -76,10 +76,10 @@ jobs: - name: Set up .NET uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6 with: - dotnet-version: 10.0.x + dotnet-version: 11.0.x - name: Restore run: dotnet restore CHDStudio/CHDStudio.csproj - name: Build neutral TFM - run: dotnet build CHDStudio/CHDStudio.csproj -c Release -f net10.0 --no-restore + run: dotnet build CHDStudio/CHDStudio.csproj -c Release -f net11.0 --no-restore diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3c0c39d..cbdfb3d 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -37,7 +37,7 @@ jobs: - name: Set up .NET uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6 with: - dotnet-version: 10.0.x + dotnet-version: 11.0.x - name: Initialize CodeQL uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 20b3a7d..3c6b56c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ # Artifacts: one release__.zip per runtime identifier, for # Windows (win-x64, win-arm64), Linux (linux-x64, linux-arm64) and macOS # (osx-x64, osx-arm64). The app is framework-dependent (users install the -# .NET 10 Desktop Runtime on Windows, the .NET 10 runtime on Linux/macOS) +# .NET 11 Desktop Runtime on Windows, the .NET 11 runtime on Linux/macOS) # and published as a single file; see scripts/ci/package-release.ps1. name: Release @@ -77,7 +77,7 @@ jobs: - name: Set up .NET uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6 with: - dotnet-version: 10.0.x + dotnet-version: 11.0.x - name: Restore run: dotnet restore CSharp_CHDStudio.sln @@ -102,17 +102,17 @@ jobs: matrix: include: - rid: win-x64 - tfm: net10.0-windows + tfm: net11.0-windows - rid: win-arm64 - tfm: net10.0-windows + tfm: net11.0-windows - rid: linux-x64 - tfm: net10.0 + tfm: net11.0 - rid: linux-arm64 - tfm: net10.0 + tfm: net11.0 - rid: osx-x64 - tfm: net10.0 + tfm: net11.0 - rid: osx-arm64 - tfm: net10.0 + tfm: net11.0 steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 @@ -122,7 +122,7 @@ jobs: - name: Set up .NET uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6 with: - dotnet-version: 10.0.x + dotnet-version: 11.0.x - name: Publish single-file (framework-dependent) run: > diff --git a/AGENTS.md b/AGENTS.md index 2e14504..b63b9df 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,7 +15,7 @@ project. ### The application project - `CHDStudio` is the base app project: it multi-targets - `net10.0` (Linux/macOS) and `net10.0-windows` (Windows), builds + `net11.0` (Linux/macOS) and `net11.0-windows` (Windows), builds `CHDStudio.exe`, and links no files from outside its folder. The Windows TFM adds NAudio (Media Foundation/ACM MP3 decoding); the neutral TFM decodes MP3 via `ffmpeg` on PATH. @@ -34,9 +34,9 @@ project. ## Toolchain -- .NET SDK 10 - declared in `global.json` (`rollForward: latestMajor`). Never - lower the Windows target below `net10.0-windows`; the Windows UI and NAudio - need it. +- .NET SDK 11 - declared in `global.json` (`rollForward: latestMajor`). C# 15 is + enabled through `LangVersion`. Never lower the Windows target below + `net11.0-windows`; the Windows UI and NAudio need it. - Node.js 24 - used only for the zero-dependency helper scripts in `scripts/ci/`. Do not add npm packages or a `package.json`. - Avalonia 12.1 (desktop, Fluent theme, DataGrid); the neutral TFM must keep @@ -55,24 +55,35 @@ dotnet test CHDStudio.Tests/CHDStudio.Tests.csproj -c Release dotnet test CHDStudio.Tests/CHDStudio.Tests.csproj -c Release --filter "Category!=Integration" # Framework-dependent single-file publish (one per architecture) -dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0-windows -r win-x64 --self-contained false -p:PublishSingleFile=true -o publish/win-x64 -dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0-windows -r win-arm64 --self-contained false -p:PublishSingleFile=true -o publish/win-arm64 +dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net11.0-windows -r win-x64 --self-contained false -p:PublishSingleFile=true -o publish/win-x64 +dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net11.0-windows -r win-arm64 --self-contained false -p:PublishSingleFile=true -o publish/win-arm64 # Release zip (same command CI runs) ./scripts/ci/package-release.ps1 -Rid win-x64 -Version 3.7.0 -PublishDir publish/win-x64 -OutputDir dist # Run on Windows (multi-targeted, so pick the Windows TFM) -dotnet run --project CHDStudio/CHDStudio.csproj -f net10.0-windows +dotnet run --project CHDStudio/CHDStudio.csproj -f net11.0-windows # Framework-dependent single-file publishes for Linux/macOS (neutral TFM) -dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0 -r linux-x64 --self-contained false -p:PublishSingleFile=true -o publish/linux-x64 -dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0 -r osx-arm64 --self-contained false -p:PublishSingleFile=true -o publish/osx-arm64 +dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net11.0 -r linux-x64 --self-contained false -p:PublishSingleFile=true -o publish/linux-x64 +dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net11.0 -r osx-arm64 --self-contained false -p:PublishSingleFile=true -o publish/osx-arm64 ``` +## Pre-commit checks + +**Always run `jb inspectcode` before every commit.** Fix every warning and error +it reports; notes are allowed: + +```powershell +jb inspectcode --output=InspectCode.log CSharp_CHDStudio.sln +``` + +Do not commit while InspectCode reports warnings or errors. + ## Release engineering (do not break) - **The app is framework-dependent. It must NOT embed the .NET runtime.** Users - install the .NET 10 Desktop Runtime on Windows and the .NET 10 runtime on + install the .NET 11 Desktop Runtime on Windows and the .NET 11 runtime on Linux/macOS. Always publish with `--self-contained false -p:PublishSingleFile=true`. The output is a single `CHDStudio.exe` (Windows) or `CHDStudio` (Linux/macOS) plus the platform's @@ -85,7 +96,9 @@ dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0 -r osx-arm64 --s library `.xml` IntelliSense files and the native `.pdb` debug symbols (never used at runtime), and adds `LICENSE.txt`, `ReadMe.md` and `WhatsNew.md`. Do not put both architectures in one zip. CHD creation works without any bundled - tool thanks to the built-in CHDSharp encoder. + tool thanks to the built-in CHDSharp encoder. Every bundled-tool item keeps + `ExcludeFromSingleFile=true`; without it the .NET 11 single-file publish drops + `7za`/`chdman`/`7zz` from the output and the release zip fails verification. - **Zip naming is fixed:** `release__.zip`, e.g. `release_3.9.0_win-x64.zip`. One zip per runtime identifier - `win-x64`, `win-arm64`, `linux-x64`, `linux-arm64`, `osx-x64` and `osx-arm64` - and all @@ -120,7 +133,7 @@ dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0 -r osx-arm64 --s dotnet build CSharp_CHDStudio.sln -c Release dotnet test CHDStudio.Tests/CHDStudio.Tests.csproj -c Release node scripts/ci/version.mjs - jb inspectcode CSharp_CHDStudio.sln -o=InspectCode.log + jb inspectcode --output=InspectCode.log CSharp_CHDStudio.sln ``` InspectCode must report zero warnings and zero errors before tagging. 4. **Publish all six framework-dependent single-file bundles**, never @@ -130,12 +143,12 @@ dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0 -r osx-arm64 --s $ErrorActionPreference = 'Stop' $version = "3.11.0" $rids = [ordered]@{ - 'win-x64' = 'net10.0-windows' - 'win-arm64' = 'net10.0-windows' - 'linux-x64' = 'net10.0' - 'linux-arm64' = 'net10.0' - 'osx-x64' = 'net10.0' - 'osx-arm64' = 'net10.0' + 'win-x64' = 'net11.0-windows' + 'win-arm64' = 'net11.0-windows' + 'linux-x64' = 'net11.0' + 'linux-arm64' = 'net11.0' + 'osx-x64' = 'net11.0' + 'osx-arm64' = 'net11.0' } $outRoot = "dist/$version" New-Item -ItemType Directory -Force -Path $outRoot | Out-Null @@ -224,8 +237,8 @@ dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0 -r osx-arm64 --s - `docs/` is the only documentation source. Keep the Pages front matter and the wiki `_Sidebar.md` in sync; never edit the wiki UI. - `CHDStudio/bin/Release/` is append-only. Copy in, never delete. -- Run `jb inspectcode` before tagging; the release gate is zero warnings and - zero errors (notes are allowed). +- Run `jb inspectcode` before every commit and before tagging; the gate is zero + warnings and zero errors (notes are allowed). - Run the full test suite before tagging; CI runs the unit filter only. @@ -245,8 +258,8 @@ workflows, and never commit or echo the API key. It is read from the `MDSSharp/MDSSharp.csproj` and `ISZSharp/ISZSharp.csproj`): bump ``, `` and `` together. A pushed version is immutable - to change anything, bump and push again. -- **Target frameworks** are `net8.0;net9.0;net10.0` so both packages serve - .NET 8, 9 and 10 consumers. `GenerateDocumentationFile` must stay on so each +- **Target frameworks** are `net8.0;net9.0;net10.0;net11.0` so the packages serve + .NET 8, 9, 10 and 11 consumers. `GenerateDocumentationFile` must stay on so each TFM ships its `.xml` next to the assembly. - **Metadata** must keep `PackageProjectUrl` and `RepositoryUrl` pointed at . @@ -276,7 +289,7 @@ dotnet test CHDStudio.Tests/CHDStudio.Tests.csproj -c Release --filter "FullyQua dotnet pack PBPSharp/PBPSharp.csproj -c Release -o -p:EnablePackageValidation=true # 3. inspect the nupkg: README.md, icon.png, and lib//.dll + .xml -# for net8.0, net9.0 and net10.0 +# for net8.0, net9.0, net10.0 and net11.0 # 4. push with the user environment key (never hard-code it) dotnet nuget push /PBPSharp..nupkg --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json @@ -286,7 +299,7 @@ Invoke-RestMethod https://api.nuget.org/v3-flatcontainer/pbpsharp/index.json # ``` Before pushing, smoke-test the packed `.nupkg` in a throwaway consumer project -targeting `net8.0;net9.0;net10.0` (restore from a local package source and open +targeting `net8.0;net9.0;net10.0;net11.0` (restore from a local package source and open a real file on each runtime). ## CI workflows diff --git a/CCDSharp/CCDSharp.csproj b/CCDSharp/CCDSharp.csproj index 7933c01..9fc550a 100644 --- a/CCDSharp/CCDSharp.csproj +++ b/CCDSharp/CCDSharp.csproj @@ -1,9 +1,9 @@ - net8.0;net9.0;net10.0 + net8.0;net9.0;net10.0;net11.0 enable enable - latest + 15.0 en PureLogicCode.com 1.0.3 @@ -39,7 +39,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/CCDSharp/README.md b/CCDSharp/README.md index 6f89d19..090ba7f 100644 --- a/CCDSharp/README.md +++ b/CCDSharp/README.md @@ -5,7 +5,7 @@ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/purelogiccode/CHDStudio/badge)](https://securityscorecards.dev/viewer/?uri=github.com/purelogiccode/CHDStudio) [![Security Policy](https://img.shields.io/badge/Security-Policy-blue.svg)](https://github.com/purelogiccode/CHDStudio/blob/master/SECURITY.md) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/purelogiccode/CHDStudio) -[![.NET 8 | 9 | 10](https://img.shields.io/badge/.NET-8.0%20%7C%209.0%20%7C%2010.0-512bd4.svg)](https://dotnet.microsoft.com/download) +[![.NET 8 | 9 | 10 | 11](https://img.shields.io/badge/.NET-8.0%20%7C%209.0%20%7C%2010.0%20%7C%2011.0-512bd4.svg)](https://dotnet.microsoft.com/download) [![Platform: Windows | Linux | macOS](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-0078d7.svg)](https://github.com/purelogiccode/CHDStudio) [![GitHub last commit](https://img.shields.io/github/last-commit/purelogiccode/CHDStudio)](https://github.com/purelogiccode/CHDStudio/commits/master) [![GitHub stars](https://img.shields.io/github/stars/purelogiccode/CHDStudio.svg)](https://github.com/purelogiccode/CHDStudio/stargazers) @@ -28,7 +28,7 @@ [![Release downloads](https://img.shields.io/github/downloads/purelogiccode/CHDStudio/total?label=release%20downloads)](https://github.com/purelogiccode/CHDStudio/releases) [![Release date](https://img.shields.io/github/release-date/purelogiccode/CHDStudio?label=released)](https://github.com/purelogiccode/CHDStudio/releases) [![C#](https://img.shields.io/badge/C%23-100%25-239120?logo=csharp&logoColor=white)](https://learn.microsoft.com/dotnet/csharp/) -[![NuGet TFMs](https://img.shields.io/badge/NuGet-net8.0%20%7C%20net9.0%20%7C%20net10.0-004880?logo=nuget&logoColor=white)](https://www.nuget.org/packages/CCDSharp) +[![NuGet TFMs](https://img.shields.io/badge/NuGet-net8.0%20%7C%20net9.0%20%7C%20net10.0%20%7C%20net11.0-004880?logo=nuget&logoColor=white)](https://www.nuget.org/packages/CCDSharp) [![Format](https://img.shields.io/badge/format-CloneCD%20%2F%20CCD%20%2F%20IMG%20%2F%20SUB-6f42c1)](https://www.nuget.org/packages/CCDSharp) [![Output](https://img.shields.io/badge/output-ISO%20%2B%20CUE%2FBIN-0b7285)](https://www.nuget.org/packages/CCDSharp) @@ -83,8 +83,8 @@ The library is the CloneCD conversion engine used by [CHD Studio](https://github | Requirement | Value | |---|---| -| Target frameworks | `net8.0`, `net9.0`, `net10.0` | -| Runtime | .NET 8, .NET 9 or .NET 10 | +| Target frameworks | `net8.0`, `net9.0`, `net10.0`, `net11.0` | +| Runtime | .NET 8, .NET 9, .NET 10 or .NET 11 | | Platforms | Windows, Linux, macOS (pure managed code) | | Dependencies | None | diff --git a/CHDStudio.Tests/CHDStudio.Tests.csproj b/CHDStudio.Tests/CHDStudio.Tests.csproj index b4c7dd4..64cbef8 100644 --- a/CHDStudio.Tests/CHDStudio.Tests.csproj +++ b/CHDStudio.Tests/CHDStudio.Tests.csproj @@ -1,6 +1,7 @@ - net10.0-windows + net11.0-windows + 15.0 enable enable false @@ -15,11 +16,11 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/CHDStudio/CHDStudio.csproj b/CHDStudio/CHDStudio.csproj index 87665a3..c9d3d6a 100644 --- a/CHDStudio/CHDStudio.csproj +++ b/CHDStudio/CHDStudio.csproj @@ -1,9 +1,10 @@ WinExe - - net10.0;net10.0-windows + net11.0;net11.0-windows + 15.0 true enable enable @@ -32,13 +33,13 @@ - - - - + + + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -49,22 +50,26 @@ - + - + Always + true Always + true Always + true Always + true @@ -75,30 +80,36 @@ 7zz Always + true 7-Zip-License.txt Always + true 7zz Always + true 7-Zip-License.txt Always + true 7zz Always + true 7-Zip-License.txt Always + true diff --git a/CHDStudio/Services/BugReportService.cs b/CHDStudio/Services/BugReportService.cs index 31fa824..449131f 100644 --- a/CHDStudio/Services/BugReportService.cs +++ b/CHDStudio/Services/BugReportService.cs @@ -1,7 +1,4 @@ using System.Globalization; -// ReSharper disable once RedundantUsingDirective -using System.Net.Http; -using System.Net.Http.Json; using System.Reflection; using System.Runtime.InteropServices; using System.Text; diff --git a/CHDStudio/Services/StatsService.cs b/CHDStudio/Services/StatsService.cs index d6429fc..b69ae4f 100644 --- a/CHDStudio/Services/StatsService.cs +++ b/CHDStudio/Services/StatsService.cs @@ -1,7 +1,3 @@ -// ReSharper disable once RedundantUsingDirective - -using System.Net.Http; -using System.Net.Http.Json; using System.Reflection; using Serilog; diff --git a/CSOSharp/CSOSharp.csproj b/CSOSharp/CSOSharp.csproj index 2b6d932..952a45b 100644 --- a/CSOSharp/CSOSharp.csproj +++ b/CSOSharp/CSOSharp.csproj @@ -1,9 +1,9 @@ - net8.0;net9.0;net10.0 + net8.0;net9.0;net10.0;net11.0 enable enable - latest + 15.0 en PureLogicCode.com 1.0.2 @@ -37,7 +37,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/CSOSharp/README.md b/CSOSharp/README.md index d97ee4f..d8736c8 100644 --- a/CSOSharp/README.md +++ b/CSOSharp/README.md @@ -5,7 +5,7 @@ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/purelogiccode/CHDStudio/badge)](https://securityscorecards.dev/viewer/?uri=github.com/purelogiccode/CHDStudio) [![Security Policy](https://img.shields.io/badge/Security-Policy-blue.svg)](https://github.com/purelogiccode/CHDStudio/blob/master/SECURITY.md) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/purelogiccode/CHDStudio) -[![.NET 8 | 9 | 10](https://img.shields.io/badge/.NET-8.0%20%7C%209.0%20%7C%2010.0-512bd4.svg)](https://dotnet.microsoft.com/download) +[![.NET 8 | 9 | 10 | 11](https://img.shields.io/badge/.NET-8.0%20%7C%209.0%20%7C%2010.0%20%7C%2011.0-512bd4.svg)](https://dotnet.microsoft.com/download) [![Platform: Windows | Linux | macOS](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-0078d7.svg)](https://github.com/purelogiccode/CHDStudio) [![GitHub last commit](https://img.shields.io/github/last-commit/purelogiccode/CHDStudio)](https://github.com/purelogiccode/CHDStudio/commits/master) [![GitHub stars](https://img.shields.io/github/stars/purelogiccode/CHDStudio.svg)](https://github.com/purelogiccode/CHDStudio/stargazers) @@ -28,7 +28,7 @@ [![Release downloads](https://img.shields.io/github/downloads/purelogiccode/CHDStudio/total?label=release%20downloads)](https://github.com/purelogiccode/CHDStudio/releases) [![Release date](https://img.shields.io/github/release-date/purelogiccode/CHDStudio?label=released)](https://github.com/purelogiccode/CHDStudio/releases) [![C#](https://img.shields.io/badge/C%23-100%25-239120?logo=csharp&logoColor=white)](https://learn.microsoft.com/dotnet/csharp/) -[![NuGet TFMs](https://img.shields.io/badge/NuGet-net8.0%20%7C%20net9.0%20%7C%20net10.0-004880?logo=nuget&logoColor=white)](https://www.nuget.org/packages/CSOSharp) +[![NuGet TFMs](https://img.shields.io/badge/NuGet-net8.0%20%7C%20net9.0%20%7C%20net10.0%20%7C%20net11.0-004880?logo=nuget&logoColor=white)](https://www.nuget.org/packages/CSOSharp) [![Format](https://img.shields.io/badge/format-CSO%20%2F%20CISO%20%2F%20ZSO-6f42c1)](https://www.nuget.org/packages/CSOSharp) [![Compression](https://img.shields.io/badge/compression-deflate%20%2B%20LZ4-0b7285)](https://www.nuget.org/packages/CSOSharp) @@ -79,8 +79,8 @@ The library is the CSO extraction engine used by [CHD Studio](https://github.com | Requirement | Value | |---|---| -| Target frameworks | `net8.0`, `net9.0`, `net10.0` | -| Runtime | .NET 8, .NET 9 or .NET 10 | +| Target frameworks | `net8.0`, `net9.0`, `net10.0`, `net11.0` | +| Runtime | .NET 8, .NET 9, .NET 10 or .NET 11 | | Platforms | Windows, Linux, macOS (pure managed code) | | Dependencies | [K4os.Compression.LZ4](https://www.nuget.org/packages/K4os.Compression.LZ4) 1.3.8 | diff --git a/ISZSharp/ISZSharp.csproj b/ISZSharp/ISZSharp.csproj index 0ee1449..8039f22 100644 --- a/ISZSharp/ISZSharp.csproj +++ b/ISZSharp/ISZSharp.csproj @@ -1,9 +1,9 @@ - net8.0;net9.0;net10.0 + net8.0;net9.0;net10.0;net11.0 enable enable - latest + 15.0 en PureLogicCode.com 1.0.3 @@ -36,8 +36,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/ISZSharp/README.md b/ISZSharp/README.md index 8d3477f..97a75b0 100644 --- a/ISZSharp/README.md +++ b/ISZSharp/README.md @@ -5,7 +5,7 @@ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/purelogiccode/CHDStudio/badge)](https://securityscorecards.dev/viewer/?uri=github.com/purelogiccode/CHDStudio) [![Security Policy](https://img.shields.io/badge/Security-Policy-blue.svg)](https://github.com/purelogiccode/CHDStudio/blob/master/SECURITY.md) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/purelogiccode/CHDStudio) -[![.NET 8 | 9 | 10](https://img.shields.io/badge/.NET-8.0%20%7C%209.0%20%7C%2010.0-512bd4.svg)](https://dotnet.microsoft.com/download) +[![.NET 8 | 9 | 10 | 11](https://img.shields.io/badge/.NET-8.0%20%7C%209.0%20%7C%2010.0%20%7C%2011.0-512bd4.svg)](https://dotnet.microsoft.com/download) [![Platform: Windows | Linux | macOS](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-0078d7.svg)](https://github.com/purelogiccode/CHDStudio) [![GitHub last commit](https://img.shields.io/github/last-commit/purelogiccode/CHDStudio)](https://github.com/purelogiccode/CHDStudio/commits/master) [![GitHub stars](https://img.shields.io/github/stars/purelogiccode/CHDStudio.svg)](https://github.com/purelogiccode/CHDStudio/stargazers) @@ -85,8 +85,8 @@ plain image before converting it to CHD with `chdman` or [CHDSharp](https://www. | Requirement | Value | |---|---| -| Target frameworks | `net8.0`, `net9.0`, `net10.0` | -| Runtime | .NET 8, .NET 9 or .NET 10 | +| Target frameworks | `net8.0`, `net9.0`, `net10.0`, `net11.0` | +| Runtime | .NET 8, .NET 9, .NET 10 or .NET 11 | | Platforms | Windows, Linux, macOS (pure managed code) | | Dependencies | [SharpCompress](https://www.nuget.org/packages/SharpCompress) 0.50.8 (bzip2) | diff --git a/MDSSharp/MDSSharp.csproj b/MDSSharp/MDSSharp.csproj index ee183f5..7dc1559 100644 --- a/MDSSharp/MDSSharp.csproj +++ b/MDSSharp/MDSSharp.csproj @@ -1,9 +1,9 @@ - net8.0;net9.0;net10.0 + net8.0;net9.0;net10.0;net11.0 enable enable - latest + 15.0 en PureLogicCode.com 1.2.3 @@ -36,7 +36,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/MDSSharp/README.md b/MDSSharp/README.md index 7b05749..3679c57 100644 --- a/MDSSharp/README.md +++ b/MDSSharp/README.md @@ -5,7 +5,7 @@ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/purelogiccode/CHDStudio/badge)](https://securityscorecards.dev/viewer/?uri=github.com/purelogiccode/CHDStudio) [![Security Policy](https://img.shields.io/badge/Security-Policy-blue.svg)](https://github.com/purelogiccode/CHDStudio/blob/master/SECURITY.md) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/purelogiccode/CHDStudio) -[![.NET 8 | 9 | 10](https://img.shields.io/badge/.NET-8.0%20%7C%209.0%20%7C%2010.0-512bd4.svg)](https://dotnet.microsoft.com/download) +[![.NET 8 | 9 | 10 | 11](https://img.shields.io/badge/.NET-8.0%20%7C%209.0%20%7C%2010.0%20%7C%2011.0-512bd4.svg)](https://dotnet.microsoft.com/download) [![Platform: Windows | Linux | macOS](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-0078d7.svg)](https://github.com/purelogiccode/CHDStudio) [![GitHub last commit](https://img.shields.io/github/last-commit/purelogiccode/CHDStudio)](https://github.com/purelogiccode/CHDStudio/commits/master) [![GitHub stars](https://img.shields.io/github/stars/purelogiccode/CHDStudio.svg)](https://github.com/purelogiccode/CHDStudio/stargazers) @@ -74,8 +74,8 @@ The library is the Alcohol 120% conversion engine used by [CHD Studio](https://g | Requirement | Value | |---|---| -| Target frameworks | `net8.0`, `net9.0`, `net10.0` | -| Runtime | .NET 8, .NET 9 or .NET 10 | +| Target frameworks | `net8.0`, `net9.0`, `net10.0`, `net11.0` | +| Runtime | .NET 8, .NET 9, .NET 10 or .NET 11 | | Platforms | Windows, Linux, macOS (pure managed code) | | Dependencies | None | diff --git a/PBPSharp/PBPSharp.csproj b/PBPSharp/PBPSharp.csproj index 84ffec3..a1701e8 100644 --- a/PBPSharp/PBPSharp.csproj +++ b/PBPSharp/PBPSharp.csproj @@ -1,9 +1,9 @@ - net8.0;net9.0;net10.0 + net8.0;net9.0;net10.0;net11.0 enable enable - latest + 15.0 en PureLogicCode.com 1.1.8 @@ -46,7 +46,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/PBPSharp/README.md b/PBPSharp/README.md index 53873de..d157a68 100644 --- a/PBPSharp/README.md +++ b/PBPSharp/README.md @@ -5,7 +5,7 @@ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/purelogiccode/CHDStudio/badge)](https://securityscorecards.dev/viewer/?uri=github.com/purelogiccode/CHDStudio) [![Security Policy](https://img.shields.io/badge/Security-Policy-blue.svg)](https://github.com/purelogiccode/CHDStudio/blob/master/SECURITY.md) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/purelogiccode/CHDStudio) -[![.NET 8 | 9 | 10](https://img.shields.io/badge/.NET-8.0%20%7C%209.0%20%7C%2010.0-512bd4.svg)](https://dotnet.microsoft.com/download) +[![.NET 8 | 9 | 10 | 11](https://img.shields.io/badge/.NET-8.0%20%7C%209.0%20%7C%2010.0%20%7C%2011.0-512bd4.svg)](https://dotnet.microsoft.com/download) [![Platform: Windows | Linux | macOS](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-0078d7.svg)](https://github.com/purelogiccode/CHDStudio) [![GitHub last commit](https://img.shields.io/github/last-commit/purelogiccode/CHDStudio)](https://github.com/purelogiccode/CHDStudio/commits/master) [![GitHub stars](https://img.shields.io/github/stars/purelogiccode/CHDStudio.svg)](https://github.com/purelogiccode/CHDStudio/stargazers) @@ -28,7 +28,7 @@ [![Release downloads](https://img.shields.io/github/downloads/purelogiccode/CHDStudio/total?label=release%20downloads)](https://github.com/purelogiccode/CHDStudio/releases) [![Release date](https://img.shields.io/github/release-date/purelogiccode/CHDStudio?label=released)](https://github.com/purelogiccode/CHDStudio/releases) [![C#](https://img.shields.io/badge/C%23-100%25-239120?logo=csharp&logoColor=white)](https://learn.microsoft.com/dotnet/csharp/) -[![NuGet TFMs](https://img.shields.io/badge/NuGet-net8.0%20%7C%20net9.0%20%7C%20net10.0-004880?logo=nuget&logoColor=white)](https://www.nuget.org/packages/PBPSharp) +[![NuGet TFMs](https://img.shields.io/badge/NuGet-net8.0%20%7C%20net9.0%20%7C%20net10.0%20%7C%20net11.0-004880?logo=nuget&logoColor=white)](https://www.nuget.org/packages/PBPSharp) [![Format](https://img.shields.io/badge/format-PBP%20%2F%20EBOOT-6f42c1)](https://www.nuget.org/packages/PBPSharp) [![Disc](https://img.shields.io/badge/disc-PlayStation%201%20%2F%20PSP-003791)](https://www.nuget.org/packages/PBPSharp) @@ -84,8 +84,8 @@ The library is the PBP extraction engine used by [CHD Studio](https://github.com | Requirement | Value | |---|---| -| Target frameworks | `net8.0`, `net9.0`, `net10.0` | -| Runtime | .NET 8, .NET 9 or .NET 10 | +| Target frameworks | `net8.0`, `net9.0`, `net10.0`, `net11.0` | +| Runtime | .NET 8, .NET 9, .NET 10 or .NET 11 | | Platforms | Windows, Linux, macOS (pure managed code) | | Dependencies | [SharpZipLib](https://www.nuget.org/packages/SharpZipLib) 1.4.2 | diff --git a/ReadMe.md b/ReadMe.md index 1587762..7432b9f 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,5 +1,5 @@ [![Platform: Windows | Linux | macOS](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-0078d7.svg)](https://github.com/purelogiccode/CHDStudio) -[![.NET 10.0](https://img.shields.io/badge/.NET-10.0-512bd4.svg)](https://dotnet.microsoft.com/download/dotnet/10.0) +[![.NET 11.0](https://img.shields.io/badge/.NET-11.0-512bd4.svg)](https://dotnet.microsoft.com/download/dotnet/11.0) [![CI](https://img.shields.io/github/actions/workflow/status/purelogiccode/CHDStudio/ci.yml?label=CI)](https://github.com/purelogiccode/CHDStudio/actions/workflows/ci.yml) [![CodeQL](https://github.com/purelogiccode/CHDStudio/actions/workflows/codeql.yml/badge.svg)](https://github.com/purelogiccode/CHDStudio/actions/workflows/codeql.yml) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/purelogiccode/CHDStudio/badge)](https://securityscorecards.dev/viewer/?uri=github.com/purelogiccode/CHDStudio) @@ -159,7 +159,7 @@ Generated cue sheets reference the disc image where it already lies rather than ## ๐Ÿ’ป Requirements * **Operating System**: Windows 10 / 11 (x64 or ARM64), Linux (x64 or ARM64) and macOS (Intel or Apple silicon); release zips are published for all six runtime identifiers -* **Runtime**: [.NET 10.0 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/10.0) on Windows; the .NET 10.0 runtime on Linux and macOS +* **Runtime**: [.NET 11.0 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/11.0) on Windows; the .NET 11.0 runtime on Linux and macOS * **Bundled Dependencies**: * `chdman.exe` / `chdman_arm64.exe` (MAME Project โ€” primary encoder on Windows, extraction fallback) * `7za.exe` / `7za_arm64.exe` (Windows) or `7zz` (official 7-Zip 26.03, Linux/macOS) โ€” 7-Zip fallback extraction @@ -186,7 +186,7 @@ Generated cue sheets reference the disc image where it already lies rather than 3. **Important** (Windows): ensure the tool `.exe` files (including ARM64 variants) remain in the same directory as `CHDStudio.exe`. On Linux and macOS, keep `7zz` next to the app; nothing else is required because the CHDSharp encoder is built in. 4. Launch the application. -Each release zip is named `release__.zip` (for example `release_3.13.5_win-x64.zip`) and contains the framework-dependent single-file app, the native Avalonia libraries, the matching `chdman`/7-Zip tools, and this `ReadMe.md`, `LICENSE.txt` and `WhatsNew.md`. The .NET 10 runtime is **not** embedded in the executable. +Each release zip is named `release__.zip` (for example `release_3.13.5_win-x64.zip`) and contains the framework-dependent single-file app, the native Avalonia libraries, the matching `chdman`/7-Zip tools, and this `ReadMe.md`, `LICENSE.txt` and `WhatsNew.md`. The .NET 11 runtime is **not** embedded in the executable. Every release zip is built by GitHub Actions and gets a signed build-provenance attestation. Verify a download with the GitHub CLI: diff --git a/docs/02-getting-started.md b/docs/02-getting-started.md index 7ef9253..c9a8fc8 100644 --- a/docs/02-getting-started.md +++ b/docs/02-getting-started.md @@ -9,7 +9,7 @@ nav_order: 3 ### Runtime (end users) - **OS**: Windows 10 / 11, Linux and macOS (x64 or ARM64); release zips are published for `win-x64`, `win-arm64`, `linux-x64`, `linux-arm64`, `osx-x64` and `osx-arm64` -- **Runtime**: [.NET 10.0 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/10.0) on Windows; the .NET 10.0 runtime on Linux and macOS +- **Runtime**: [.NET 11.0 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/11.0) on Windows; the .NET 11.0 runtime on Linux and macOS - **Bundled executables** (shipped with the app, must stay next to `CHDStudio.exe`): - Windows: `chdman.exe` / `chdman_arm64.exe` (0.289) โ€” MAME CHD tool (primary encoder and extraction fallback); `7za.exe` / `7za_arm64.exe` โ€” 7-Zip fallback extractor - Linux/macOS: `7zz` (official 7-Zip 26.03 console build, copied from `tools/` at publish time) โ€” 7-Zip fallback extractor @@ -30,7 +30,7 @@ nav_order: 3 3. **Important** (Windows): keep all `.exe` files (including ARM64 variants) in the same directory as `CHDStudio.exe` โ€” tool discovery probes the app's base directory first, then `PATH` (`MainWindow.axaml.cs`). On Linux and macOS, `7zz` ships next to the app and other tools are discovered on `PATH`; the built-in CHDSharp encoder needs nothing on disk. 4. Launch `CHDStudio.exe` on Windows or `CHDStudio` on Linux/macOS. -Every release zip is named `release__.zip` and contains the framework-dependent single-file app, its native libraries, the matching `chdman`/7-Zip tools, `LICENSE.txt`, `ReadMe.md` and `WhatsNew.md`. The .NET 10 runtime is not embedded, so install the runtime listed above. Extract the **whole** archive into one folder: copying only `CHDStudio.exe` leaves the native rendering libraries behind and the app will refuse to start with a missing-library message. +Every release zip is named `release__.zip` and contains the framework-dependent single-file app, its native libraries, the matching `chdman`/7-Zip tools, `LICENSE.txt`, `ReadMe.md` and `WhatsNew.md`. The .NET 11 runtime is not embedded, so install the runtime listed above. Extract the **whole** archive into one folder: copying only `CHDStudio.exe` leaves the native rendering libraries behind and the app will refuse to start with a missing-library message. --- @@ -55,13 +55,13 @@ The solution contains seven projects: | Project | Kind | Target framework | |---------|------|------------------| -| `CHDStudio` | Avalonia application (WinExe) | `net10.0;net10.0-windows` | -| `CHDStudio.Tests` | xUnit test suite | `net10.0-windows` | -| `MDSSharp` | class library (Alcohol 120% .mds/.mdf parsing) | `net8.0;net9.0;net10.0` | -| `CCDSharp` | class library (CloneCD parsing) | `net8.0;net9.0;net10.0` | -| `CSOSharp` | class library (CSO decompression) | `net8.0;net9.0;net10.0` | -| `PBPSharp` | class library (PBP/SFO parsing) | `net8.0;net9.0;net10.0` | -| `ISZSharp` | class library (ISZ decompression) | `net8.0;net9.0;net10.0` | +| `CHDStudio` | Avalonia application (WinExe) | `net11.0;net11.0-windows` | +| `CHDStudio.Tests` | xUnit test suite | `net11.0-windows` | +| `MDSSharp` | class library (Alcohol 120% .mds/.mdf parsing) | `net8.0;net9.0;net10.0;net11.0` | +| `CCDSharp` | class library (CloneCD parsing) | `net8.0;net9.0;net10.0;net11.0` | +| `CSOSharp` | class library (CSO decompression) | `net8.0;net9.0;net10.0;net11.0` | +| `PBPSharp` | class library (PBP/SFO parsing) | `net8.0;net9.0;net10.0;net11.0` | +| `ISZSharp` | class library (ISZ decompression) | `net8.0;net9.0;net10.0;net11.0` | > **Note**: on Windows, `chdman.exe` and `7za.exe` are copied to the output directory by the build (`CHDStudio.csproj`); on Linux and macOS the matching `tools/7zz*` binary (official 7-Zip 26.03) is copied as `7zz`, while a `chdman` on `PATH` is only used for extraction fallback and never for encoding. The libraries are referenced as project references, not NuGet packages, except `CHDSharp` (NuGet 1.6.3) and other packages listed below. diff --git a/docs/03-architecture.md b/docs/03-architecture.md index a8a3edb..b7846c8 100644 --- a/docs/03-architecture.md +++ b/docs/03-architecture.md @@ -13,7 +13,7 @@ This page describes the solution structure, the runtime startup sequence, and th ``` CSharp_CHDStudio.sln -โ”œโ”€โ”€ CHDStudio/ (Avalonia app, net10.0;net10.0-windows) +โ”œโ”€โ”€ CHDStudio/ (Avalonia app, net11.0;net11.0-windows) โ”‚ โ”œโ”€โ”€ App.axaml(.cs) โ†’ startup, Serilog, exception handlers โ”‚ โ”œโ”€โ”€ AppConfig.cs โ†’ central configuration โ”‚ โ”œโ”€โ”€ MainWindow.axaml(.cs) โ†’ UI + all batch logic @@ -59,11 +59,11 @@ CSharp_CHDStudio.sln โ”‚ โ”œโ”€โ”€ EcmImageDecoder.cs โ†’ ECM block-stream decoder โ”‚ โ””โ”€โ”€ EcmDecodeResult.cs โ”œโ”€โ”€ CHDStudio.Tests/ (xUnit; Fixtures/ holds ecm-sample.ecm, rar-multipart/, MdsV2/ and laserdisc-small.avi) -โ”œโ”€โ”€ MDSSharp/ (Alcohol 120% .mds/.mdf parsing; net8.0;net9.0;net10.0) -โ”œโ”€โ”€ CCDSharp/ (CloneCD .ccd/.img/.sub parsing; net10.0;net8.0) -โ”œโ”€โ”€ CSOSharp/ (CSO/CISO decompression; net10.0;net8.0) -โ”œโ”€โ”€ PBPSharp/ (PBP/SFO parsing; net10.0;net8.0) -โ”œโ”€โ”€ ISZSharp/ (UltraISO ISZ decompression; net8.0;net9.0;net10.0) +โ”œโ”€โ”€ MDSSharp/ (Alcohol 120% .mds/.mdf parsing; net8.0;net9.0;net10.0;net11.0) +โ”œโ”€โ”€ CCDSharp/ (CloneCD .ccd/.img/.sub parsing; net8.0;net9.0;net10.0;net11.0) +โ”œโ”€โ”€ CSOSharp/ (CSO/CISO decompression; net8.0;net9.0;net10.0;net11.0) +โ”œโ”€โ”€ PBPSharp/ (PBP/SFO parsing; net8.0;net9.0;net10.0;net11.0) +โ”œโ”€โ”€ ISZSharp/ (UltraISO ISZ decompression; net8.0;net9.0;net10.0;net11.0) โ””โ”€โ”€ References/ (third-party sources โ€” not part of the build) ``` @@ -84,7 +84,7 @@ CSharp_CHDStudio.sln ``` - The app references `MDSSharp`, `CCDSharp`, `CSOSharp`, `PBPSharp` and `ISZSharp` as project references. -- All five libraries are packable and expose internals to `CHDStudio.Tests` via `InternalsVisibleTo`; `MDSSharp`, `CCDSharp`, `CSOSharp`, `PBPSharp` and `ISZSharp` all multi-target `net8.0;net9.0;net10.0`. +- All five libraries are packable and expose internals to `CHDStudio.Tests` via `InternalsVisibleTo`; `MDSSharp`, `CCDSharp`, `CSOSharp`, `PBPSharp` and `ISZSharp` all multi-target `net8.0;net9.0;net10.0;net11.0`. - `CHDStudio.Tests` references the app (internals visible) plus `MDSSharp`, `CCDSharp`, `CSOSharp`, `PBPSharp` and `ISZSharp`; `CcdParserTests`/`CcdModelTests` cover the CloneCD parser and writer (see [Testing](11-testing.md)). > **Why ISZ and Alcohol support moved into libraries.** `ISZSharp` and `MDSSharp` were split out of the app's utilities into standalone packable projects (they are self-contained formats with redistributable value), while ECM decoding remains in-app because it is tightly coupled to the cue staging flow. The test project references both new libraries directly. diff --git a/docs/08-utilities-reference.md b/docs/08-utilities-reference.md index 90872b2..e6b0108 100644 --- a/docs/08-utilities-reference.md +++ b/docs/08-utilities-reference.md @@ -260,7 +260,7 @@ Locates the volumes of a multi-part RAR. SharpCompress can only decode a set whe ## 8.10 ISZ Support (`ISZSharp`) -Decompresses UltraISO `.isz` images. Lives in the standalone `ISZSharp` library (multi-targeted `net8.0;net9.0;net10.0`, MIT-licensed, packable, with a README and icon like the other libraries) and is written against EZB Systems' ISZ File Format Specification 1.00 plus the real-file behaviours libMirage's ISZ filter and isz-tool agree on. +Decompresses UltraISO `.isz` images. Lives in the standalone `ISZSharp` library (multi-targeted `net8.0;net9.0;net10.0;net11.0`, MIT-licensed, packable, with a README and icon like the other libraries) and is written against EZB Systems' ISZ File Format Specification 1.00 plus the real-file behaviours libMirage's ISZ filter and isz-tool agree on. | Type | Role | |------|------| @@ -306,7 +306,7 @@ The format: after the 4-byte signature comes a sequence of blocks, each introduc ## 8.12 Alcohol 120% Support (`MDSSharp`) -Lives in the standalone `MDSSharp` library (multi-targeted `net8.0;net9.0;net10.0`, MIT-licensed, packable) together with `SplitImageJoiner`. +Lives in the standalone `MDSSharp` library (multi-targeted `net8.0;net9.0;net10.0;net11.0`, MIT-licensed, packable) together with `SplitImageJoiner`. | Type | Role | |------|------| diff --git a/docs/10-libraries.md b/docs/10-libraries.md index de6ae0a..4d750cb 100644 --- a/docs/10-libraries.md +++ b/docs/10-libraries.md @@ -5,7 +5,7 @@ nav_order: 11 # 10. Embedded Libraries -The solution ships five in-house libraries that replace external tools (maxcso, psxpackager), add CloneCD support, and cover Alcohol 120% and UltraISO images. The app references them as project references. All five are published as NuGet packages for outside consumers โ€” **PBPSharp** (, 1.1.8), **CSOSharp** (, 1.0.2), **CCDSharp** (, 1.0.3), **MDSSharp** (, 1.2.3) and **ISZSharp** (, 1.0.3) โ€” and they all multi-target `net8.0;net9.0;net10.0`, each shipping its XML docs, README and icon; releases are manual (see the repository's AGENTS.md). All five expose internals to `CHDStudio.Tests` via `InternalsVisibleTo`. A sixth in-house library, **CHDSharp**, is consumed as a NuGet package and is covered in [ยง10.4](#104-chdsharp-nuget). +The solution ships five in-house libraries that replace external tools (maxcso, psxpackager), add CloneCD support, and cover Alcohol 120% and UltraISO images. The app references them as project references. All five are published as NuGet packages for outside consumers โ€” **PBPSharp** (, 1.1.8), **CSOSharp** (, 1.0.2), **CCDSharp** (, 1.0.3), **MDSSharp** (, 1.2.3) and **ISZSharp** (, 1.0.3) โ€” and they all multi-target `net8.0;net9.0;net10.0;net11.0`, each shipping its XML docs, README and icon; releases are manual (see the repository's AGENTS.md). All five expose internals to `CHDStudio.Tests` via `InternalsVisibleTo`. A sixth in-house library, **CHDSharp**, is consumed as a NuGet package and is covered in [ยง10.4](#104-chdsharp-nuget). | Library | Purpose | Replaces | |---------|---------|----------| diff --git a/docs/11-testing.md b/docs/11-testing.md index a809bc2..4ed2173 100644 --- a/docs/11-testing.md +++ b/docs/11-testing.md @@ -5,7 +5,7 @@ nav_order: 12 # 11. Testing -The solution contains a single test project, `CHDStudio.Tests` (xUnit, `net10.0-windows`), with **1,299 tests across 64 test classes**: 1,270 unit tests plus 29 integration tests that need a local sample folder (see ยง11.5), plus the shared `FakeHttpMessageHandler` and `IszImageBuilder` helpers. +The solution contains a single test project, `CHDStudio.Tests` (xUnit, `net11.0-windows`), with **1,299 tests across 64 test classes**: 1,270 unit tests plus 29 integration tests that need a local sample folder (see ยง11.5), plus the shared `FakeHttpMessageHandler` and `IszImageBuilder` helpers. > **Expected result on a machine without the local sample folders:** the 1,270 unit tests pass and the 29 integration tests early-return (reported as passed) because their sample folders are absent. CI excludes them with `--filter "Category!=Integration"`. @@ -17,7 +17,7 @@ dotnet test CSharp_CHDStudio.sln -c Release dotnet test CHDStudio.Tests/CHDStudio.Tests.csproj --no-build ``` -Requirements: the tests are run on Windows (the app project is `net10.0-windows`). Some tests need the app's output directory to contain `chdman.exe` (it is copied by the build). +Requirements: the tests are run on Windows (the app project is `net11.0-windows`). Some tests need the app's output directory to contain `chdman.exe` (it is copied by the build). ## 11.2 How Tests Are Structured diff --git a/docs/14-release-and-deployment.md b/docs/14-release-and-deployment.md index 2f66334..1b9fcf2 100644 --- a/docs/14-release-and-deployment.md +++ b/docs/14-release-and-deployment.md @@ -36,24 +36,24 @@ Avalonia libraries and the matching bundled tools. | RID | TFM | Tools in the zip | |---|---|---| -| `win-x64` | `net10.0-windows` | `chdman.exe`, `7za.exe` | -| `win-arm64` | `net10.0-windows` | `chdman_arm64.exe`, `7za_arm64.exe` | -| `linux-x64` | `net10.0` | `7zz`, `7-Zip-License.txt` | -| `linux-arm64` | `net10.0` | `7zz`, `7-Zip-License.txt` | -| `osx-x64` | `net10.0` | `7zz`, `7-Zip-License.txt` | -| `osx-arm64` | `net10.0` | `7zz`, `7-Zip-License.txt` | +| `win-x64` | `net11.0-windows` | `chdman.exe`, `7za.exe` | +| `win-arm64` | `net11.0-windows` | `chdman_arm64.exe`, `7za_arm64.exe` | +| `linux-x64` | `net11.0` | `7zz`, `7-Zip-License.txt` | +| `linux-arm64` | `net11.0` | `7zz`, `7-Zip-License.txt` | +| `osx-x64` | `net11.0` | `7zz`, `7-Zip-License.txt` | +| `osx-arm64` | `net11.0` | `7zz`, `7-Zip-License.txt` | From the repository root: ```powershell $version = "3.13.5" $rids = @( - @{ Rid = 'win-x64'; Tfm = 'net10.0-windows' }, - @{ Rid = 'win-arm64'; Tfm = 'net10.0-windows' }, - @{ Rid = 'linux-x64'; Tfm = 'net10.0' }, - @{ Rid = 'linux-arm64'; Tfm = 'net10.0' }, - @{ Rid = 'osx-x64'; Tfm = 'net10.0' }, - @{ Rid = 'osx-arm64'; Tfm = 'net10.0' } + @{ Rid = 'win-x64'; Tfm = 'net11.0-windows' }, + @{ Rid = 'win-arm64'; Tfm = 'net11.0-windows' }, + @{ Rid = 'linux-x64'; Tfm = 'net11.0' }, + @{ Rid = 'linux-arm64'; Tfm = 'net11.0' }, + @{ Rid = 'osx-x64'; Tfm = 'net11.0' }, + @{ Rid = 'osx-arm64'; Tfm = 'net11.0' } ) foreach ($item in $rids) { diff --git a/docs/index.md b/docs/index.md index 2d1471a..e7a75f4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -36,7 +36,7 @@ This documentation covers the project from both a user and a developer perspecti |------|-------| | **Application name** | `CHDStudio` | | **Latest version** | 3.13.5 | -| **Target framework** | .NET 10.0 (`net10.0;net10.0-windows`), Avalonia | +| **Target framework** | .NET 11.0 (`net11.0;net11.0-windows`), Avalonia | | **Platform** | Windows 10 / 11, Linux and macOS (x64 and ARM64; release zips for all six runtime identifiers) | | **License** | GPL v3.0 | | **Primary encoder** | `chdman` (MAME Project, 0.289), bundled as `chdman.exe` / `chdman_arm64.exe` on Windows; built-in CHDSharp on Linux/macOS | @@ -53,7 +53,7 @@ This documentation covers the project from both a user and a developer perspecti ``` CHDStudio/ โ”œโ”€โ”€ MDSSharp/ # Alcohol 120% (.mds/.mdf) parsing library -โ”œโ”€โ”€ CHDStudio/ # Avalonia application (net10.0;net10.0-windows) +โ”œโ”€โ”€ CHDStudio/ # Avalonia application (net11.0;net11.0-windows) โ”‚ โ”œโ”€โ”€ MainWindow.axaml(.cs) # Main UI + conversion/extraction/verification logic โ”‚ โ”œโ”€โ”€ App.axaml(.cs) # Startup, Serilog, exception handlers โ”‚ โ”œโ”€โ”€ AppConfig.cs # Central configuration constants diff --git a/global.json b/global.json index 9a523dc..2dd7cc7 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.0", + "version": "11.0.0", "rollForward": "latestMajor", "allowPrerelease": false } From 5d807402288aab56463865f9d017e6dde7939491 Mon Sep 17 00:00:00 2001 From: Peterson Fernandes Date: Fri, 13 Nov 2026 00:18:27 -0300 Subject: [PATCH 2/2] fix: harden bundled tool execution and extraction errors - Repair a missing Unix execute bit on bundled tools before starting them, fall back to PATH when the file cannot be made executable, and report the tool path plus the chmod remedy when it still cannot start (#69847). - Treat an unwritable extraction destination as a folder/permission problem: name the folder and the remedy, keep CHD header diagnostics out of the message, and do not file a bug report for it (#69841, #69842, #69843). - Keep the source-size pre-flight alive when the MDSSharp assembly cannot be loaded, so a non-MDS batch still starts and the conversion path reports the real problem (#69844). - Add regression tests for the execute-bit repair, an unstartable tool, the new folder message and its bug-report exclusion. --- CHDStudio.Tests/ArchiveServiceTests.cs | 28 +++++++ CHDStudio.Tests/BugReportServiceTests.cs | 4 + CHDStudio.Tests/PathUtilsTests.cs | 62 +++++++++++++++ CHDStudio/MainWindow.axaml.cs | 77 +++++++++++++------ CHDStudio/Services/ArchiveService.cs | 39 ++++++++-- CHDStudio/Services/BugReportService.cs | 4 + CHDStudio/Utilities/ConversionReport.cs | 23 +++++- .../OutputDirectoryUnavailableException.cs | 70 +++++++++++++++++ CHDStudio/Utilities/PathUtils.cs | 42 ++++++++++ 9 files changed, 315 insertions(+), 34 deletions(-) create mode 100644 CHDStudio/Utilities/OutputDirectoryUnavailableException.cs diff --git a/CHDStudio.Tests/ArchiveServiceTests.cs b/CHDStudio.Tests/ArchiveServiceTests.cs index 275fc73..0cef99f 100644 --- a/CHDStudio.Tests/ArchiveServiceTests.cs +++ b/CHDStudio.Tests/ArchiveServiceTests.cs @@ -1321,6 +1321,34 @@ public async Task ExtractArchiveAsyncCorrupt7ZWith7ZaLogs7ZaFallbackAttempt() ); } + [Fact] + public async Task ExtractArchiveAsyncUnstartableToolReturnsItsPathAndReason() + { + // A bundled 7zz extracted without the execute bit (or a file that is not a real + // executable) used to surface as a bare Win32Exception in the bug report. The fallback + // must name the tool and explain what to do instead. + var fakeTool = Path.Combine( + _tempDir, + OperatingSystem.IsWindows() ? "fake7za.exe" : "fake7za" + ); + File.WriteAllText(fakeTool, "not an executable"); + var service = new ArchiveService(fakeTool, true); + var corruptPath = Path.Combine(_tempDir, "corrupt-unstartable.7z"); + File.WriteAllText(corruptPath, "not a 7z archive"); + var tempDir = Path.Combine(_tempDir, "extract"); + + var result = await service.ExtractArchiveAsync( + corruptPath, + tempDir, + static _ => { }, + CancellationToken.None + ); + + Assert.False(result.Success); + Assert.Contains("Could not start", result.ErrorMessage, StringComparison.Ordinal); + Assert.Contains(fakeTool, result.ErrorMessage, StringComparison.Ordinal); + } + [Fact] public async Task ExtractArchiveAsyncCorrupt7ZWithout7ZaReturnsFailure() { diff --git a/CHDStudio.Tests/BugReportServiceTests.cs b/CHDStudio.Tests/BugReportServiceTests.cs index 84cb2c7..d67d0eb 100644 --- a/CHDStudio.Tests/BugReportServiceTests.cs +++ b/CHDStudio.Tests/BugReportServiceTests.cs @@ -443,6 +443,10 @@ public async Task SendBugReportAsyncReturnsFalseOnBadRequest() [InlineData( " Could not write the extracted files for 'Zusar Vasar (JP).chd': Extraction failed; track 3: Chderrwriteerror The output drive could not be written: it may be full, disconnected, read-only, or access may be denied." )] + // The staging folder for an extraction could not be created in the chosen output folder. + [InlineData( + " Could not create the extraction folder for 'TengaiII_KO_Native_v54.chd': The output folder \"C:\\Users\\player\\Downloads\" cannot be written (access was denied)." + )] // Conversion-time permission guidance for a write-protected output folder. [InlineData( " Conversion of 'Need for Speed - Hot Pursuit 2 (Europe, Australia) (En,Fr,De,Es,It,Sv) (v2.00).iso' failed due to a permission error. The output folder may be write-protected or require administrator rights." diff --git a/CHDStudio.Tests/PathUtilsTests.cs b/CHDStudio.Tests/PathUtilsTests.cs index 189f380..4c1e6dc 100644 --- a/CHDStudio.Tests/PathUtilsTests.cs +++ b/CHDStudio.Tests/PathUtilsTests.cs @@ -609,4 +609,66 @@ public void HasFreeSpaceForDirectory_HugeRequirementIsReportedAsInsufficient() } #endregion + + #region Tool executability + + [Fact] + public void TryEnsureExecutable_MissingFileReturnsFalse() + { + // Discovery uses the result to skip to the next candidate instead of returning a path that + // Process.Start cannot run. + var missing = Path.Combine(Path.GetTempPath(), $"missing_tool_{Guid.NewGuid():N}"); + Assert.False(PathUtils.TryEnsureExecutable(missing)); + } + + [Fact] + public void TryEnsureExecutable_AddsExecuteBitsWhenTheyWereDropped() + { + // Some archive managers extract the release zip without Unix modes, which leaves the + // bundled 7zz at 0644 and makes Process.Start fail with "Permission denied". + var tool = Path.Combine(Path.GetTempPath(), $"tool_{Guid.NewGuid():N}"); + File.WriteAllText(tool, "#!/bin/sh\nexit 0\n"); + try + { + if (!OperatingSystem.IsWindows()) + { + File.SetUnixFileMode(tool, UnixFileMode.UserRead | UnixFileMode.UserWrite); + Assert.Equal(0, (int)(File.GetUnixFileMode(tool) & UnixFileMode.UserExecute)); + } + + Assert.True(PathUtils.TryEnsureExecutable(tool)); + + if (!OperatingSystem.IsWindows()) + { + Assert.NotEqual( + 0, + (int)( + File.GetUnixFileMode(tool) + & ( + UnixFileMode.UserExecute + | UnixFileMode.GroupExecute + | UnixFileMode.OtherExecute + ) + ) + ); + } + } + finally + { + Cleanup(null, tool); + } + } + + [Fact] + public void OutputDirectoryUnavailableExceptionNamesTheFolderAndReason() + { + var directory = Path.Combine(Path.GetTempPath(), "protected-output"); + var exception = new OutputDirectoryUnavailableException(directory, "access was denied"); + + Assert.Contains(directory, exception.Message, StringComparison.Ordinal); + Assert.Contains("access was denied", exception.Message, StringComparison.Ordinal); + Assert.Contains("output folder", exception.Message, StringComparison.OrdinalIgnoreCase); + } + + #endregion } \ No newline at end of file diff --git a/CHDStudio/MainWindow.axaml.cs b/CHDStudio/MainWindow.axaml.cs index 7703c53..bbae5ba 100644 --- a/CHDStudio/MainWindow.axaml.cs +++ b/CHDStudio/MainWindow.axaml.cs @@ -401,8 +401,10 @@ private void ToggleMaximize() /// Returns the first candidate name that exists in , together /// with its name and availability. The candidate list is ordered best-first (the OS-native /// build on ARM64 machines), so a partial or mixed deployment still finds an executable the - /// machine can run. When nothing exists, the preferred name is returned so missing-dependency - /// messages point at the file that should be there. + /// machine can run. On Unix the execute bit is repaired when an extractor dropped it, and a + /// tool that still cannot be made executable is skipped. When nothing usable exists, the + /// preferred name is returned so missing-dependency messages point at the file that should be + /// there. /// private static (string Path, string Name, bool Available) ResolveToolExecutable( string baseDirectory, @@ -412,7 +414,8 @@ IReadOnlyList candidateNames foreach (var name in candidateNames) { var path = Path.Combine(baseDirectory, name); - if (File.Exists(path)) return (path, name, true); + if (File.Exists(path) && PathUtils.TryEnsureExecutable(path)) + return (path, name, true); } // On Linux and macOS the tools are normally installed system-wide (MAME's chdman, @@ -420,7 +423,7 @@ IReadOnlyList candidateNames foreach (var name in candidateNames) { var path = FindOnPath(name); - if (path != null) return (path, name, true); + if (path != null && PathUtils.TryEnsureExecutable(path)) return (path, name, true); } var preferred = candidateNames[0]; @@ -5990,7 +5993,9 @@ CancellationToken token : Path.Join(outputFolder, relativePath); if (!PathUtils.TryCreateDirectory(targetDir, out var targetDirError)) { - LogError($" Output folder is not available: {targetDir} ({targetDirError})."); + LogError( + $" Output folder is not available: {targetDir} ({targetDirError}). Choose another output folder or check that it is writable." + ); return false; } @@ -6160,6 +6165,12 @@ await ExtractChdTracksToDirectoryAsync( { throw; } + catch (OutputDirectoryUnavailableException) + { + // A folder the extraction could not create says nothing about the CHD, + // so keep the actionable filesystem message free of header noise. + throw; + } catch (Exception ex) { // Attach the CHD header fields that identify the image while it is @@ -6210,22 +6221,37 @@ await TryDeleteFileAsync( // CHDSharp failure is reported only when chdman cannot extract it either - a // successful fallback means the extraction worked and is not an app bug. The // reason still goes to the user's log at informational level. + var outputUnavailable = ex is OutputDirectoryUnavailableException; var reason = GetChdExtractionErrorMessage(ex.Message); - LogMessage( - $" Built-in reader could not extract '{Path.GetFileName(chdFile)}': {reason} Trying chdman..." - ); - if ( - reason.Contains("Chderrinvaliddata", StringComparison.OrdinalIgnoreCase) - || reason.Contains( - "CD track metadata is missing or damaged", - StringComparison.OrdinalIgnoreCase - ) - ) + if (outputUnavailable) + { + // The built-in reader never reached the image: the destination could not be + // prepared (permissions, read-only volume, Controlled folder access). chdman + // writes directly into the target folder, so it may still succeed where a + // staging subdirectory could not be created. + LogWarning( + $" Could not create the extraction folder for '{Path.GetFileName(chdFile)}': {ex.Message} Trying chdman..." + ); + } + else { LogMessage( - " This CHD is damaged: its CD track metadata cannot be parsed. Re-create it from the original cue/bin; a valid CHD from the same source extracts normally." + $" Built-in reader could not extract '{Path.GetFileName(chdFile)}': {reason} Trying chdman..." ); + + if ( + reason.Contains("Chderrinvaliddata", StringComparison.OrdinalIgnoreCase) + || reason.Contains( + "CD track metadata is missing or damaged", + StringComparison.OrdinalIgnoreCase + ) + ) + { + LogMessage( + " This CHD is damaged: its CD track metadata cannot be parsed. Re-create it from the original cue/bin; a valid CHD from the same source extracts normally." + ); + } } try @@ -6244,14 +6270,16 @@ await TryDeleteFileAsync( if (chdmanExtracted) { LogMessage( - $" Extracted '{Path.GetFileName(chdFile)}' using chdman fallback (the built-in reader could not decode this CHD)." + outputUnavailable + ? $" Extracted '{Path.GetFileName(chdFile)}' using chdman fallback (the built-in reader could not create its staging folder)." + : $" Extracted '{Path.GetFileName(chdFile)}' using chdman fallback (the built-in reader could not decode this CHD)." ); success = true; } - else if (IsChdWriteFailure(reason)) + else if (outputUnavailable || IsChdWriteFailure(reason)) { - // The built-in reader reached the data but could not write it (and - // chdman could not either). That is a full, disconnected, read-only or + // The built-in reader could not prepare or write the output (and chdman + // could not either). That is a full, disconnected, read-only or // access-denied output volume, not an app defect, so it must not be // filed as a bug report. LogWarning( @@ -6373,9 +6401,7 @@ CancellationToken token ); if (!PathUtils.TryCreateDirectory(tempExtractDir, out var tempExtractDirError)) { - throw new IOException( - $"the output folder is not available ({tempExtractDirError})" - ); + throw new OutputDirectoryUnavailableException(targetDir, tempExtractDirError); } var allMoved = false; @@ -6428,8 +6454,9 @@ CancellationToken token destinationDir = PathUtils.ReserveFreeSubdirectory(targetDir, baseFileName); if (!PathUtils.TryCreateDirectory(destinationDir, out var destinationDirError)) { - throw new IOException( - $"the output folder is not available ({destinationDirError})" + throw new OutputDirectoryUnavailableException( + destinationDir, + destinationDirError ); } diff --git a/CHDStudio/Services/ArchiveService.cs b/CHDStudio/Services/ArchiveService.cs index f848863..aeba7df 100644 --- a/CHDStudio/Services/ArchiveService.cs +++ b/CHDStudio/Services/ArchiveService.cs @@ -1,3 +1,4 @@ +using System.ComponentModel; using System.Diagnostics; using System.IO.Compression; using System.Security; @@ -25,6 +26,7 @@ internal class ArchiveService private static readonly ILogger Logger = Log.ForContext(); private readonly bool _isSevenZipAvailable; private readonly string _sevenZipExePath; + private readonly string _sevenZipName; /// /// Initializes a new instance of the class. @@ -35,6 +37,9 @@ internal ArchiveService(string sevenZipExePath, bool isSevenZipAvailable) { _sevenZipExePath = sevenZipExePath; _isSevenZipAvailable = isSevenZipAvailable; + _sevenZipName = Path.GetFileName(sevenZipExePath) is { Length: > 0 } name + ? name + : "7za.exe"; } /// @@ -584,7 +589,7 @@ await File.WriteAllTextAsync( { return ( false, - "the bundled 7za.exe is missing, so the split archive cannot be extracted. Extract the set manually and add the extracted image." + $"the bundled {_sevenZipName} is missing or not executable, so the split archive cannot be extracted. Extract the set manually and add the extracted image." ); } @@ -659,7 +664,7 @@ await Task.Run( catch (Exception ex) when (_isSevenZipAvailable && ex is not OperationCanceledException) { onLog( - $"Built-in zip extractor failed for {archiveFileName} ({ex.Message}). Falling back to 7za.exe..." + $"Built-in zip extractor failed for {archiveFileName} ({ex.Message}). Falling back to {_sevenZipName}..." ); progress?.Report(new ArchiveProgress(0, 0, 0, 0)); await ExtractWith7ZaAsync(archivePath, outputDirectory, onLog, token) @@ -857,7 +862,7 @@ CancellationToken token if (_isSevenZipAvailable) { onLog( - $"SharpCompress extraction failed ({ex.Message}). Trying 7za.exe fallback..." + $"SharpCompress extraction failed ({ex.Message}). Trying {_sevenZipName} fallback..." ); await ExtractWith7ZaAsync(archivePath, outputDirectory, onLog, token) .ConfigureAwait(false); @@ -883,7 +888,7 @@ private async Task ExtractWith7ZaAsync( CancellationToken token ) { - onLog($"Extracting with 7za.exe: {Path.GetFileName(archivePath)}"); + onLog($"Extracting with {_sevenZipName}: {Path.GetFileName(archivePath)}"); using var process = new Process(); var outputBuilder = new StringBuilder(); @@ -926,7 +931,25 @@ CancellationToken token } } }; - process.Start(); + try + { + process.Start(); + } + catch (Win32Exception ex) + { + // The common Unix failure is a bundled tool whose extractor dropped the execute + // bit; without this translation the user only sees "Permission denied" with no + // hint that one chmod fixes it. + var hint = + !OperatingSystem.IsWindows() && ex.NativeErrorCode == 13 + ? $" The file is not executable; run 'chmod +x \"{_sevenZipExePath}\"' or install 7-Zip." + : string.Empty; + throw new InvalidOperationException( + $"Could not start '{_sevenZipExePath}'.{hint} ({ex.Message})", + ex + ); + } + process.BeginOutputReadLine(); process.BeginErrorReadLine(); await process.WaitForExitAsync(token).ConfigureAwait(false); @@ -946,16 +969,16 @@ CancellationToken token ) { throw new InvalidDataException( - $"7za.exe: archive is invalid or corrupt ({Path.GetFileName(archivePath)}). Output: {outputText}" + $"{_sevenZipName}: archive is invalid or corrupt ({Path.GetFileName(archivePath)}). Output: {outputText}" ); } throw new InvalidOperationException( - $"7za.exe extraction failed with exit code {process.ExitCode}. Output: {outputText}" + $"{_sevenZipName} extraction failed with exit code {process.ExitCode}. Output: {outputText}" ); } - onLog($"Successfully extracted {Path.GetFileName(archivePath)} with 7za.exe"); + onLog($"Successfully extracted {Path.GetFileName(archivePath)} with {_sevenZipName}"); } catch (OperationCanceledException) { diff --git a/CHDStudio/Services/BugReportService.cs b/CHDStudio/Services/BugReportService.cs index 449131f..be86d29 100644 --- a/CHDStudio/Services/BugReportService.cs +++ b/CHDStudio/Services/BugReportService.cs @@ -167,6 +167,10 @@ internal class BugReportService // read-only or access-denied). CHDSharp reports this as Chderrwriteerror; the app // classifies it as an environment condition. "Could not write the extracted files", + // The staging directory for a CHD extraction could not be created in the chosen output + // folder (permissions, read-only volume, Controlled folder access). The message names + // the folder and the remedy, so it is an environment condition, not an app defect. + "Could not create the extraction folder", // Explicit permission guidance for a conversion whose output folder rejects writes. "failed due to a permission error", // Direct-stream extraction over a network share can hit a transient SMB hiccup diff --git a/CHDStudio/Utilities/ConversionReport.cs b/CHDStudio/Utilities/ConversionReport.cs index 244236c..ced6302 100644 --- a/CHDStudio/Utilities/ConversionReport.cs +++ b/CHDStudio/Utilities/ConversionReport.cs @@ -2,6 +2,7 @@ using CCDSharp; using CHDStudio.Models; using MDSSharp; +using Serilog; namespace CHDStudio.Utilities; @@ -19,6 +20,8 @@ internal static class ConversionReport ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal; + private static readonly ILogger Logger = Log.ForContext(typeof(ConversionReport)); + /// /// Returns the bytes a batch's inputs occupy on disk, including the data files referenced /// by cue/gdi/toc/ccd/mds descriptors and every part of a split image. Files are counted @@ -308,7 +311,25 @@ private static void AddFiles(IEnumerable files, HashSet sourceFi /// Set that receives every source path. private static void AddFile(string file, HashSet sourceFiles) { - var volumes = SplitImageJoiner.TryGetVolumeSet(file); + List? volumes; + try + { + volumes = SplitImageJoiner.TryGetVolumeSet(file); + } + catch (Exception ex) + when (ex is FileNotFoundException or FileLoadException or TypeLoadException + or BadImageFormatException + ) + { + // The size pre-flight only feeds the savings summary, and MDSSharp owns + // SplitImageJoiner. A deployment where that assembly cannot be resolved must not + // abort the whole batch before the first conversion; count the input itself and + // let the conversion path report the real problem if the input needs MDSSharp. + Logger.Information(ex, "Could not inspect {File} for split-image volumes", file); + sourceFiles.Add(file); + return; + } + if (volumes is null) { sourceFiles.Add(file); diff --git a/CHDStudio/Utilities/OutputDirectoryUnavailableException.cs b/CHDStudio/Utilities/OutputDirectoryUnavailableException.cs new file mode 100644 index 0000000..a35f405 --- /dev/null +++ b/CHDStudio/Utilities/OutputDirectoryUnavailableException.cs @@ -0,0 +1,70 @@ +using System.Diagnostics.CodeAnalysis; + +namespace CHDStudio.Utilities; + +/// +/// Raised when a directory needed to write extracted files cannot be created. It identifies a +/// problem with the chosen output location (permissions, a read-only or disconnected volume, +/// or Windows Controlled folder access) rather than a defect in the source image, so callers +/// must not attach CHD decode diagnostics or report it as a corrupt file. +/// +[SuppressMessage( + "Roslynator", + "RCS1194", + Justification = "The folder/reason constructor is the only one callers use; formatter-based serialization is obsolete on modern .NET." +)] +internal sealed class OutputDirectoryUnavailableException : IOException +{ + /// + /// Initializes a new instance of the + /// class. + /// + public OutputDirectoryUnavailableException() + { + } + + /// + /// Initializes a new instance of the + /// class with a caller-supplied message. + /// + /// Description of the failure. + public OutputDirectoryUnavailableException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the + /// class with a caller-supplied message and inner exception. + /// + /// Description of the failure. + /// Exception that caused this one. + public OutputDirectoryUnavailableException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes a new instance of the + /// class for a folder that could not be created. + /// + /// Directory that could not be created. + /// Why the file system refused to create it. + public OutputDirectoryUnavailableException(string directory, string reason) + : base(BuildMessage(directory, reason)) + { + } + + /// Builds the user-facing explanation, including the platform-specific remedy. + /// Directory that could not be created. + /// Why the file system refused to create it. + /// A message that names the folder and what the user can do about it. + private static string BuildMessage(string directory, string reason) + { + var remedy = OperatingSystem.IsWindows() + ? "Choose another output folder; if this one is intended, check that it is writable and that Windows Controlled folder access allows CHD Studio, or add an exclusion to your security software." + : "Choose another output folder; if this one is intended, check its permissions and free space, and whether it is on a read-only or disconnected volume."; + + return $"The output folder \"{directory}\" cannot be written ({reason}). {remedy}"; + } +} diff --git a/CHDStudio/Utilities/PathUtils.cs b/CHDStudio/Utilities/PathUtils.cs index 1a13706..b419cfb 100644 --- a/CHDStudio/Utilities/PathUtils.cs +++ b/CHDStudio/Utilities/PathUtils.cs @@ -45,6 +45,48 @@ internal static bool IsChdmanSafePath(string path) return path.Length < MaxChdmanPath && IsAsciiPath(path); } + /// + /// Makes a tool file executable on Unix, adding the execute bits when an extractor dropped + /// them. The release zips carry mode 0755 on the bundled tools, but some archive managers + /// (and copies through filesystems without Unix modes) produce 0644; starting such a file + /// fails with "Permission denied" before the tool can run. Windows needs no equivalent, so + /// this is a no-op there. + /// + /// Full path of the tool file. + /// + /// when the file exists and has an execute bit (or was given one); + /// when the file is missing or its mode cannot be read or changed, + /// so discovery can try the next candidate. + /// + internal static bool TryEnsureExecutable(string path) + { + if (!File.Exists(path)) return false; + if (OperatingSystem.IsWindows()) return true; + + try + { + var mode = File.GetUnixFileMode(path); + var executeBits = + UnixFileMode.UserExecute | UnixFileMode.GroupExecute | UnixFileMode.OtherExecute; + if ((mode & executeBits) != UnixFileMode.None) return true; + + File.SetUnixFileMode(path, mode | executeBits); + Logger.Information("Added execute permission to tool {Path}", path); + return true; + } + catch (Exception ex) + when (ex + is IOException + or UnauthorizedAccessException + or ArgumentException + or NotSupportedException + ) + { + Logger.Information(ex, "Could not make tool {Path} executable", path); + return false; + } + } + /// /// Creates a unique temporary directory whose full path is pure ASCII and well below /// MAX_PATH, for staging files that cannot be handed to chdman directly because their own