Skip to content

Commit

Permalink
Improved documentation and logging
Browse files Browse the repository at this point in the history
  • Loading branch information
TalAloni committed Jul 29, 2018
1 parent c915c3e commit 0d12d8d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion HardDiskValidator/DiskReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public byte[] ReadSectors(long sectorIndex, long sectorCount, out bool ioErrorOc
byte[] segment = ReadSectorsUnbuffered(sectorIndex + sectorOffset, sectorsToRead, out ioErrorOccured);
if (m_abort || ioErrorOccured || segment == null)
{
long nextOffset = sectorOffset + sectorsToRead;
if ((ioErrorOccured || segment == null) && (sectorCount - nextOffset > 0))
{
AddToLog("Skipped {0:###,###,###,###,##0}-{1:###,###,###,###,##0}", sectorIndex + nextOffset, sectorIndex + sectorCount - 1);
}
return null;
}
Array.Copy(segment, 0, buffer, sectorOffset * m_disk.BytesPerSector, segment.Length);
Expand Down Expand Up @@ -75,7 +80,7 @@ public byte[] ReadSectorsUnbuffered(long sectorIndex, int sectorCount, out bool
}
}

/// <returns>Will return null if unrecoverable IO Error has occured or read is aborted</returns>
/// <returns>Will return null if an unrecoverable IO Error has occured or read is aborted</returns>
public byte[] ReadEverySector(long sectorIndex, int sectorCount, out List<long> damagedSectors, out bool ioErrorOccured)
{
if (sectorCount > PhysicalDisk.MaximumDirectTransferSizeLBA)
Expand Down

0 comments on commit 0d12d8d

Please sign in to comment.