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
+18 -1
View File
@@ -1105,6 +1105,22 @@ namespace LibIRD
// If end of ISO reached, stop reading
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 (redump)
{
@@ -1112,6 +1128,7 @@ namespace LibIRD
Array.Reverse(crc32);
UID = BitConverter.ToUInt32(crc32, 0);
}
return;
}
@@ -1240,7 +1257,7 @@ namespace LibIRD
// Check if current file has ended in this buffer (assumes last extent contains last byte)
int lastExtent = FileExtents[i].Length - 1;
long lastByte = SectorSize * FileExtents[i][lastExtent].Offset + FileExtents[i][lastExtent].Count;
if (lastByte < SectorSize * (currentSector + bufSectors)
if (lastByte <= SectorSize * (currentSector + bufSectors)
&& lastByte > SectorSize * currentSector)
{
// Close file hash
+1 -1
View File
@@ -7,7 +7,7 @@
<LangVersion>latest</LangVersion>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>0.8.0</Version>
<Version>0.9.0</Version>
<PackageOutputPath>../nupkg</PackageOutputPath>
<!-- Package Properties -->