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:
@@ -51,7 +51,7 @@ public sealed partial class Anex86
|
||||
|
||||
if(stream.Length < Marshal.SizeOf<Header>()) return ErrorNumber.InvalidArgument;
|
||||
|
||||
byte[] hdrB = new byte[Marshal.SizeOf<Header>()];
|
||||
var hdrB = new byte[Marshal.SizeOf<Header>()];
|
||||
stream.EnsureRead(hdrB, 0, hdrB.Length);
|
||||
|
||||
_header = Marshal.SpanToStructureLittleEndian<Header>(hdrB);
|
||||
@@ -81,16 +81,24 @@ public sealed partial class Anex86
|
||||
}
|
||||
|
||||
/// <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 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 > _imageInfo.Sectors - 1 || sectorAddress + length > _imageInfo.Sectors)
|
||||
return ErrorNumber.OutOfRange;
|
||||
|
||||
if(sectorAddress + length > _imageInfo.Sectors) return ErrorNumber.OutOfRange;
|
||||
sectorStatus = new SectorStatus[length];
|
||||
for(uint i = 0; i < length; i++) sectorStatus[i] = SectorStatus.Dumped;
|
||||
|
||||
buffer = new byte[length * _imageInfo.SectorSize];
|
||||
|
||||
|
||||
@@ -63,17 +63,20 @@ public sealed partial class Anex86
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber ReadSectorLong(ulong sectorAddress, out byte[] buffer)
|
||||
public ErrorNumber ReadSectorLong(ulong sectorAddress, out byte[] buffer, out SectorStatus sectorStatus)
|
||||
{
|
||||
buffer = null;
|
||||
buffer = null;
|
||||
sectorStatus = SectorStatus.NotDumped;
|
||||
|
||||
return ErrorNumber.NotSupported;
|
||||
}
|
||||
|
||||
/// <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;
|
||||
|
||||
return ErrorNumber.NotSupported;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user