From 0761450a8da6d3763d3f78fa02278c03b85029fe Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 15 Nov 2024 21:45:12 -0500 Subject: [PATCH] Update SabreTools libraries and add .NET 9 support (#1) * Update SabreTools libraries and add .NET 9 support * Update build script * Handle net9.0-specific complaints --- .vscode/tasks.json | 24 ++++++++++++++++++++++++ IRDKit/IRDKit.csproj | 8 ++++---- IRDKit/Program.cs | 19 +++---------------- LibIRD/LibIRD.csproj | 18 +++++++++++++----- publish-irdkit.ps1 | 28 ++++++++++++++-------------- 5 files changed, 58 insertions(+), 39 deletions(-) create mode 100644 .vscode/tasks.json diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..31c32bd --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,24 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "shell", + "args": [ + "build", + // Ask dotnet build to generate full paths for file names. + "/property:GenerateFullPaths=true", + // Do not generate summary otherwise it leads to duplicate errors in Problems panel + "/consoleloggerparameters:NoSummary" + ], + "group": "build", + "presentation": { + "reveal": "silent" + }, + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/IRDKit/IRDKit.csproj b/IRDKit/IRDKit.csproj index d5e91ab..51026e6 100644 --- a/IRDKit/IRDKit.csproj +++ b/IRDKit/IRDKit.csproj @@ -1,11 +1,11 @@ - + Exe irdkit irdkit - net6.0;net7.0;net8.0 + net6.0;net7.0;net8.0;net9.0 win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64 false latest @@ -30,8 +30,8 @@ - - + + diff --git a/IRDKit/Program.cs b/IRDKit/Program.cs index 6aaa3a0..89ffed9 100644 --- a/IRDKit/Program.cs +++ b/IRDKit/Program.cs @@ -944,13 +944,8 @@ namespace IRDKit uint crc32UInt = BitConverter.ToUInt32(crc32, 0); // Search for ISO on redump.org -#if !NETFRAMEWORK - RedumpHttpClient redump = new(); + RedumpClient redump = new(); List ids = redump.CheckSingleSitePage("http://redump.org/discs/system/ps3/quicksearch/" + crc32String).ConfigureAwait(false).GetAwaiter().GetResult(); -#else - RedumpWebClient redump = new(); - List ids = redump.CheckSingleSitePage("http://redump.org/discs/system/ps3/quicksearch/" + crc32String); -#endif int id; if (ids.Count == 0) { @@ -963,11 +958,7 @@ namespace IRDKit string sha1String = HashTool.GetFileHash(isoPath, HashType.SHA1); // Search redump.org for SHA1 hash -#if !NETFRAMEWORK List ids2 = redump.CheckSingleSitePage("http://redump.org/discs/system/ps3/quicksearch/" + sha1String).ConfigureAwait(false).GetAwaiter().GetResult(); -#else - List ids2 = redump.CheckSingleSitePage("http://redump.org/discs/system/ps3/quicksearch/" + sha1String); -#endif if (ids2.Count == 0) { Console.Error.WriteLine("ISO not found in redump and no valid key provided, cannot create IRD"); @@ -987,12 +978,8 @@ namespace IRDKit } // Download key file from redump.org -#if !NETFRAMEWORK - byte[] key = redump.GetByteArrayAsync($"http://redump.org/disc/{id}/key").ConfigureAwait(false).GetAwaiter().GetResult(); -#else - byte[] key = redump.DownloadData($"http://redump.org/disc/{id}/key"); -#endif - if (key.Length != 16) + byte[] key = redump.DownloadData($"http://redump.org/disc/{id}/key").ConfigureAwait(false).GetAwaiter().GetResult(); + if (key == null || key.Length != 16) { Console.Error.WriteLine("Invalid key obtained from redump and no valid key provided, cannot create IRD"); return null; diff --git a/LibIRD/LibIRD.csproj b/LibIRD/LibIRD.csproj index 6e7eef3..0145b91 100644 --- a/LibIRD/LibIRD.csproj +++ b/LibIRD/LibIRD.csproj @@ -1,4 +1,4 @@ - + @@ -9,7 +9,10 @@ true 0.9.1 ../nupkg - + + + CA2022 + Deterous Library for ISO Rebuild Data @@ -23,20 +26,25 @@ - net6.0;net7.0;net8.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 + net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0 + + + + + - + diff --git a/publish-irdkit.ps1 b/publish-irdkit.ps1 index cd63146..d1217c1 100644 --- a/publish-irdkit.ps1 +++ b/publish-irdkit.ps1 @@ -1,15 +1,15 @@ -dotnet publish -c Release -f net8.0 -r win-x86 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj -dotnet publish -c Release -f net8.0 -r win-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj -dotnet publish -c Release -f net8.0 -r win-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj -dotnet publish -c Release -f net8.0 -r linux-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj -dotnet publish -c Release -f net8.0 -r linux-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj -dotnet publish -c Release -f net8.0 -r osx-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj -dotnet publish -c Release -f net8.0 -r osx-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj +dotnet publish -c Release -f net9.0 -r win-x86 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj +dotnet publish -c Release -f net9.0 -r win-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj +dotnet publish -c Release -f net9.0 -r win-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj +dotnet publish -c Release -f net9.0 -r linux-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj +dotnet publish -c Release -f net9.0 -r linux-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj +dotnet publish -c Release -f net9.0 -r osx-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj +dotnet publish -c Release -f net9.0 -r osx-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj -Compress-Archive -Path "./IRDKit/bin/Release/net8.0/win-x86/publish/irdkit.exe" -Destination "./irdkit-win-x86.zip" -CompressionLevel "Optimal" -Compress-Archive -Path "./IRDKit/bin/Release/net8.0/win-x64/publish/irdkit.exe" -Destination "./irdkit-win-x64.zip" -CompressionLevel "Optimal" -Compress-Archive -Path "./IRDKit/bin/Release/net8.0/win-arm64/publish/irdkit.exe" -Destination "./irdkit-win-arm64.zip" -CompressionLevel "Optimal" -Compress-Archive -Path "./IRDKit/bin/Release/net8.0/linux-x64/publish/irdkit" -Destination "./irdkit-linux-x64.zip" -CompressionLevel "Optimal" -Compress-Archive -Path "./IRDKit/bin/Release/net8.0/linux-arm64/publish/irdkit" -Destination "./irdkit-linux-arm64.zip" -CompressionLevel "Optimal" -Compress-Archive -Path "./IRDKit/bin/Release/net8.0/osx-x64/publish/irdkit" -Destination "./irdkit-osx-x64.zip" -CompressionLevel "Optimal" -Compress-Archive -Path "./IRDKit/bin/Release/net8.0/osx-arm64/publish/irdkit" -Destination "./irdkit-osx-arm64.zip" -CompressionLevel "Optimal" \ No newline at end of file +Compress-Archive -Path "./IRDKit/bin/Release/net9.0/win-x86/publish/irdkit.exe" -Destination "./irdkit-win-x86.zip" -CompressionLevel "Optimal" +Compress-Archive -Path "./IRDKit/bin/Release/net9.0/win-x64/publish/irdkit.exe" -Destination "./irdkit-win-x64.zip" -CompressionLevel "Optimal" +Compress-Archive -Path "./IRDKit/bin/Release/net9.0/win-arm64/publish/irdkit.exe" -Destination "./irdkit-win-arm64.zip" -CompressionLevel "Optimal" +Compress-Archive -Path "./IRDKit/bin/Release/net9.0/linux-x64/publish/irdkit" -Destination "./irdkit-linux-x64.zip" -CompressionLevel "Optimal" +Compress-Archive -Path "./IRDKit/bin/Release/net9.0/linux-arm64/publish/irdkit" -Destination "./irdkit-linux-arm64.zip" -CompressionLevel "Optimal" +Compress-Archive -Path "./IRDKit/bin/Release/net9.0/osx-x64/publish/irdkit" -Destination "./irdkit-osx-x64.zip" -CompressionLevel "Optimal" +Compress-Archive -Path "./IRDKit/bin/Release/net9.0/osx-arm64/publish/irdkit" -Destination "./irdkit-osx-arm64.zip" -CompressionLevel "Optimal" \ No newline at end of file