From 9b0bff238fd26feb69031fb145e40a70d1d87135 Mon Sep 17 00:00:00 2001 From: Hugues Valois Date: Tue, 12 Nov 2024 15:18:08 -0800 Subject: [PATCH] Upgrade to .NET 9. --- .github/workflows/build-and-test.yml | 2 +- src/Directory.Packages.props | 10 +++++----- .../Woohoo.Agi.Interpreter.UnitTest.csproj | 2 +- src/Woohoo.Agi.Interpreter/Interpreter/GameFolder.cs | 12 ++---------- .../Woohoo.Agi.Interpreter.csproj | 2 +- src/Woohoo.Agi.Player/GameZipArchive.cs | 2 +- src/Woohoo.Agi.Player/Woohoo.Agi.Player.csproj | 2 +- 7 files changed, 12 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 10cfbf8..3b0f818 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -18,7 +18,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.0.x' + dotnet-version: '9.0.x' - name: Clean run: dotnet clean ${{env.solutionFile}} --configuration Release && dotnet nuget locals all --clear - name: Build diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 3886ab0..2429630 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -5,11 +5,11 @@ - - - - - + + + + + diff --git a/src/Woohoo.Agi.Interpreter.UnitTest/Woohoo.Agi.Interpreter.UnitTest.csproj b/src/Woohoo.Agi.Interpreter.UnitTest/Woohoo.Agi.Interpreter.UnitTest.csproj index ef9a774..a50d60e 100644 --- a/src/Woohoo.Agi.Interpreter.UnitTest/Woohoo.Agi.Interpreter.UnitTest.csproj +++ b/src/Woohoo.Agi.Interpreter.UnitTest/Woohoo.Agi.Interpreter.UnitTest.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 false false enable diff --git a/src/Woohoo.Agi.Interpreter/Interpreter/GameFolder.cs b/src/Woohoo.Agi.Interpreter/Interpreter/GameFolder.cs index 09b9163..5d4f4c2 100644 --- a/src/Woohoo.Agi.Interpreter/Interpreter/GameFolder.cs +++ b/src/Woohoo.Agi.Interpreter/Interpreter/GameFolder.cs @@ -18,15 +18,7 @@ public GameFolder(string folderPath) public byte[] Read(string file) { - byte[] data; - - using (FileStream stream = new FileStream(Path.Combine(this.folderPath, file), FileMode.Open, FileAccess.Read, FileShare.Read)) - { - data = new byte[stream.Length]; - stream.Read(data, 0, data.Length); - } - - return data; + return File.ReadAllBytes(Path.Combine(this.folderPath, file)); } public bool Exists(string file) @@ -68,7 +60,7 @@ public string[] GetGameFiles() // Get the list of files to include foreach (string pattern in includePatterns) { - string[] files = Directory.GetFiles(this.folderPath, pattern); + string[] files = Directory.GetFiles(this.folderPath, pattern, SearchOption.TopDirectoryOnly); foreach (string file in files) { // File name only, no path diff --git a/src/Woohoo.Agi.Interpreter/Woohoo.Agi.Interpreter.csproj b/src/Woohoo.Agi.Interpreter/Woohoo.Agi.Interpreter.csproj index bca0d7b..022c11e 100644 --- a/src/Woohoo.Agi.Interpreter/Woohoo.Agi.Interpreter.csproj +++ b/src/Woohoo.Agi.Interpreter/Woohoo.Agi.Interpreter.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 false enable en diff --git a/src/Woohoo.Agi.Player/GameZipArchive.cs b/src/Woohoo.Agi.Player/GameZipArchive.cs index a5bc922..eba05f5 100644 --- a/src/Woohoo.Agi.Player/GameZipArchive.cs +++ b/src/Woohoo.Agi.Player/GameZipArchive.cs @@ -33,7 +33,7 @@ public byte[] Read(string file) using (Stream stream = this.zipFile.GetInputStream(entry)) { data = new byte[entry.Size]; - stream.Read(data, 0, data.Length); + stream.ReadExactly(data, 0, data.Length); } } } diff --git a/src/Woohoo.Agi.Player/Woohoo.Agi.Player.csproj b/src/Woohoo.Agi.Player/Woohoo.Agi.Player.csproj index b428ad2..165fea0 100644 --- a/src/Woohoo.Agi.Player/Woohoo.Agi.Player.csproj +++ b/src/Woohoo.Agi.Player/Woohoo.Agi.Player.csproj @@ -2,7 +2,7 @@ WinExe - net8.0 + net9.0 false x86;x64 SDL