mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Update ReadSector and ReadSectors methods to include sector status output
This commit is contained in:
@@ -303,22 +303,30 @@ public sealed partial class Dart
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber ReadSector(ulong sectorAddress, out byte[] buffer) => ReadSectors(sectorAddress, 1, out buffer);
|
||||
public ErrorNumber ReadSector(ulong sectorAddress, out byte[] buffer, out SectorStatus sectorStatus)
|
||||
{
|
||||
sectorStatus = SectorStatus.Dumped;
|
||||
|
||||
return ReadSectors(sectorAddress, 1, out buffer, out _);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber ReadSectorTag(ulong sectorAddress, SectorTagType tag, out byte[] buffer) =>
|
||||
ReadSectorsTag(sectorAddress, 1, tag, out buffer);
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber ReadSectors(ulong sectorAddress, uint length, out byte[] buffer)
|
||||
public ErrorNumber ReadSectors(ulong sectorAddress, uint length, out byte[] buffer, out SectorStatus[] sectorStatus)
|
||||
{
|
||||
buffer = null;
|
||||
buffer = null;
|
||||
sectorStatus = null;
|
||||
|
||||
if(sectorAddress > _imageInfo.Sectors - 1) return ErrorNumber.OutOfRange;
|
||||
|
||||
if(sectorAddress + length > _imageInfo.Sectors) return ErrorNumber.OutOfRange;
|
||||
|
||||
buffer = new byte[length * _imageInfo.SectorSize];
|
||||
buffer = new byte[length * _imageInfo.SectorSize];
|
||||
sectorStatus = new SectorStatus[length];
|
||||
for(uint i = 0; i < length; i++) sectorStatus[i] = SectorStatus.Dumped;
|
||||
|
||||
Array.Copy(_dataCache, (int)sectorAddress * _imageInfo.SectorSize, buffer, 0, length * _imageInfo.SectorSize);
|
||||
|
||||
@@ -346,19 +354,25 @@ public sealed partial class Dart
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber ReadSectorLong(ulong sectorAddress, out byte[] buffer) =>
|
||||
ReadSectorsLong(sectorAddress, 1, out buffer);
|
||||
public ErrorNumber ReadSectorLong(ulong sectorAddress, out byte[] buffer, out SectorStatus sectorStatus)
|
||||
{
|
||||
sectorStatus = SectorStatus.Dumped;
|
||||
|
||||
return ReadSectorsLong(sectorAddress, 1, out buffer, out _);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber ReadSectorsLong(ulong sectorAddress, uint length, out byte[] buffer)
|
||||
public ErrorNumber ReadSectorsLong(ulong sectorAddress, uint length, out byte[] buffer,
|
||||
out SectorStatus[] sectorStatus)
|
||||
{
|
||||
buffer = null;
|
||||
buffer = null;
|
||||
sectorStatus = null;
|
||||
|
||||
if(sectorAddress > _imageInfo.Sectors - 1) return ErrorNumber.OutOfRange;
|
||||
|
||||
if(sectorAddress + length > _imageInfo.Sectors) return ErrorNumber.OutOfRange;
|
||||
|
||||
ErrorNumber errno = ReadSectors(sectorAddress, length, out byte[] data);
|
||||
ErrorNumber errno = ReadSectors(sectorAddress, length, out byte[] data, out sectorStatus);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user