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:
@@ -31,6 +31,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -79,18 +80,26 @@ public sealed partial class Nhdr0
|
||||
}
|
||||
|
||||
/// <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 + length > _imageInfo.Sectors) return ErrorNumber.OutOfRange;
|
||||
|
||||
buffer = new byte[length * _imageInfo.SectorSize];
|
||||
buffer = new byte[length * _imageInfo.SectorSize];
|
||||
sectorStatus = Enumerable.Repeat(SectorStatus.Dumped, (int)length).ToArray();
|
||||
|
||||
|
||||
Stream stream = _nhdImageFilter.GetDataForkStream();
|
||||
|
||||
|
||||
@@ -63,17 +63,20 @@ public sealed partial class Nhdr0
|
||||
}
|
||||
|
||||
/// <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