Refactor IMediaImage.ReadSector(s)Long to return error status instead of buffer.

This commit is contained in:
2021-09-20 14:22:22 +01:00
parent 88aeda7240
commit a6690aa121
77 changed files with 1048 additions and 555 deletions

View File

@@ -53,15 +53,12 @@ namespace Aaru.Gui.ViewModels.Windows
{
_inputFormat = inputFormat;
try
{
inputFormat.ReadSectorLong(0);
ErrorNumber errno = inputFormat.ReadSectorLong(0, out _);
if(errno == ErrorNumber.NoError)
LongSectorChecked = true;
}
catch
{
else
LongSectorVisible = false;
}
TotalSectorsText = $"of {inputFormat.Info.Sectors}";
SectorNumber = 0;
@@ -81,12 +78,10 @@ namespace Aaru.Gui.ViewModels.Windows
this.RaiseAndSetIfChanged(ref _sectorNumber, value);
byte[] sector;
ErrorNumber errno = ErrorNumber.NoError;
ErrorNumber errno;
if(LongSectorChecked)
sector = _inputFormat.ReadSectorLong((ulong)SectorNumber);
else
errno = _inputFormat.ReadSector((ulong)SectorNumber, out sector);
errno = LongSectorChecked ? _inputFormat.ReadSectorLong((ulong)SectorNumber, out sector)
: _inputFormat.ReadSector((ulong)SectorNumber, out sector);
if(errno == ErrorNumber.NoError)
PrintHexText = PrintHex.ByteArrayToHexArrayString(sector, HEX_COLUMNS);