From 82dedf1ceb2c124fbfa3b96926857fda8a84806a Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 25 Nov 2025 09:14:46 -0500 Subject: [PATCH] Add support for .NET 10 --- .github/ISSUE_TEMPLATE/issue-report.md | 2 +- .github/workflows/build_and_test.yml | 95 +++++++++---------- .github/workflows/check_pr.yml | 43 ++++----- .vscode/launch.json | 6 +- CHANGELIST.md | 1 + MPF.CLI/MPF.CLI.csproj | 10 +- MPF.Check/MPF.Check.csproj | 10 +- .../MPF.ExecutionContexts.Test.csproj | 4 +- MPF.ExecutionContexts/Aaru/EncodingStrings.cs | 2 +- .../MPF.ExecutionContexts.csproj | 4 +- MPF.Frontend.Test/MPF.Frontend.Test.csproj | 4 +- .../Tools/ProtectionToolTests.cs | 2 +- MPF.Frontend/DumpEnvironment.cs | 12 ++- MPF.Frontend/MPF.Frontend.csproj | 10 +- MPF.Frontend/Options.cs | 6 +- MPF.Frontend/Tools/SubmissionGenerator.cs | 4 + MPF.Frontend/ViewModels/MainViewModel.cs | 2 +- .../MPF.Processors.Test.csproj | 4 +- MPF.Processors/DiscImageCreator.cs | 5 +- MPF.Processors/MPF.Processors.csproj | 15 ++- MPF.UI/App.xaml.cs | 2 +- .../WPFCustomMessageBox/CustomMessageBox.cs | 57 ++++++----- .../CustomMessageBoxWindow.xaml.cs | 36 +++---- MPF.UI/External/WPFCustomMessageBox/Util.cs | 4 +- MPF.UI/MPF.UI.csproj | 6 +- MPF.UI/Windows/MainWindow.xaml.cs | 4 +- README.md | 12 +-- publish-nix.sh | 16 ++-- publish-win.ps1 | 16 ++-- 29 files changed, 195 insertions(+), 199 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/issue-report.md b/.github/ISSUE_TEMPLATE/issue-report.md index 82e95577..bfc03d08 100644 --- a/.github/ISSUE_TEMPLATE/issue-report.md +++ b/.github/ISSUE_TEMPLATE/issue-report.md @@ -25,7 +25,7 @@ What version are you using? **Build** What runtime version are you using? -- [ ] .NET 9.0 running on (Operating System) +- [ ] .NET 10 running on (Operating System) **Describe the issue** A clear and concise description of what the bug is. diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 7c97fbae..8d4d0eb8 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,60 +1,59 @@ name: Build and Test on: - push: - branches: [ "master" ] + push: + branches: ["master"] jobs: - build: - runs-on: ubuntu-latest + build: + runs-on: ubuntu-latest - steps: - - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@v1.3.1 - with: - dotnet: false + steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@v1.3.1 + with: + dotnet: false - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 6.0.x - 8.0.x - 9.0.x - 10.0.x - - - name: Run tests - run: dotnet test - - - name: Run publish script - run: ./publish-nix.sh -dp + - uses: actions/checkout@v5 + with: + fetch-depth: 0 - - name: Update rolling tag - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git tag -f rolling - git push origin :refs/tags/rolling || true - git push origin rolling --force + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: | + 8.0.x + 9.0.x + 10.0.x - - name: Upload to rolling - uses: ncipollo/release-action@v1.14.0 - with: - allowUpdates: True - artifacts: "*.nupkg,*.snupkg,*.zip" - body: 'Last built commit: ${{ github.sha }} + - name: Run tests + run: dotnet test - ## UI Builds + - name: Run publish script + run: ./publish-nix.sh -dp - [Windows x64 UI Release](https://github.com/SabreTools/MPF/releases/download/rolling/MPF.UI_net9.0-windows_win-x64_release.zip) + - name: Update rolling tag + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -f rolling + git push origin :refs/tags/rolling || true + git push origin rolling --force - [Windows x64 UI Debug](https://github.com/SabreTools/MPF/releases/download/rolling/MPF.UI_net9.0-windows_win-x64_debug.zip)' - name: 'Rolling Release' - prerelease: True - replacesArtifacts: True - tag: "rolling" - updateOnlyUnreleased: True + - name: Upload to rolling + uses: ncipollo/release-action@v1.20.0 + with: + allowUpdates: True + artifacts: "*.nupkg,*.snupkg,*.zip" + body: "Last built commit: ${{ github.sha }} + + ## UI Builds + + [Windows x64 UI Release](https://github.com/SabreTools/MPF/releases/download/rolling/MPF.UI_net10.0-windows_win-x64_release.zip) + + [Windows x64 UI Debug](https://github.com/SabreTools/MPF/releases/download/rolling/MPF.UI_net10.0-windows_win-x64_debug.zip)" + name: "Rolling Release" + prerelease: True + replacesArtifacts: True + tag: "rolling" + updateOnlyUnreleased: True diff --git a/.github/workflows/check_pr.yml b/.github/workflows/check_pr.yml index 5adf5ef6..75b847a2 100644 --- a/.github/workflows/check_pr.yml +++ b/.github/workflows/check_pr.yml @@ -3,30 +3,29 @@ name: Build PR on: [pull_request] jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@v1.3.1 - with: - dotnet: false + build: + runs-on: ubuntu-latest + steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@v1.3.1 + with: + dotnet: false - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 6.0.x - 8.0.x - 9.0.x - 10.0.x + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: | + 8.0.x + 9.0.x + 10.0.x - - name: Restore dependencies - run: dotnet restore + - name: Restore dependencies + run: dotnet restore - - name: Build - run: dotnet build + - name: Build + run: dotnet build - - name: Test - run: dotnet test + - name: Test + run: dotnet test diff --git a/.vscode/launch.json b/.vscode/launch.json index 6e5e90d0..63440416 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/MPF.Check/bin/Debug/net9.0/MPF.Check.dll", + "program": "${workspaceFolder}/MPF.Check/bin/Debug/net10.0/MPF.Check.dll", "args": [], "cwd": "${workspaceFolder}/MPF.Check", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console @@ -24,7 +24,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/MPF.CLI/bin/Debug/net9.0/MPF.CLI.dll", + "program": "${workspaceFolder}/MPF.CLI/bin/Debug/net10.0/MPF.CLI.dll", "args": [], "cwd": "${workspaceFolder}/MPF.CLI", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console @@ -38,7 +38,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/MPF.UI/bin/Debug/net9.0-windows/MPF.dll", + "program": "${workspaceFolder}/MPF.UI/bin/Debug/net10.0-windows/MPF.dll", "args": [], "cwd": "${workspaceFolder}/MPF.UI", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console diff --git a/CHANGELIST.md b/CHANGELIST.md index b7f796a9..325b02b2 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -75,6 +75,7 @@ - Remove DPM identifier for StarForce Keyless - New Redumper Drive Pregap Start option - Clarify the unmounted device case +- Add support for .NET 10 ### 3.5.0 (2025-10-10) diff --git a/MPF.CLI/MPF.CLI.csproj b/MPF.CLI/MPF.CLI.csproj index 135b6d9f..0181dcaf 100644 --- a/MPF.CLI/MPF.CLI.csproj +++ b/MPF.CLI/MPF.CLI.csproj @@ -2,7 +2,7 @@ - net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0 + net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0 Exe false true @@ -31,11 +31,11 @@ win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64 - + win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64 - net6.0;net7.0;net8.0;net9.0 + net6.0;net7.0;net8.0;net9.0;net10.0 @@ -43,8 +43,8 @@ - - + + \ No newline at end of file diff --git a/MPF.Check/MPF.Check.csproj b/MPF.Check/MPF.Check.csproj index ca33a90f..800d6d5a 100644 --- a/MPF.Check/MPF.Check.csproj +++ b/MPF.Check/MPF.Check.csproj @@ -2,7 +2,7 @@ - net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0 + net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0 Exe false true @@ -31,11 +31,11 @@ win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64 - + win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64 - net6.0;net7.0;net8.0;net9.0 + net6.0;net7.0;net8.0;net9.0;net10.0 @@ -43,8 +43,8 @@ - - + + \ No newline at end of file diff --git a/MPF.ExecutionContexts.Test/MPF.ExecutionContexts.Test.csproj b/MPF.ExecutionContexts.Test/MPF.ExecutionContexts.Test.csproj index d0826f22..c01b6ef3 100644 --- a/MPF.ExecutionContexts.Test/MPF.ExecutionContexts.Test.csproj +++ b/MPF.ExecutionContexts.Test/MPF.ExecutionContexts.Test.csproj @@ -1,7 +1,7 @@ - net8.0;net9.0 + net8.0;net9.0;net10.0 false latest enable @@ -17,7 +17,7 @@ - + diff --git a/MPF.ExecutionContexts/Aaru/EncodingStrings.cs b/MPF.ExecutionContexts/Aaru/EncodingStrings.cs index 87562ac7..dd059003 100644 --- a/MPF.ExecutionContexts/Aaru/EncodingStrings.cs +++ b/MPF.ExecutionContexts/Aaru/EncodingStrings.cs @@ -40,4 +40,4 @@ namespace MPF.ExecutionContexts.Aaru public const string WesternEuropeanMac = "macintosh"; public const string WesternEuropeanRadix50 = "radix50"; } -} \ No newline at end of file +} diff --git a/MPF.ExecutionContexts/MPF.ExecutionContexts.csproj b/MPF.ExecutionContexts/MPF.ExecutionContexts.csproj index 8e3d13d4..c05e2404 100644 --- a/MPF.ExecutionContexts/MPF.ExecutionContexts.csproj +++ b/MPF.ExecutionContexts/MPF.ExecutionContexts.csproj @@ -2,7 +2,7 @@ - net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0 + net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0 false false true @@ -32,7 +32,7 @@ - + \ No newline at end of file diff --git a/MPF.Frontend.Test/MPF.Frontend.Test.csproj b/MPF.Frontend.Test/MPF.Frontend.Test.csproj index ae4ac4a6..3b3b9b5c 100644 --- a/MPF.Frontend.Test/MPF.Frontend.Test.csproj +++ b/MPF.Frontend.Test/MPF.Frontend.Test.csproj @@ -1,7 +1,7 @@ - net8.0;net9.0 + net8.0;net9.0;net10.0 false latest enable @@ -17,7 +17,7 @@ - + diff --git a/MPF.Frontend.Test/Tools/ProtectionToolTests.cs b/MPF.Frontend.Test/Tools/ProtectionToolTests.cs index e532d98a..2cb142d5 100644 --- a/MPF.Frontend.Test/Tools/ProtectionToolTests.cs +++ b/MPF.Frontend.Test/Tools/ProtectionToolTests.cs @@ -775,7 +775,7 @@ namespace MPF.Frontend.Test.Tools string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal(protections[0], sanitized); } - + [Fact] public void SanitizeFoundProtections_StarForce_Keyless() { diff --git a/MPF.Frontend/DumpEnvironment.cs b/MPF.Frontend/DumpEnvironment.cs index 106e4a03..d35dc347 100644 --- a/MPF.Frontend/DumpEnvironment.cs +++ b/MPF.Frontend/DumpEnvironment.cs @@ -288,7 +288,7 @@ namespace MPF.Frontend /// /// MediaType value to check /// True if the media has variable dumping speeds, false otherwise - public bool DoesSupportDriveSpeed(MediaType? mediaType) + public static bool DoesSupportDriveSpeed(MediaType? mediaType) { return mediaType switch { @@ -486,7 +486,11 @@ namespace MPF.Frontend if (outputFilename.EndsWith("_logs.zip", StringComparison.OrdinalIgnoreCase)) { int zipSuffixIndex = outputFilename.LastIndexOf("_logs.zip", StringComparison.OrdinalIgnoreCase); +#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER + outputFilename = outputFilename[..zipSuffixIndex] + ".tmp"; +#else outputFilename = outputFilename.Substring(0, zipSuffixIndex) + ".tmp"; +#endif } // Determine the media type from the processor @@ -818,7 +822,11 @@ namespace MPF.Frontend { string scanPath = key; if (hideDriveLetters) - scanPath = Path.DirectorySeparatorChar + key.Substring((Path.GetPathRoot(key) ?? String.Empty).Length); +#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER + scanPath = Path.DirectorySeparatorChar + key[(Path.GetPathRoot(key) ?? string.Empty).Length..]; +#else + scanPath = Path.DirectorySeparatorChar + key.Substring((Path.GetPathRoot(key) ?? string.Empty).Length); +#endif List? scanResult = info.CopyProtection.FullProtections[key]; diff --git a/MPF.Frontend/MPF.Frontend.csproj b/MPF.Frontend/MPF.Frontend.csproj index 884875f3..a271500f 100644 --- a/MPF.Frontend/MPF.Frontend.csproj +++ b/MPF.Frontend/MPF.Frontend.csproj @@ -2,7 +2,7 @@ - net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0 + net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0 false false latest @@ -31,14 +31,14 @@ - - + + - - + + diff --git a/MPF.Frontend/Options.cs b/MPF.Frontend/Options.cs index 616bf2f9..d01b4b14 100644 --- a/MPF.Frontend/Options.cs +++ b/MPF.Frontend/Options.cs @@ -19,7 +19,7 @@ namespace MPF.Frontend /// /// Default Aaru path /// - private string DefaultAaruPath + private static string DefaultAaruPath { get { @@ -41,7 +41,7 @@ namespace MPF.Frontend /// /// Default DiscImageCreator path /// - private string DefaultDiscImageCreatorPath + private static string DefaultDiscImageCreatorPath { get { @@ -63,7 +63,7 @@ namespace MPF.Frontend /// /// Default Redumper path /// - private string DefaultRedumperPath + private static string DefaultRedumperPath { get { diff --git a/MPF.Frontend/Tools/SubmissionGenerator.cs b/MPF.Frontend/Tools/SubmissionGenerator.cs index d363a810..b601adc0 100644 --- a/MPF.Frontend/Tools/SubmissionGenerator.cs +++ b/MPF.Frontend/Tools/SubmissionGenerator.cs @@ -60,7 +60,11 @@ namespace MPF.Frontend.Tools if (outputFilename.EndsWith("_logs.zip", StringComparison.OrdinalIgnoreCase)) { int zipSuffixIndex = outputFilename.LastIndexOf("_logs.zip", StringComparison.OrdinalIgnoreCase); +#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER + outputFilename = outputFilename[..zipSuffixIndex] + ".tmp"; +#else outputFilename = outputFilename.Substring(0, zipSuffixIndex) + ".tmp"; +#endif } // Check that all of the relevant files are there diff --git a/MPF.Frontend/ViewModels/MainViewModel.cs b/MPF.Frontend/ViewModels/MainViewModel.cs index 0d72adde..54e1eaec 100644 --- a/MPF.Frontend/ViewModels/MainViewModel.cs +++ b/MPF.Frontend/ViewModels/MainViewModel.cs @@ -1359,7 +1359,7 @@ namespace MPF.Frontend.ViewModels StartStopButtonEnabled = result && ShouldEnableDumpingButton(); // If we're in a type that doesn't support drive speeds - DriveSpeedComboBoxEnabled = _environment.DoesSupportDriveSpeed(CurrentMediaType); + DriveSpeedComboBoxEnabled = DumpEnvironment.DoesSupportDriveSpeed(CurrentMediaType); // If input params are enabled, generate the full parameters from the environment if (ParametersCheckBoxEnabled) diff --git a/MPF.Processors.Test/MPF.Processors.Test.csproj b/MPF.Processors.Test/MPF.Processors.Test.csproj index 7bf13908..4844938d 100644 --- a/MPF.Processors.Test/MPF.Processors.Test.csproj +++ b/MPF.Processors.Test/MPF.Processors.Test.csproj @@ -1,7 +1,7 @@ - net8.0;net9.0 + net8.0;net9.0;net10.0 false latest enable @@ -27,7 +27,7 @@ - + diff --git a/MPF.Processors/DiscImageCreator.cs b/MPF.Processors/DiscImageCreator.cs index 9ab8dfa3..84e59302 100644 --- a/MPF.Processors/DiscImageCreator.cs +++ b/MPF.Processors/DiscImageCreator.cs @@ -2334,10 +2334,9 @@ namespace MPF.Processors offsets = temp; #else - offsets = offsets + offsets = [.. offsets .FindAll(s => !string.IsNullOrEmpty(s)) - .Distinct() - .ToList(); + .Distinct()]; #endif // Now that we're at the offsets, attempt to get the sample offset diff --git a/MPF.Processors/MPF.Processors.csproj b/MPF.Processors/MPF.Processors.csproj index aa872e71..18030da8 100644 --- a/MPF.Processors/MPF.Processors.csproj +++ b/MPF.Processors/MPF.Processors.csproj @@ -2,7 +2,7 @@ - net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0 + net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0 false false true @@ -13,7 +13,6 @@ snupkg true 3.5.0 - NU5104 Matt Nadareski;ReignStumble;Jakz @@ -33,12 +32,12 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/MPF.UI/App.xaml.cs b/MPF.UI/App.xaml.cs index 8c962c35..078ddc3e 100644 --- a/MPF.UI/App.xaml.cs +++ b/MPF.UI/App.xaml.cs @@ -301,7 +301,7 @@ namespace MPF.UI "; - #endregion + #endregion public App() { diff --git a/MPF.UI/External/WPFCustomMessageBox/CustomMessageBox.cs b/MPF.UI/External/WPFCustomMessageBox/CustomMessageBox.cs index 77331a9b..38c88b74 100644 --- a/MPF.UI/External/WPFCustomMessageBox/CustomMessageBox.cs +++ b/MPF.UI/External/WPFCustomMessageBox/CustomMessageBox.cs @@ -16,7 +16,7 @@ namespace WPFCustomMessageBox { /// /// Global parameter to enable (true) or disable (false) the removal of the title bar icon. - /// If you are using a custom window style, the icon removal may cause issues like displaying two title bar (the default windows one and the custom one). + /// If you are using a custom window style, the icon removal may cause issues like displaying two title bar (the default windows one and the custom one). /// private static readonly bool RemoveTitleBarIcon = true; @@ -99,14 +99,13 @@ namespace WPFCustomMessageBox /// A System.Windows.MessageBoxResult value that specifies which message box button is clicked by the user. public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, int? timeout = null, MessageBoxResult timeoutResult = MessageBoxResult.None) { - switch (button) + return button switch { - case MessageBoxButton.YesNo: - case MessageBoxButton.YesNoCancel: - return ShowYesNoMessage(null, messageBoxText, caption, null, null, null, null, timeout, timeoutResult); - default: - return ShowOKMessage(null, messageBoxText, caption, null, null, null, timeout, timeoutResult); - } + MessageBoxButton.YesNo + or MessageBoxButton.YesNoCancel => ShowYesNoMessage(null, messageBoxText, caption, null, null, null, null, timeout, timeoutResult), + + _ => ShowOKMessage(null, messageBoxText, caption, null, null, null, timeout, timeoutResult), + }; } /// @@ -124,14 +123,13 @@ namespace WPFCustomMessageBox /// A System.Windows.MessageBoxResult value that specifies which message box button is clicked by the user. public static MessageBoxResult Show(Window owner, string messageBoxText, string caption, MessageBoxButton button, int? timeout = null, MessageBoxResult timeoutResult = MessageBoxResult.None) { - switch (button) + return button switch { - case MessageBoxButton.YesNo: - case MessageBoxButton.YesNoCancel: - return ShowYesNoMessage(owner, messageBoxText, caption, null, null, null, null, timeout, timeoutResult); - default: - return ShowOKMessage(owner, messageBoxText, caption, null, null, null, timeout, timeoutResult); - } + MessageBoxButton.YesNo + or MessageBoxButton.YesNoCancel => ShowYesNoMessage(owner, messageBoxText, caption, null, null, null, null, timeout, timeoutResult), + + _ => ShowOKMessage(owner, messageBoxText, caption, null, null, null, timeout, timeoutResult), + }; } /// @@ -149,14 +147,13 @@ namespace WPFCustomMessageBox /// A System.Windows.MessageBoxResult value that specifies which message box button is clicked by the user. public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, int? timeout = null, MessageBoxResult timeoutResult = MessageBoxResult.None) { - switch (button) + return button switch { - case MessageBoxButton.YesNo: - case MessageBoxButton.YesNoCancel: - return ShowYesNoMessage(null, messageBoxText, caption, null, null, null, icon, timeout, timeoutResult); - default: - return ShowOKMessage(null, messageBoxText, caption, null, null, icon, timeout, timeoutResult); - } + MessageBoxButton.YesNo + or MessageBoxButton.YesNoCancel => ShowYesNoMessage(null, messageBoxText, caption, null, null, null, icon, timeout, timeoutResult), + + _ => ShowOKMessage(null, messageBoxText, caption, null, null, icon, timeout, timeoutResult), + }; } /// @@ -175,14 +172,13 @@ namespace WPFCustomMessageBox /// A System.Windows.MessageBoxResult value that specifies which message box button is clicked by the user. public static MessageBoxResult Show(Window owner, string? messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, int? timeout = null, MessageBoxResult timeoutResult = MessageBoxResult.None) { - switch (button) + return button switch { - case MessageBoxButton.YesNo: - case MessageBoxButton.YesNoCancel: - return ShowYesNoMessage(owner, messageBoxText, caption, null, null, null, icon, timeout, timeoutResult); - default: - return ShowOKMessage(owner, messageBoxText, caption, null, null, icon, timeout, timeoutResult); - } + MessageBoxButton.YesNo + or MessageBoxButton.YesNoCancel => ShowYesNoMessage(owner, messageBoxText, caption, null, null, null, icon, timeout, timeoutResult), + + _ => ShowOKMessage(owner, messageBoxText, caption, null, null, icon, timeout, timeoutResult), + }; } /// @@ -574,7 +570,8 @@ namespace WPFCustomMessageBox //System.Threading.Timer timer = null; //timer = new System.Threading.Timer(s => { msg.Close(); timer.Dispose(); }, null, timeout.Value, System.Threading.Timeout.Infinite); var timer = new System.Timers.Timer(timeout.Value) { AutoReset = false }; - timer.Elapsed += delegate { + timer.Elapsed += delegate + { Application.Current.Dispatcher.Invoke(new Action(() => { dialog.Result = timeoutResult; diff --git a/MPF.UI/External/WPFCustomMessageBox/CustomMessageBoxWindow.xaml.cs b/MPF.UI/External/WPFCustomMessageBox/CustomMessageBoxWindow.xaml.cs index 6dda899c..a4bdf01e 100644 --- a/MPF.UI/External/WPFCustomMessageBox/CustomMessageBoxWindow.xaml.cs +++ b/MPF.UI/External/WPFCustomMessageBox/CustomMessageBoxWindow.xaml.cs @@ -1,11 +1,7 @@ using System; using System.Drawing; using System.Windows; -using System.Windows.Controls; using System.Windows.Input; -using MPF.UI; - -#pragma warning disable IDE1006 // Naming Styles namespace WPFCustomMessageBox { @@ -201,26 +197,20 @@ namespace WPFCustomMessageBox private void DisplayImage(MessageBoxImage image) { - Icon icon; - - switch (image) + Icon icon = image switch { - case MessageBoxImage.Exclamation: // Enumeration value 48 - also covers "Warning" - icon = SystemIcons.Exclamation; - break; - case MessageBoxImage.Error: // Enumeration value 16, also covers "Hand" and "Stop" - icon = SystemIcons.Hand; - break; - case MessageBoxImage.Information: // Enumeration value 64 - also covers "Asterisk" - icon = SystemIcons.Information; - break; - case MessageBoxImage.Question: - icon = SystemIcons.Question; - break; - default: - icon = SystemIcons.Information; - break; - } + // Enumeration value 48 - also covers "Warning" + MessageBoxImage.Exclamation => SystemIcons.Exclamation, + + // Enumeration value 16, also covers "Hand" and "Stop" + MessageBoxImage.Error => SystemIcons.Hand, + + // Enumeration value 64 - also covers "Asterisk" + MessageBoxImage.Information => SystemIcons.Information, + + MessageBoxImage.Question => SystemIcons.Question, + _ => SystemIcons.Information, + }; Image_MessageBox!.Source = icon.ToImageSource(); Image_MessageBox.Visibility = Visibility.Visible; diff --git a/MPF.UI/External/WPFCustomMessageBox/Util.cs b/MPF.UI/External/WPFCustomMessageBox/Util.cs index f224b7d2..bc9b3d59 100644 --- a/MPF.UI/External/WPFCustomMessageBox/Util.cs +++ b/MPF.UI/External/WPFCustomMessageBox/Util.cs @@ -51,8 +51,8 @@ namespace WPFCustomMessageBox } /// - /// Keyboard Accellerators are used in Windows to allow easy shortcuts to controls like Buttons and - /// MenuItems. These allow users to press the Alt key, and a shortcut key will be highlighted on the + /// Keyboard Accellerators are used in Windows to allow easy shortcuts to controls like Buttons and + /// MenuItems. These allow users to press the Alt key, and a shortcut key will be highlighted on the /// control. If the user presses that key, that control will be activated. /// This method checks a string if it contains a keyboard accellerator. If it doesn't, it adds one to the /// beginning of the string. If there are two strings with the same accellerator, Windows handles it. diff --git a/MPF.UI/MPF.UI.csproj b/MPF.UI/MPF.UI.csproj index 230af38c..f46c4a6e 100644 --- a/MPF.UI/MPF.UI.csproj +++ b/MPF.UI/MPF.UI.csproj @@ -2,7 +2,7 @@ - net40;net452;net462;net472;net48;netcoreapp3.1;net5.0-windows;net6.0-windows;net7.0-windows;net8.0-windows;net9.0-windows + net40;net452;net462;net472;net48;netcoreapp3.1;net5.0-windows;net6.0-windows;net7.0-windows;net8.0-windows;net9.0-windows;net10.0-windows win-x86;win-x64 WinExe Images\Icon.ico @@ -39,7 +39,7 @@ false false - + false true false @@ -70,7 +70,7 @@ - + diff --git a/MPF.UI/Windows/MainWindow.xaml.cs b/MPF.UI/Windows/MainWindow.xaml.cs index 9ce0cd39..cf9e2d37 100644 --- a/MPF.UI/Windows/MainWindow.xaml.cs +++ b/MPF.UI/Windows/MainWindow.xaml.cs @@ -560,8 +560,8 @@ namespace MPF.UI.Windows color = color.Substring(1); #endif - if (color.Length != 6) - return false; + if (color.Length != 6) + return false; for (int i = 0; i < color.Length; i++) { diff --git a/README.md b/README.md index 0f835ce5..42f426f9 100644 --- a/README.md +++ b/README.md @@ -48,31 +48,31 @@ MPF.Check is a commandline-only program that allows users to generate submission MPF.UI, MPF.CLI, and MPF.Check have the same system requirements for running, with the exception that MPF.UI is Windows-only. -- [Supported OS versions for .NET 9](https://github.com/dotnet/core/blob/main/release-notes/9.0/supported-os.md) - - Requires [.NET 9.0 Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) if built without bundled runtime +- [Supported OS versions for .NET 10](https://github.com/dotnet/core/blob/main/release-notes/10.0/supported-os.md) + - Requires [.NET 10.0 Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/10.0) if built without bundled runtime Ensure that your operating system and runtimes are as up-to-date as possible, since some features may rely on those updates. ## Build Instructions -To build for .NET 9.0, ensure that the [.NET 9.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) (or later) is installed and included in your `PATH`. Then, run the following commands from command prompt, Powershell, Terminal, or shell: +To build for .NET 10.0, ensure that the [.NET 10.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/10.0) (or later) is installed and included in your `PATH`. Then, run the following commands from command prompt, Powershell, Terminal, or shell: **MPF.UI (Windows only):** ```bash -dotnet build MPF.UI/MPF.UI.csproj --framework net9.0-windows --runtime [win-x86|win-x64] +dotnet build MPF.UI/MPF.UI.csproj --framework net10.0-windows --runtime [win-x86|win-x64] ``` **MPF.CLI (Windows, OSX, Linux):** ```bash -dotnet build MPF.CLI/MPF.CLI.csproj --framework net9.0 --runtime [win-x86|win-x64|win-arm64|linux-x64|linux-arm64|osx-x64|osx-arm64] +dotnet build MPF.CLI/MPF.CLI.csproj --framework net10.0 --runtime [win-x86|win-x64|win-arm64|linux-x64|linux-arm64|osx-x64|osx-arm64] ``` **MPF.Check (Windows, OSX, Linux):** ```bash -dotnet build MPF.Check/MPF.Check.csproj --framework net9.0 --runtime [win-x86|win-x64|win-arm64|linux-x64|linux-arm64|osx-x64|osx-arm64] +dotnet build MPF.Check/MPF.Check.csproj --framework net10.0 --runtime [win-x86|win-x64|win-arm64|linux-x64|linux-arm64|osx-x64|osx-arm64] ``` Choose one of `win-x86`, `win-x64`, `win-arm64`, `linux-x64`, `linux-arm64`, `osx-x64`, or `osx-arm64` depending on the machine you are targeting. diff --git a/publish-nix.sh b/publish-nix.sh index 532f7183..e66d269d 100755 --- a/publish-nix.sh +++ b/publish-nix.sh @@ -1,7 +1,7 @@ #!/bin/bash # This batch file assumes the following: -# - .NET 9.0 (or newer) SDK is installed and in PATH +# - .NET 10.0 (or newer) SDK is installed and in PATH # - zip is installed and in PATH # - wget is installed an in PATH # - Git is installed and in PATH @@ -57,21 +57,21 @@ echo " No archive (-a) $NO_ARCHIVE" echo " " # Create the build matrix arrays -UI_FRAMEWORKS=("net9.0-windows") +UI_FRAMEWORKS=("net10.0-windows") UI_RUNTIMES=("win-x86" "win-x64") -CHECK_FRAMEWORKS=("net9.0") +CHECK_FRAMEWORKS=("net10.0") CHECK_RUNTIMES=("win-x86" "win-x64" "win-arm64" "linux-x64" "linux-arm64" "osx-x64" "osx-arm64") # Use expanded framework lists, if requested if [ $USE_ALL = true ]; then - UI_FRAMEWORKS=("net40" "net452" "net462" "net472" "net48" "netcoreapp3.1" "net5.0-windows" "net6.0-windows" "net7.0-windows" "net8.0-windows" "net9.0-windows") - CHECK_FRAMEWORKS=("net20" "net35" "net40" "net452" "net462" "net472" "net48" "netcoreapp3.1" "net5.0" "net6.0" "net7.0" "net8.0" "net9.0") + UI_FRAMEWORKS=("net40" "net452" "net462" "net472" "net48" "netcoreapp3.1" "net5.0-windows" "net6.0-windows" "net7.0-windows" "net8.0-windows" "net9.0-windows" "net10.0-windows") + CHECK_FRAMEWORKS=("net20" "net35" "net40" "net452" "net462" "net472" "net48" "netcoreapp3.1" "net5.0" "net6.0" "net7.0" "net8.0" "net9.0" "net10.0") fi # Create the filter arrays -SINGLE_FILE_CAPABLE=("net5.0" "net5.0-windows" "net6.0" "net6.0-windows" "net7.0" "net7.0-windows" "net8.0" "net8.0-windows" "net9.0" "net9.0-windows") -VALID_APPLE_FRAMEWORKS=("net6.0" "net7.0" "net8.0" "net9.0") -VALID_CROSS_PLATFORM_FRAMEWORKS=("netcoreapp3.1" "net5.0" "net6.0" "net7.0" "net8.0" "net9.0") +SINGLE_FILE_CAPABLE=("net5.0" "net5.0-windows" "net6.0" "net6.0-windows" "net7.0" "net7.0-windows" "net8.0" "net8.0-windows" "net9.0" "net9.0-windows" "net10.0" "net10.0-windows") +VALID_APPLE_FRAMEWORKS=("net6.0" "net7.0" "net8.0" "net9.0" "net10.0") +VALID_CROSS_PLATFORM_FRAMEWORKS=("netcoreapp3.1" "net5.0" "net6.0" "net7.0" "net8.0" "net9.0" "net10.0") VALID_CROSS_PLATFORM_RUNTIMES=("win-arm64" "linux-x64" "linux-arm64" "osx-x64" "osx-arm64") # Download programs step diff --git a/publish-win.ps1 b/publish-win.ps1 index 34fb6c68..5bb364eb 100644 --- a/publish-win.ps1 +++ b/publish-win.ps1 @@ -1,5 +1,5 @@ # This batch file assumes the following: -# - .NET 9.0 (or newer) SDK is installed and in PATH +# - .NET 10.0 (or newer) SDK is installed and in PATH # - 7-zip commandline (7z.exe) is installed and in PATH # - Git for Windows is installed and in PATH # - The relevant commandline programs are already downloaded @@ -47,21 +47,21 @@ Write-Host " No archive (-NoArchive) $NO_ARCHIVE" Write-Host " " # Create the build matrix arrays -$UI_FRAMEWORKS = @('net9.0-windows') +$UI_FRAMEWORKS = @('net10.0-windows') $UI_RUNTIMES = @('win-x86', 'win-x64') -$CHECK_FRAMEWORKS = @('net9.0') +$CHECK_FRAMEWORKS = @('net10.0') $CHECK_RUNTIMES = @('win-x86', 'win-x64', 'win-arm64', 'linux-x64', 'linux-arm64', 'osx-x64', 'osx-arm64') # Use expanded framework lists, if requested if ($USE_ALL.IsPresent) { - $UI_FRAMEWORKS = @('net40', 'net452', 'net462', 'net472', 'net48', 'netcoreapp3.1', 'net5.0-windows', 'net6.0-windows', 'net7.0-windows', 'net8.0-windows', 'net9.0-windows') - $CHECK_FRAMEWORKS = @('net20', 'net35', 'net40', 'net452', 'net462', 'net472', 'net48', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0') + $UI_FRAMEWORKS = @('net40', 'net452', 'net462', 'net472', 'net48', 'netcoreapp3.1', 'net5.0-windows', 'net6.0-windows', 'net7.0-windows', 'net8.0-windows', 'net9.0-windows', 'net10.0-windows') + $CHECK_FRAMEWORKS = @('net20', 'net35', 'net40', 'net452', 'net462', 'net472', 'net48', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0', 'net10.0') } # Create the filter arrays -$SINGLE_FILE_CAPABLE = @('net5.0', 'net5.0-windows', 'net6.0', 'net6.0-windows', 'net7.0', 'net7.0-windows', 'net8.0', 'net8.0-windows', 'net9.0', 'net9.0-windows') -$VALID_APPLE_FRAMEWORKS = @('net6.0', 'net7.0', 'net8.0', 'net9.0') -$VALID_CROSS_PLATFORM_FRAMEWORKS = @('netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0') +$SINGLE_FILE_CAPABLE = @('net5.0', 'net5.0-windows', 'net6.0', 'net6.0-windows', 'net7.0', 'net7.0-windows', 'net8.0', 'net8.0-windows', 'net9.0', 'net9.0-windows', 'net10.0', 'net10.0-windows') +$VALID_APPLE_FRAMEWORKS = @('net6.0', 'net7.0', 'net8.0', 'net9.0', 'net10.0') +$VALID_CROSS_PLATFORM_FRAMEWORKS = @('netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0', 'net10.0') $VALID_CROSS_PLATFORM_RUNTIMES = @('win-arm64', 'linux-x64', 'linux-arm64', 'osx-x64', 'osx-arm64') # Download programs step