From 4702a332a51dcf554fa2196eb81ce69859185cbd Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Tue, 12 Nov 2024 15:43:35 -0800 Subject: [PATCH 1/3] feat: Updates to .NET 9 --- .config/dotnet-tools.json | 2 +- .github/workflows/build-test.yml | 8 +++---- .github/workflows/create-release.yml | 4 ++-- Directory.Build.props | 8 +++---- Projects/Server.Tests/Server.Tests.csproj | 2 +- Projects/Server/Client/ArtData.cs | 2 +- Projects/Server/Client/UOClient.cs | 2 +- Projects/Server/Items/Item.cs | 2 +- Projects/Server/Localization/Localization.cs | 4 ++-- Projects/Server/Network/NetState/NetState.cs | 2 +- Projects/Server/Serial.cs | 2 +- Projects/Server/Server.csproj | 6 ++--- Projects/Server/Text/StringHelpers.cs | 4 ++-- Projects/Server/TileMatrix/TileMatrix.cs | 4 ++-- Projects/Server/TileMatrix/TileMatrixPatch.cs | 4 ++-- Projects/Server/Utilities/HashUtility.cs | 2 +- .../UOContent.Tests/UOContent.Tests.csproj | 2 +- .../Special Systems/Engines/TestCenter.cs | 2 +- Projects/UOContent/UOContent.csproj | 4 ++-- azure-pipelines.yml | 24 +++++++++---------- global.json | 2 +- version.json | 2 +- 22 files changed, 46 insertions(+), 48 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index d78909cdbc..02001f4618 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "modernuoschemagenerator": { - "version": "2.11.3", + "version": "2.12.9", "commands": [ "ModernUOSchemaGenerator" ] diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 6030049c28..cbc6c6a139 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -23,10 +23,10 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - - name: Setup .NET 8 + - name: Install .NET 9 uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + global-json-file: global.json - name: Install Prerequisites run: | brew update @@ -86,10 +86,10 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - - name: Setup .NET 8 + - name: Install .NET 9 uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + global-json-file: global.json - name: Build run: ./publish.cmd Release - name: Test diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index ca70b62fb7..0e8334e591 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -14,10 +14,10 @@ jobs: with: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - - name: Setup .NET 8 + - name: Install .NET 9 uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + global-json-file: global.json - name: Install NGBV uses: dotnet/nbgv@master id: nbgv diff --git a/Directory.Build.props b/Directory.Build.props index 68c23b16b0..738850042c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,7 +4,7 @@ Kamron Batman ModernUO 2019-2023 - net8.0 + net9.0 12 true true @@ -62,11 +62,11 @@ latest - - + + - 3.6.143 + 3.6.146 all diff --git a/Projects/Server.Tests/Server.Tests.csproj b/Projects/Server.Tests/Server.Tests.csproj index a798866ec6..13c30656aa 100644 --- a/Projects/Server.Tests/Server.Tests.csproj +++ b/Projects/Server.Tests/Server.Tests.csproj @@ -5,7 +5,7 @@ Server.Tests - + all diff --git a/Projects/Server/Client/ArtData.cs b/Projects/Server/Client/ArtData.cs index 5294500cef..ba6e4167a9 100644 --- a/Projects/Server/Client/ArtData.cs +++ b/Projects/Server/Client/ArtData.cs @@ -66,7 +66,7 @@ public Rectangle2D GetStaticBounds(int index) Span buffer = stackalloc ushort[entry.Size / 2]; _dataStream.Seek(entry.Offset, SeekOrigin.Begin); - _dataStream.Read(MemoryMarshal.AsBytes(buffer)); + _ = _dataStream.Read(MemoryMarshal.AsBytes(buffer)); var width = buffer[2]; var height = buffer[3]; diff --git a/Projects/Server/Client/UOClient.cs b/Projects/Server/Client/UOClient.cs index 71d0d1d543..846f8908b1 100644 --- a/Projects/Server/Client/UOClient.cs +++ b/Projects/Server/Client/UOClient.cs @@ -95,7 +95,7 @@ private static ClientVersion DetectClassicClient() { using FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); var buffer = GC.AllocateUninitializedArray((int)fs.Length, true); - fs.Read(buffer); + _ = fs.Read(buffer); // VS_VERSION_INFO (unicode) Span vsVersionInfo = stackalloc byte[] { diff --git a/Projects/Server/Items/Item.cs b/Projects/Server/Items/Item.cs index aeab60811f..e9be609cc4 100644 --- a/Projects/Server/Items/Item.cs +++ b/Projects/Server/Items/Item.cs @@ -3077,7 +3077,7 @@ public virtual void SendOPLPacketTo(NetState ns) public virtual void SendWorldPacketTo(NetState ns, ReadOnlySpan world = default) { - if (world != null) + if (world != ReadOnlySpan.Empty) { ns?.Send(world); return; diff --git a/Projects/Server/Localization/Localization.cs b/Projects/Server/Localization/Localization.cs index a92d69f249..0e08c1e0cb 100644 --- a/Projects/Server/Localization/Localization.cs +++ b/Projects/Server/Localization/Localization.cs @@ -98,7 +98,7 @@ private static Dictionary LoadClilocs(string lang, strin { using var fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read); Span header = stackalloc byte[6]; - fs.Read(header); + _ = fs.Read(header); byte[] data; BufferReader br; @@ -120,7 +120,7 @@ private static Dictionary LoadClilocs(string lang, strin else { data = GC.AllocateUninitializedArray((int)fs.Length - 6); - fs.Read(data); + _ = fs.Read(data); br = new BufferReader(data); } diff --git a/Projects/Server/Network/NetState/NetState.cs b/Projects/Server/Network/NetState/NetState.cs index 172be42aaf..1370709737 100755 --- a/Projects/Server/Network/NetState/NetState.cs +++ b/Projects/Server/Network/NetState/NetState.cs @@ -449,7 +449,7 @@ public bool GetSendBuffer(out Span buffer) public void Send(ReadOnlySpan span) { - if (span == null || this.CannotSendPackets()) + if (span == ReadOnlySpan.Empty || this.CannotSendPackets()) { return; } diff --git a/Projects/Server/Serial.cs b/Projects/Server/Serial.cs index cb96f9e968..83f537f16a 100644 --- a/Projects/Server/Serial.cs +++ b/Projects/Server/Serial.cs @@ -138,7 +138,7 @@ public string ToString(string format, IFormatProvider formatProvider) public bool TryFormat( Span destination, out int charsWritten, ReadOnlySpan format, IFormatProvider provider - ) => format != null + ) => format != ReadOnlySpan.Empty ? Value.TryFormat(destination, out charsWritten, format, provider) : destination.TryWrite(provider, $"0x{Value:X8}", out charsWritten); diff --git a/Projects/Server/Server.csproj b/Projects/Server/Server.csproj index a47b3fb1a6..d9c38c4d79 100644 --- a/Projects/Server/Server.csproj +++ b/Projects/Server/Server.csproj @@ -35,11 +35,11 @@ - - + + - + diff --git a/Projects/Server/Text/StringHelpers.cs b/Projects/Server/Text/StringHelpers.cs index c84364c38e..3304587272 100644 --- a/Projects/Server/Text/StringHelpers.cs +++ b/Projects/Server/Text/StringHelpers.cs @@ -37,7 +37,7 @@ out int size ) { size = 0; - if (a == null || a.Length == 0) + if (a == ReadOnlySpan.Empty || a.Length == 0) { return; } @@ -72,7 +72,7 @@ out int size [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string Remove(this ReadOnlySpan a, ReadOnlySpan b, StringComparison comparison) { - if (a == null) + if (a == ReadOnlySpan.Empty) { return null; } diff --git a/Projects/Server/TileMatrix/TileMatrix.cs b/Projects/Server/TileMatrix/TileMatrix.cs index 635af16e5a..3a6a7b958b 100644 --- a/Projects/Server/TileMatrix/TileMatrix.cs +++ b/Projects/Server/TileMatrix/TileMatrix.cs @@ -338,7 +338,7 @@ private unsafe StaticTile[][][] ReadStaticBlock(int x, int y) fixed (StaticTile* pTiles = staTiles) { - DataStream.Read(new Span(pTiles, length)); + _ = DataStream.Read(new Span(pTiles, length)); if (m_Lists == null) { @@ -423,7 +423,7 @@ private unsafe LandTile[] ReadLandBlock(int x, int y) fixed (LandTile* pTiles = tiles) { - MapStream.Read(new Span(pTiles, 192)); + _ = MapStream.Read(new Span(pTiles, 192)); } return tiles; diff --git a/Projects/Server/TileMatrix/TileMatrixPatch.cs b/Projects/Server/TileMatrix/TileMatrixPatch.cs index 415d542f76..623da9d416 100644 --- a/Projects/Server/TileMatrix/TileMatrixPatch.cs +++ b/Projects/Server/TileMatrix/TileMatrixPatch.cs @@ -89,7 +89,7 @@ private unsafe int PatchLand(TileMatrix matrix, string dataPath, string indexPat var tiles = new LandTile[64]; fixed (LandTile* pTiles = tiles) { - fsData.Read(new Span(pTiles, 192)); + _ = fsData.Read(new Span(pTiles, 192)); } matrix.SetLandBlock(x, y, tiles); @@ -149,7 +149,7 @@ private unsafe int PatchStatics(TileMatrix matrix, string dataPath, string index fixed (StaticTile* pTiles = staTiles) { - fsData.Read(new Span(pTiles, length)); + _ = fsData.Read(new Span(pTiles, length)); StaticTile* pCur = pTiles, pEnd = pTiles + tileCount; diff --git a/Projects/Server/Utilities/HashUtility.cs b/Projects/Server/Utilities/HashUtility.cs index 8758466a69..9f4b6c58cf 100644 --- a/Projects/Server/Utilities/HashUtility.cs +++ b/Projects/Server/Utilities/HashUtility.cs @@ -52,7 +52,7 @@ public static ulong ComputeHash64(ReadOnlySpan str) public static uint ComputeHash32(ReadOnlySpan str) { - if (str == null) + if (str == ReadOnlySpan.Empty) { return 0; } diff --git a/Projects/UOContent.Tests/UOContent.Tests.csproj b/Projects/UOContent.Tests/UOContent.Tests.csproj index b2cc0b6b9c..ce902d2249 100644 --- a/Projects/UOContent.Tests/UOContent.Tests.csproj +++ b/Projects/UOContent.Tests/UOContent.Tests.csproj @@ -4,7 +4,7 @@ Debug;Release;Analyze - + all diff --git a/Projects/UOContent/Special Systems/Engines/TestCenter.cs b/Projects/UOContent/Special Systems/Engines/TestCenter.cs index ff66b155b3..23480d38bc 100644 --- a/Projects/UOContent/Special Systems/Engines/TestCenter.cs +++ b/Projects/UOContent/Special Systems/Engines/TestCenter.cs @@ -47,7 +47,7 @@ private static void EventSink_Speech(SpeechEventArgs args) var name = tokenizer.MoveNext() ? tokenizer.Current : null; var valueStr = tokenizer.MoveNext() ? tokenizer.Current : null; - if (valueStr == null) + if (valueStr == ReadOnlySpan.Empty) { return; } diff --git a/Projects/UOContent/UOContent.csproj b/Projects/UOContent/UOContent.csproj index 5f07339eb2..b04ff33e42 100644 --- a/Projects/UOContent/UOContent.csproj +++ b/Projects/UOContent/UOContent.csproj @@ -39,7 +39,7 @@ - + @@ -47,7 +47,7 @@ - + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 20dd39c712..798907fc1b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,7 +5,6 @@ trigger: variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1 jobs: - job: BuildWindows @@ -14,15 +13,14 @@ jobs: vmImage: 'windows-latest' steps: - - task: UseDotNet@2 - displayName: 'Install .NET 8' - inputs: - packageType: sdk - version: '8.0.x' - - task: NuGetAuthenticate@1 - - script: ./publish.cmd Release - displayName: 'Build' - - powershell: ./.github/porcelain.ps1 - displayName: Migration Changes - - script: dotnet test --no-restore - displayName: 'Test' + - task: UseDotNet@2 + displayName: 'Install .NET 9' + inputs: + useGlobalJson: true + - task: NuGetAuthenticate@1 + - script: ./publish.cmd Release + displayName: 'Build' + - powershell: ./.github/porcelain.ps1 + displayName: Migration Changes + - script: dotnet test --no-restore + displayName: 'Test' diff --git a/global.json b/global.json index f6ba4b7d13..1739913f7d 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.0", + "version": "9.0.101", "rollForward": "latestMajor", "allowPrerelease": false } diff --git a/version.json b/version.json index 7870d130e7..6221a7f263 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "0.13.6" + "version": "0.13.7" } From 91117d4519a83d40a5997263658dd29e32ea1642 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sun, 8 Dec 2024 09:46:56 -0800 Subject: [PATCH 2/3] Updates readme --- README.md | 16 ++++++++-------- docs/starting-server.md | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 348dae4ac9..c04c172794 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,8 @@ ModernUO [![Discord](https://img.shields.io/discord/751317910504603701?logo=disc [![Ubuntu 20+ LTS](https://img.shields.io/badge/-22LTS-E95420?logo=ubuntu&logoColor=E95420&labelColor=222222)](https://ubuntu.com/download/server)
[![Alpine 3.18+](https://img.shields.io/badge/-3.18-0D597F?logo=alpinelinux&logoColor=0D597F&labelColor=222222)](https://alpinelinux.org/downloads/) -[![Fedora 39+](https://img.shields.io/badge/-39-51a2da?logo=fedora&logoColor=51a2da&labelColor=222222)](https://getfedora.org/en/server/download/) -[![RedHat 8/9](https://img.shields.io/badge/-8-BE0000?logo=redhat&logoColor=BE0000&labelColor=222222)](https://access.redhat.com/downloads) +[![Fedora 40+](https://img.shields.io/badge/-40-51a2da?logo=fedora&logoColor=51a2da&labelColor=222222)](https://getfedora.org/en/server/download/) +[![RedHat 8+](https://img.shields.io/badge/-8-BE0000?logo=redhat&logoColor=BE0000&labelColor=222222)](https://access.redhat.com/downloads) [![CentOS 9](https://img.shields.io/badge/-9-262577?logo=centos&logoColor=white&labelColor=222222)](https://www.centos.org/download/) [![openSUSE 15+](https://img.shields.io/badge/-15-73BA25?logo=openSUSE&logoColor=73BA25&labelColor=222222)](https://get.opensuse.org/) [![SUSE Enterprise 12 SP2+](https://img.shields.io/badge/-12%20SP2-0C322C?logo=suse&logoColor=30BA78&labelColor=222222)](https://www.suse.com/download/sles/) @@ -31,25 +31,25 @@ ModernUO [![Discord](https://img.shields.io/discord/751317910504603701?logo=disc #### Required Frameworks ##### All Operating Systems -[![.NET](https://img.shields.io/badge/-8.0.8-5C2D91?logo=.NET&logoColor=white&labelColor=222222)](https://dotnet.microsoft.com/download/dotnet/8.0) +[![.NET](https://img.shields.io/badge/-9.0.0-5C2D91?logo=.NET&logoColor=white&labelColor=222222)](https://dotnet.microsoft.com/download/dotnet/9.0) ##### Windows [![VC++ Redistributable 17](https://img.shields.io/badge/-Redist%2017-00599C?logo=cplusplus&logoColor=white&labelColor=222222)](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022) #### Development [![git](https://img.shields.io/badge/-git-F05032?logo=git&logoColor=F05032&labelColor=222222)](https://git-scm.com/downloads) -[![.NET](https://img.shields.io/badge/-%208.0.401%20SDK-5C2D91?logo=.NET&logoColor=white&labelColor=222222)](https://dotnet.microsoft.com/download/dotnet/8.0) +[![.NET](https://img.shields.io/badge/-%209.0.101%20SDK-5C2D91?logo=.NET&logoColor=white&labelColor=222222)](https://dotnet.microsoft.com/download/dotnet/9.0) #### Supported IDEs -

Jetbrains Rider 2024.1+Jetbrains Rider 2024.3+spaceVSCodespaceVisual Studio 2022 v17.10+Visual Studio 2022 v17.12+

## Getting Started diff --git a/docs/starting-server.md b/docs/starting-server.md index 35c7a6830d..e0da2a6c24 100644 --- a/docs/starting-server.md +++ b/docs/starting-server.md @@ -18,7 +18,7 @@ Everything is run from the _Distribution_ folder. Using _terminal_, run: ```bash cd Distribution - dotnet run ModernUO.dll + dotnet ModernUO.dll ``` === "Game Files" @@ -27,4 +27,4 @@ Everything is run from the _Distribution_ folder. !!! Tip - Game files are not directly distributed in ModernUO, find the latest version to download these at [client download](https://uo.com/Client-Download/) \ No newline at end of file + Game files are not directly distributed in ModernUO, find the latest version to download these at [client download](https://uo.com/Client-Download/) From 8f9e91f35446b1cfbeaff3af3a093a528673dda6 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sun, 8 Dec 2024 10:08:52 -0800 Subject: [PATCH 3/3] Bumps serialization generator --- .config/dotnet-tools.json | 2 +- Projects/Server/Server.csproj | 2 +- Projects/UOContent/UOContent.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 02001f4618..2e2ca80318 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "modernuoschemagenerator": { - "version": "2.12.9", + "version": "2.12.10", "commands": [ "ModernUOSchemaGenerator" ] diff --git a/Projects/Server/Server.csproj b/Projects/Server/Server.csproj index d9c38c4d79..dd2ee185b5 100644 --- a/Projects/Server/Server.csproj +++ b/Projects/Server/Server.csproj @@ -39,7 +39,7 @@ - +
diff --git a/Projects/UOContent/UOContent.csproj b/Projects/UOContent/UOContent.csproj index b04ff33e42..e2e0bbc88f 100644 --- a/Projects/UOContent/UOContent.csproj +++ b/Projects/UOContent/UOContent.csproj @@ -47,7 +47,7 @@ - +