Skip to content

Commit f7879bf

Browse files
committed
Finalise old dotnet support
1 parent fed9d6e commit f7879bf

File tree

3 files changed

+47
-12
lines changed

3 files changed

+47
-12
lines changed

IRDKit/IRDKit.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
<OutputType>Exe</OutputType>
66
<TargetName>irdkit</TargetName>
77
<AssemblyName>irdkit</AssemblyName>
8-
<TargetFrameworks>net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
8+
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
99
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
10-
<CheckEolTargetFramework>false</CheckEolTargetFramework>
10+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
1111
<LangVersion>latest</LangVersion>
12-
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
12+
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
1313
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
14-
<Version>0.7.0</Version>
14+
<Version>0.7.1</Version>
1515

1616
<!-- Package Properties -->
1717
<Authors>Deterous</Authors>
@@ -30,7 +30,7 @@
3030

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

LibIRD/IRD.cs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,11 @@ private protected static byte[] GenerateD1(byte[] key)
413413
throw new ArgumentException("Disc Key must be a byte array of length 16", nameof(key));
414414

415415
// Setup AES decryption
416+
#if NET35_OR_GREATER || NETCOREAPP
416417
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
418+
#else
419+
using Rijndael aes = Rijndael.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings"); ;
420+
#endif
417421

418422
// Set AES settings
419423
aes.Key = D1AesKey;
@@ -446,7 +450,11 @@ private protected static byte[] GenerateDiscKey(byte[] d1)
446450
throw new ArgumentException("Disc Key must be a byte array of length 16", nameof(d1));
447451

448452
// Setup AES decryption
453+
#if NET35_OR_GREATER || NETCOREAPP
449454
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
455+
#else
456+
using Rijndael aes = Rijndael.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings"); ;
457+
#endif
450458

451459
// Set AES settings
452460
aes.Key = D1AesKey;
@@ -478,7 +486,11 @@ private protected static byte[] GenerateD2(byte[] d2)
478486
if (d2.Length != 16) throw new ArgumentException("Disc ID must be a byte array of length 16", nameof(d2));
479487

480488
// Setup AES encryption
489+
#if NET35_OR_GREATER || NETCOREAPP
481490
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
491+
#else
492+
using Rijndael aes = Rijndael.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings"); ;
493+
#endif
482494

483495
// Set AES settings
484496
aes.Key = D2AesKey;
@@ -511,7 +523,11 @@ private protected static byte[] GenerateDiscID(byte[] d2)
511523
throw new ArgumentException("Disc ID must be a byte array of length 16", nameof(d2));
512524

513525
// Setup AES encryption
526+
#if NET35_OR_GREATER || NETCOREAPP
514527
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
528+
#else
529+
using Rijndael aes = Rijndael.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings"); ;
530+
#endif
515531

516532
// Set AES settings
517533
aes.Key = D2AesKey;
@@ -737,7 +753,7 @@ private protected void GenerateIRD(string isoPath, bool redump = false)
737753
HashISO(fs, redump && UID == 0x00000000);
738754
}
739755

740-
#endregion
756+
#endregion
741757

742758
#region Reading ISO
743759

@@ -989,7 +1005,12 @@ private protected void DecryptSectors(ref byte[] buffer, int sectorNumber, int o
9891005
throw new ArgumentException("Number of sectors must be within buffer");
9901006

9911007
// Setup AES decryption
1008+
#if NET35_OR_GREATER || NETCOREAPP
9921009
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
1010+
#else
1011+
using Rijndael aes = Rijndael.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings"); ;
1012+
#endif
1013+
9931014
// Set AES settings
9941015
aes.Key = DiscKey;
9951016
aes.Padding = PaddingMode.None;
@@ -1359,7 +1380,14 @@ public void Write(string irdPath)
13591380
#endif
13601381
// Write entire gzipped IRD stream to file
13611382
stream.Position = 0;
1383+
#if NET40_OR_GREATER || NETCOREAPP
13621384
stream.CopyTo(gzStream);
1385+
#else
1386+
byte[] buffer = new byte[1024];
1387+
int numBytes;
1388+
while ((numBytes = stream.Read(buffer, 0, buffer.Length)) > 0)
1389+
gzStream.Write(buffer, 0, numBytes);
1390+
#endif
13631391
}
13641392

13651393
/// <summary>
@@ -1571,7 +1599,7 @@ public void PrintJson(string jsonPath = null, bool single = true)
15711599
}
15721600
}
15731601

1574-
#endregion
1602+
#endregion
15751603

15761604
#region Helper Functions
15771605

LibIRD/LibIRD.csproj

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
<PropertyGroup>
44
<!-- Assembly Properties -->
5-
<TargetFrameworks>net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
65
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
7-
<CheckEolTargetFramework>false</CheckEolTargetFramework>
6+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
87
<LangVersion>latest</LangVersion>
9-
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
8+
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
109
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
11-
<Version>0.7.0</Version>
10+
<Version>0.7.1</Version>
1211
<PackageOutputPath>../nupkg</PackageOutputPath>
1312

1413
<!-- Package Properties -->
@@ -22,14 +21,22 @@
2221
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
2322
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
2423
</PropertyGroup>
24+
25+
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith(`osx-arm`))">
26+
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
27+
</PropertyGroup>
28+
29+
<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>
31+
</PropertyGroup>
2532

2633
<ItemGroup>
2734
<None Include="./README.md" Pack="true" PackagePath="" />
2835
</ItemGroup>
2936

3037
<ItemGroup>
3138
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
32-
<PackageReference Include="SabreTools.Hashing" Version="1.1.3" />
39+
<PackageReference Include="SabreTools.Hashing" Version="1.1.4" />
3340
</ItemGroup>
3441

3542
</Project>

0 commit comments

Comments
 (0)