Skip to content

Commit 0761450

Browse files
authored
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
1 parent 82d53db commit 0761450

File tree

5 files changed

+58
-39
lines changed

5 files changed

+58
-39
lines changed

.vscode/tasks.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "build",
8+
"command": "dotnet",
9+
"type": "shell",
10+
"args": [
11+
"build",
12+
// Ask dotnet build to generate full paths for file names.
13+
"/property:GenerateFullPaths=true",
14+
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
15+
"/consoleloggerparameters:NoSummary"
16+
],
17+
"group": "build",
18+
"presentation": {
19+
"reveal": "silent"
20+
},
21+
"problemMatcher": "$msCompile"
22+
}
23+
]
24+
}

IRDKit/IRDKit.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<!-- Assembly Properties -->
55
<OutputType>Exe</OutputType>
66
<TargetName>irdkit</TargetName>
77
<AssemblyName>irdkit</AssemblyName>
8-
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
8+
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
99
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
1010
<CheckEolTargetFramework>false</CheckEolTargetFramework>
1111
<LangVersion>latest</LangVersion>
@@ -30,8 +30,8 @@
3030

3131
<ItemGroup>
3232
<PackageReference Include="CommandLineParser" Version="2.9.1" />
33-
<PackageReference Include="SabreTools.Hashing" Version="1.1.4" />
34-
<PackageReference Include="SabreTools.RedumpLib" Version="1.3.4" />
33+
<PackageReference Include="SabreTools.Hashing" Version="1.4.0" />
34+
<PackageReference Include="SabreTools.RedumpLib" Version="1.5.2" />
3535
</ItemGroup>
3636

3737
<ItemGroup>

