Fix issue from moving to ST.Hashing

This commit is contained in:
Deterous
2024-03-13 12:45:20 +09:00
parent c175fedbdb
commit c1c25b5f5e
3 changed files with 20 additions and 3 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>0.8.0</Version> <Version>0.9.0</Version>
<!-- Package Properties --> <!-- Package Properties -->
<Authors>Deterous</Authors> <Authors>Deterous</Authors>
+18 -1
View File
@@ -1105,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)
{ {
@@ -1112,6 +1128,7 @@ namespace LibIRD
Array.Reverse(crc32); Array.Reverse(crc32);
UID = BitConverter.ToUInt32(crc32, 0); UID = BitConverter.ToUInt32(crc32, 0);
} }
return; return;
} }
@@ -1240,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
+1 -1
View File
@@ -7,7 +7,7 @@
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>0.8.0</Version> <Version>0.9.0</Version>
<PackageOutputPath>../nupkg</PackageOutputPath> <PackageOutputPath>../nupkg</PackageOutputPath>
<!-- Package Properties --> <!-- Package Properties -->