Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1c25b5f5e | ||
|
|
c175fedbdb | ||
|
|
f7879bf9e8 |
@@ -5,13 +5,13 @@
|
|||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetName>irdkit</TargetName>
|
<TargetName>irdkit</TargetName>
|
||||||
<AssemblyName>irdkit</AssemblyName>
|
<AssemblyName>irdkit</AssemblyName>
|
||||||
<TargetFrameworks>net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
|
||||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
<Version>0.7.0</Version>
|
<Version>0.9.0</Version>
|
||||||
|
|
||||||
<!-- Package Properties -->
|
<!-- Package Properties -->
|
||||||
<Authors>Deterous</Authors>
|
<Authors>Deterous</Authors>
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||||
<PackageReference Include="SabreTools.Hashing" Version="1.1.3" />
|
<PackageReference Include="SabreTools.Hashing" Version="1.1.4" />
|
||||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.3.4" />
|
<PackageReference Include="SabreTools.RedumpLib" Version="1.3.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
+53
-4
@@ -413,7 +413,11 @@ namespace LibIRD
|
|||||||
throw new ArgumentException("Disc Key must be a byte array of length 16", nameof(key));
|
throw new ArgumentException("Disc Key must be a byte array of length 16", nameof(key));
|
||||||
|
|
||||||
// Setup AES decryption
|
// Setup AES decryption
|
||||||
|
#if NET35_OR_GREATER || NETCOREAPP
|
||||||
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
|
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
|
||||||
|
#else
|
||||||
|
using Rijndael aes = Rijndael.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings"); ;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set AES settings
|
// Set AES settings
|
||||||
aes.Key = D1AesKey;
|
aes.Key = D1AesKey;
|
||||||
@@ -446,7 +450,11 @@ namespace LibIRD
|
|||||||
throw new ArgumentException("Disc Key must be a byte array of length 16", nameof(d1));
|
throw new ArgumentException("Disc Key must be a byte array of length 16", nameof(d1));
|
||||||
|
|
||||||
// Setup AES decryption
|
// Setup AES decryption
|
||||||
|
#if NET35_OR_GREATER || NETCOREAPP
|
||||||
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
|
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
|
||||||
|
#else
|
||||||
|
using Rijndael aes = Rijndael.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings"); ;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set AES settings
|
// Set AES settings
|
||||||
aes.Key = D1AesKey;
|
aes.Key = D1AesKey;
|
||||||
@@ -478,7 +486,11 @@ namespace LibIRD
|
|||||||
if (d2.Length != 16) throw new ArgumentException("Disc ID must be a byte array of length 16", nameof(d2));
|
if (d2.Length != 16) throw new ArgumentException("Disc ID must be a byte array of length 16", nameof(d2));
|
||||||
|
|
||||||
// Setup AES encryption
|
// Setup AES encryption
|
||||||
|
#if NET35_OR_GREATER || NETCOREAPP
|
||||||
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
|
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
|
||||||
|
#else
|
||||||
|
using Rijndael aes = Rijndael.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings"); ;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set AES settings
|
// Set AES settings
|
||||||
aes.Key = D2AesKey;
|
aes.Key = D2AesKey;
|
||||||
@@ -511,7 +523,11 @@ namespace LibIRD
|
|||||||
throw new ArgumentException("Disc ID must be a byte array of length 16", nameof(d2));
|
throw new ArgumentException("Disc ID must be a byte array of length 16", nameof(d2));
|
||||||
|
|
||||||
// Setup AES encryption
|
// Setup AES encryption
|
||||||
|
#if NET35_OR_GREATER || NETCOREAPP
|
||||||
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
|
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
|
||||||
|
#else
|
||||||
|
using Rijndael aes = Rijndael.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings"); ;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set AES settings
|
// Set AES settings
|
||||||
aes.Key = D2AesKey;
|
aes.Key = D2AesKey;
|
||||||
@@ -737,7 +753,7 @@ namespace LibIRD
|
|||||||
HashISO(fs, redump && UID == 0x00000000);
|
HashISO(fs, redump && UID == 0x00000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Reading ISO
|
#region Reading ISO
|
||||||
|
|
||||||
@@ -989,7 +1005,12 @@ namespace LibIRD
|
|||||||
throw new ArgumentException("Number of sectors must be within buffer");
|
throw new ArgumentException("Number of sectors must be within buffer");
|
||||||
|
|
||||||
// Setup AES decryption
|
// Setup AES decryption
|
||||||
|
#if NET35_OR_GREATER || NETCOREAPP
|
||||||
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
|
using Aes aes = Aes.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings");
|
||||||
|
#else
|
||||||
|
using Rijndael aes = Rijndael.Create() ?? throw new InvalidOperationException("AES not available. Change your system settings"); ;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set AES settings
|
// Set AES settings
|
||||||
aes.Key = DiscKey;
|
aes.Key = DiscKey;
|
||||||
aes.Padding = PaddingMode.None;
|
aes.Padding = PaddingMode.None;
|
||||||
@@ -1035,6 +1056,10 @@ namespace LibIRD
|
|||||||
CountFiles(dirInfo);
|
CountFiles(dirInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Hashing
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculate hashes for all region and file extents
|
/// Calculate hashes for all region and file extents
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1080,6 +1105,22 @@ namespace LibIRD
|
|||||||
// If end of ISO reached, stop reading
|
// If end of ISO reached, stop reading
|
||||||
if (numBytes == 0)
|
if (numBytes == 0)
|
||||||
{
|
{
|
||||||
|
// Ensure all hashes have been saved
|
||||||
|
foreach (int i in regions)
|
||||||
|
{
|
||||||
|
// Close region hash
|
||||||
|
regionMD5[i].Terminate();
|
||||||
|
RegionHashes[i] = regionMD5[i].CurrentHashBytes;
|
||||||
|
regionMD5[i].Dispose();
|
||||||
|
}
|
||||||
|
foreach (int i in files)
|
||||||
|
{
|
||||||
|
// Close file hash
|
||||||
|
fileMD5[i].Terminate();
|
||||||
|
FileHashes[i] = fileMD5[i].CurrentHashBytes;
|
||||||
|
fileMD5[i].Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
// If making redump-style IRD, save CRC32 hash to UID field
|
// If making redump-style IRD, save CRC32 hash to UID field
|
||||||
if (redump)
|
if (redump)
|
||||||
{
|
{
|
||||||
@@ -1087,6 +1128,7 @@ namespace LibIRD
|
|||||||
Array.Reverse(crc32);
|
Array.Reverse(crc32);
|
||||||
UID = BitConverter.ToUInt32(crc32, 0);
|
UID = BitConverter.ToUInt32(crc32, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1180,7 +1222,7 @@ namespace LibIRD
|
|||||||
|
|
||||||
// Don't decrypt last sectors if the encrypted region ends within this buffer
|
// Don't decrypt last sectors if the encrypted region ends within this buffer
|
||||||
if (RegionEnd[i] < currentSector + bufSectors)
|
if (RegionEnd[i] < currentSector + bufSectors)
|
||||||
encCount -= (int)(currentSector + bufSectors - RegionEnd[i] + 1);
|
encCount -= (int)(currentSector + bufSectors - RegionEnd[i] - 1);
|
||||||
|
|
||||||
// Decrypt encrypted sectors
|
// Decrypt encrypted sectors
|
||||||
DecryptSectors(ref buf, (int)currentSector + encOffset, encOffset, encCount);
|
DecryptSectors(ref buf, (int)currentSector + encOffset, encOffset, encCount);
|
||||||
@@ -1215,7 +1257,7 @@ namespace LibIRD
|
|||||||
// Check if current file has ended in this buffer (assumes last extent contains last byte)
|
// Check if current file has ended in this buffer (assumes last extent contains last byte)
|
||||||
int lastExtent = FileExtents[i].Length - 1;
|
int lastExtent = FileExtents[i].Length - 1;
|
||||||
long lastByte = SectorSize * FileExtents[i][lastExtent].Offset + FileExtents[i][lastExtent].Count;
|
long lastByte = SectorSize * FileExtents[i][lastExtent].Offset + FileExtents[i][lastExtent].Count;
|
||||||
if (lastByte < SectorSize * (currentSector + bufSectors)
|
if (lastByte <= SectorSize * (currentSector + bufSectors)
|
||||||
&& lastByte > SectorSize * currentSector)
|
&& lastByte > SectorSize * currentSector)
|
||||||
{
|
{
|
||||||
// Close file hash
|
// Close file hash
|
||||||
@@ -1359,7 +1401,14 @@ namespace LibIRD
|
|||||||
#endif
|
#endif
|
||||||
// Write entire gzipped IRD stream to file
|
// Write entire gzipped IRD stream to file
|
||||||
stream.Position = 0;
|
stream.Position = 0;
|
||||||
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
stream.CopyTo(gzStream);
|
stream.CopyTo(gzStream);
|
||||||
|
#else
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int numBytes;
|
||||||
|
while ((numBytes = stream.Read(buffer, 0, buffer.Length)) > 0)
|
||||||
|
gzStream.Write(buffer, 0, numBytes);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1571,7 +1620,7 @@ namespace LibIRD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Helper Functions
|
#region Helper Functions
|
||||||
|
|
||||||
|
|||||||
+12
-5
@@ -2,13 +2,12 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- Assembly Properties -->
|
<!-- Assembly Properties -->
|
||||||
<TargetFrameworks>net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
|
||||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
<Version>0.7.0</Version>
|
<Version>0.9.0</Version>
|
||||||
<PackageOutputPath>../nupkg</PackageOutputPath>
|
<PackageOutputPath>../nupkg</PackageOutputPath>
|
||||||
|
|
||||||
<!-- Package Properties -->
|
<!-- Package Properties -->
|
||||||
@@ -23,13 +22,21 @@
|
|||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith(`osx-arm`))">
|
||||||
|
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="!$(RuntimeIdentifier.StartsWith(`osx-arm`))">
|
||||||
|
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="./README.md" Pack="true" PackagePath="" />
|
<None Include="./README.md" Pack="true" PackagePath="" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="SabreTools.Hashing" Version="1.1.3" />
|
<PackageReference Include="SabreTools.Hashing" Version="1.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user