IRDKit/Program.cs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -944,13 +944,8 @@ public static string ISO2IRD(string isoPath, string irdPath = null, string hexKe
944944
uint crc32UInt = BitConverter.ToUInt32(crc32, 0);
945945

946946
// Search for ISO on redump.org
947-
#if !NETFRAMEWORK
948-
RedumpHttpClient redump = new();
947+
RedumpClient redump = new();
949948
List<int> ids = redump.CheckSingleSitePage("http://redump.org/discs/system/ps3/quicksearch/" + crc32String).ConfigureAwait(false).GetAwaiter().GetResult();
950-
#else
951-
RedumpWebClient redump = new();
952-
List<int> ids = redump.CheckSingleSitePage("http://redump.org/discs/system/ps3/quicksearch/" + crc32String);
953-
#endif
954949
int id;
955950
if (ids.Count == 0)
956951
{
@@ -963,11 +958,7 @@ public static string ISO2IRD(string isoPath, string irdPath = null, string hexKe
963958
string sha1String = HashTool.GetFileHash(isoPath, HashType.SHA1);
964959

965960
// Search redump.org for SHA1 hash
966-
#if !NETFRAMEWORK
967961
List<int> ids2 = redump.CheckSingleSitePage("http://redump.org/discs/system/ps3/quicksearch/" + sha1String).ConfigureAwait(false).GetAwaiter().GetResult();
968-
#else
969-
List<int> ids2 = redump.CheckSingleSitePage("http://redump.org/discs/system/ps3/quicksearch/" + sha1String);
970-
#endif
971962
if (ids2.Count == 0)
972963
{
973964
Console.Error.WriteLine("ISO not found in redump and no valid key provided, cannot create IRD");
@@ -987,12 +978,8 @@ public static string ISO2IRD(string isoPath, string irdPath = null, string hexKe
987978
}
988979

989980
// Download key file from redump.org
990-
#if !NETFRAMEWORK
991-
byte[] key = redump.GetByteArrayAsync($"http://redump.org/disc/{id}/key").ConfigureAwait(false).GetAwaiter().GetResult();
992-
#else
993-
byte[] key = redump.DownloadData($"http://redump.org/disc/{id}/key");
994-
#endif
995-
if (key.Length != 16)
981+
byte[] key = redump.DownloadData($"http://redump.org/disc/{id}/key").ConfigureAwait(false).GetAwaiter().GetResult();
982+
if (key == null || key.Length != 16)
996983
{
997984
Console.Error.WriteLine("Invalid key obtained from redump and no valid key provided, cannot create IRD");
998985
return null;

LibIRD/LibIRD.csproj

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<!-- Assembly Properties -->
@@ -9,7 +9,10 @@
99
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1010
<Version>0.9.1</Version>
1111
<PackageOutputPath>../nupkg</PackageOutputPath>
12-
12+
13+
<!-- Avoid inexact read with 'System.IO.Stream.Read' -->
14+
<NoWarn>CA2022</NoWarn>
15+
1316
<!-- Package Properties -->
1417
<Authors>Deterous</Authors>
1518
<Description>Library for ISO Rebuild Data</Description>
@@ -23,20 +26,25 @@
2326
</PropertyGroup>
2427

2528
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith(`osx-arm`))">
26-
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
29+
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
2730
</PropertyGroup>
2831

2932
<PropertyGroup Condition="!$(RuntimeIdentifier.StartsWith(`osx-arm`))">
30-
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
33+
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
3134
</PropertyGroup>
3235

3336
<ItemGroup>
3437
<None Include="./README.md" Pack="true" PackagePath="" />
3538
</ItemGroup>
3639

40+
<!-- Support for old .NET versions -->
41+
<ItemGroup Condition="$(TargetFramework.StartsWith(`net2`))">
42+
<PackageReference Include="Net30.LinqBridge" Version="1.3.0" />
43+
</ItemGroup>
44+
3745
<ItemGroup>
3846
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
39-
<PackageReference Include="SabreTools.Hashing" Version="1.1.4" />
47+
<PackageReference Include="SabreTools.Hashing" Version="1.4.0" />
4048
</ItemGroup>
4149

4250
</Project>

publish-irdkit.ps1

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
dotnet publish -c Release -f net8.0 -r win-x86 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
2-
dotnet publish -c Release -f net8.0 -r win-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
3-
dotnet publish -c Release -f net8.0 -r win-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
4-
dotnet publish -c Release -f net8.0 -r linux-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
5-
dotnet publish -c Release -f net8.0 -r linux-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
6-
dotnet publish -c Release -f net8.0 -r osx-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
7-
dotnet publish -c Release -f net8.0 -r osx-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
1+
dotnet publish -c Release -f net9.0 -r win-x86 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
2+
dotnet publish -c Release -f net9.0 -r win-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
3+
dotnet publish -c Release -f net9.0 -r win-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
4+
dotnet publish -c Release -f net9.0 -r linux-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
5+
dotnet publish -c Release -f net9.0 -r linux-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
6+
dotnet publish -c Release -f net9.0 -r osx-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
7+
dotnet publish -c Release -f net9.0 -r osx-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
88

9-
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/win-x86/publish/irdkit.exe" -Destination "./irdkit-win-x86.zip" -CompressionLevel "Optimal"
10-
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/win-x64/publish/irdkit.exe" -Destination "./irdkit-win-x64.zip" -CompressionLevel "Optimal"
11-
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/win-arm64/publish/irdkit.exe" -Destination "./irdkit-win-arm64.zip" -CompressionLevel "Optimal"
12-
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/linux-x64/publish/irdkit" -Destination "./irdkit-linux-x64.zip" -CompressionLevel "Optimal"
13-
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/linux-arm64/publish/irdkit" -Destination "./irdkit-linux-arm64.zip" -CompressionLevel "Optimal"
14-
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/osx-x64/publish/irdkit" -Destination "./irdkit-osx-x64.zip" -CompressionLevel "Optimal"
15-
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/osx-arm64/publish/irdkit" -Destination "./irdkit-osx-arm64.zip" -CompressionLevel "Optimal"
9+
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/win-x86/publish/irdkit.exe" -Destination "./irdkit-win-x86.zip" -CompressionLevel "Optimal"
10+
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/win-x64/publish/irdkit.exe" -Destination "./irdkit-win-x64.zip" -CompressionLevel "Optimal"
11+
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/win-arm64/publish/irdkit.exe" -Destination "./irdkit-win-arm64.zip" -CompressionLevel "Optimal"
12+
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/linux-x64/publish/irdkit" -Destination "./irdkit-linux-x64.zip" -CompressionLevel "Optimal"
13+
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/linux-arm64/publish/irdkit" -Destination "./irdkit-linux-arm64.zip" -CompressionLevel "Optimal"
14+
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/osx-x64/publish/irdkit" -Destination "./irdkit-osx-x64.zip" -CompressionLevel "Optimal"
15+
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/osx-arm64/publish/irdkit" -Destination "./irdkit-osx-arm64.zip" -CompressionLevel "Optimal"

0 commit comments

Comments
 (0)