mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Aaru.Core] Reformat and cleanup.
This commit is contained in:
@@ -95,13 +95,13 @@ public sealed partial class MediaScan
|
||||
byte heads = ataReader.Heads;
|
||||
byte sectors = ataReader.Sectors;
|
||||
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
results.ProcessingTime = 0;
|
||||
double currentSpeed = 0;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
@@ -130,7 +130,7 @@ public sealed partial class MediaScan
|
||||
|
||||
_scanStopwatch.Restart();
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
for(ulong i = 0; i < results.Blocks; i += blocksToRead)
|
||||
@@ -150,8 +150,10 @@ public sealed partial class MediaScan
|
||||
results.MinSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)results.Blocks);
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)results.Blocks);
|
||||
|
||||
bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out duration, out _, out _);
|
||||
|
||||
@@ -227,12 +229,13 @@ public sealed partial class MediaScan
|
||||
InitProgress?.Invoke();
|
||||
|
||||
if(ataReader.CanSeekLba && _seekTest)
|
||||
for(int i = 0; i < seekTimes; i++)
|
||||
{
|
||||
for(var i = 0; i < seekTimes; i++)
|
||||
{
|
||||
if(_aborted)
|
||||
break;
|
||||
|
||||
uint seekPos = (uint)rnd.Next((int)results.Blocks);
|
||||
var seekPos = (uint)rnd.Next((int)results.Blocks);
|
||||
|
||||
PulseProgress?.Invoke(string.Format(Localization.Core.Seeking_to_sector_0, seekPos));
|
||||
|
||||
@@ -249,6 +252,7 @@ public sealed partial class MediaScan
|
||||
results.SeekTotal += seekCur;
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
|
||||
EndProgress?.Invoke();
|
||||
}
|
||||
@@ -262,7 +266,7 @@ public sealed partial class MediaScan
|
||||
results.Blocks = (ulong)(cylinders * heads * sectors);
|
||||
_scanStopwatch.Restart();
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
for(ushort cy = 0; cy < cylinders; cy++)
|
||||
@@ -361,14 +365,15 @@ public sealed partial class MediaScan
|
||||
InitProgress?.Invoke();
|
||||
|
||||
if(ataReader.CanSeek)
|
||||
for(int i = 0; i < seekTimes; i++)
|
||||
{
|
||||
for(var i = 0; i < seekTimes; i++)
|
||||
{
|
||||
if(_aborted)
|
||||
break;
|
||||
|
||||
ushort seekCy = (ushort)rnd.Next(cylinders);
|
||||
byte seekHd = (byte)rnd.Next(heads);
|
||||
byte seekSc = (byte)rnd.Next(sectors);
|
||||
var seekCy = (ushort)rnd.Next(cylinders);
|
||||
var seekHd = (byte)rnd.Next(heads);
|
||||
var seekSc = (byte)rnd.Next(sectors);
|
||||
|
||||
PulseProgress?.Invoke(string.Format(Localization.Core.Seeking_to_cylinder_0_head_1_sector_2,
|
||||
seekCy, seekHd, seekSc));
|
||||
@@ -386,6 +391,7 @@ public sealed partial class MediaScan
|
||||
results.SeekTotal += seekCur;
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
|
||||
EndProgress?.Invoke();
|
||||
}
|
||||
|
||||
@@ -41,17 +41,17 @@ namespace Aaru.Core.Devices.Scanning;
|
||||
|
||||
public sealed partial class MediaScan
|
||||
{
|
||||
readonly Device _dev;
|
||||
readonly string _devicePath;
|
||||
readonly string _ibgLogPath;
|
||||
readonly string _mhddLogPath;
|
||||
readonly bool _seekTest;
|
||||
readonly bool _useBufferedReads;
|
||||
bool _aborted;
|
||||
static readonly TimeSpan _oneSecond = 1.Seconds();
|
||||
readonly Stopwatch _scanStopwatch;
|
||||
readonly Stopwatch _speedStopwatch;
|
||||
const string MODULE_NAME = "Media scanning";
|
||||
static readonly TimeSpan _oneSecond = 1.Seconds();
|
||||
readonly Device _dev;
|
||||
readonly string _devicePath;
|
||||
readonly string _ibgLogPath;
|
||||
readonly string _mhddLogPath;
|
||||
readonly Stopwatch _scanStopwatch;
|
||||
readonly bool _seekTest;
|
||||
readonly Stopwatch _speedStopwatch;
|
||||
readonly bool _useBufferedReads;
|
||||
bool _aborted;
|
||||
|
||||
/// <param name="mhddLogPath">Path to a MHDD log file</param>
|
||||
/// <param name="ibgLogPath">Path to a IMGBurn log file</param>
|
||||
@@ -63,7 +63,7 @@ public sealed partial class MediaScan
|
||||
/// commands
|
||||
/// </param>
|
||||
public MediaScan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev, bool useBufferedReads,
|
||||
bool seekTest = true)
|
||||
bool seekTest = true)
|
||||
{
|
||||
_mhddLogPath = mhddLogPath;
|
||||
_ibgLogPath = ibgLogPath;
|
||||
@@ -83,13 +83,18 @@ public sealed partial class MediaScan
|
||||
{
|
||||
switch(_dev.Type)
|
||||
{
|
||||
case DeviceType.ATA: return Ata();
|
||||
case DeviceType.ATA:
|
||||
return Ata();
|
||||
case DeviceType.MMC:
|
||||
case DeviceType.SecureDigital: return SecureDigital();
|
||||
case DeviceType.NVMe: return Nvme();
|
||||
case DeviceType.SecureDigital:
|
||||
return SecureDigital();
|
||||
case DeviceType.NVMe:
|
||||
return Nvme();
|
||||
case DeviceType.ATAPI:
|
||||
case DeviceType.SCSI: return Scsi();
|
||||
default: throw new NotSupportedException(Localization.Core.Unknown_device_type);
|
||||
case DeviceType.SCSI:
|
||||
return Scsi();
|
||||
default:
|
||||
throw new NotSupportedException(Localization.Core.Unknown_device_type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,22 +103,31 @@ public sealed partial class MediaScan
|
||||
|
||||
/// <summary>Event raised when the progress bar is not longer needed</summary>
|
||||
public event EndProgressHandler EndProgress;
|
||||
|
||||
/// <summary>Event raised when a progress bar is needed</summary>
|
||||
public event InitProgressHandler InitProgress;
|
||||
|
||||
/// <summary>Event raised to report status updates</summary>
|
||||
public event UpdateStatusHandler UpdateStatus;
|
||||
|
||||
/// <summary>Event raised to report a fatal error that stops the dumping operation and should call user's attention</summary>
|
||||
public event ErrorMessageHandler StoppingErrorMessage;
|
||||
|
||||
/// <summary>Event raised to update the values of a determinate progress bar</summary>
|
||||
public event UpdateProgressHandler UpdateProgress;
|
||||
|
||||
/// <summary>Event raised to update the status of an indeterminate progress bar</summary>
|
||||
public event PulseProgressHandler PulseProgress;
|
||||
|
||||
/// <summary>Updates lists of time taken on scanning from the specified sector</summary>
|
||||
public event ScanTimeHandler ScanTime;
|
||||
|
||||
/// <summary>Specified a number of blocks could not be read on scan</summary>
|
||||
public event ScanUnreadableHandler ScanUnreadable;
|
||||
|
||||
/// <summary>Initializes a block map that's going to be filled with a media scan</summary>
|
||||
public event InitBlockMapHandler InitBlockMap;
|
||||
|
||||
/// <summary>Sends the speed of scanning a specific sector</summary>
|
||||
public event ScanSpeedHandler ScanSpeed;
|
||||
}
|
||||
@@ -38,6 +38,6 @@ public sealed partial class MediaScan
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.NVMe_devices_not_yet_supported);
|
||||
|
||||
return default;
|
||||
return default(ScanResults);
|
||||
}
|
||||
}
|
||||
@@ -57,8 +57,8 @@ public sealed partial class MediaScan
|
||||
bool sense;
|
||||
uint blockSize = 0;
|
||||
ushort currentProfile = 0x0001;
|
||||
bool foundReadCommand = false;
|
||||
bool readcd = false;
|
||||
var foundReadCommand = false;
|
||||
var readcd = false;
|
||||
|
||||
results.Blocks = 0;
|
||||
|
||||
@@ -72,11 +72,12 @@ public sealed partial class MediaScan
|
||||
DecodedSense? decSense = Sense.Decode(senseBuf);
|
||||
|
||||
if(decSense.HasValue)
|
||||
{
|
||||
switch(decSense.Value.ASC)
|
||||
{
|
||||
case 0x3A:
|
||||
{
|
||||
int leftRetries = 5;
|
||||
var leftRetries = 5;
|
||||
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
@@ -101,7 +102,7 @@ public sealed partial class MediaScan
|
||||
}
|
||||
case 0x04 when decSense.Value.ASCQ == 0x01:
|
||||
{
|
||||
int leftRetries = 10;
|
||||
var leftRetries = 10;
|
||||
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
@@ -130,7 +131,7 @@ public sealed partial class MediaScan
|
||||
// These should be trapped by the OS but seems in some cases they're not
|
||||
case 0x28:
|
||||
{
|
||||
int leftRetries = 10;
|
||||
var leftRetries = 10;
|
||||
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
@@ -161,6 +162,7 @@ public sealed partial class MediaScan
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Unknown_sense_testing_unit_was_ready);
|
||||
@@ -221,7 +223,7 @@ public sealed partial class MediaScan
|
||||
return results;
|
||||
}
|
||||
|
||||
bool compactDisc = true;
|
||||
var compactDisc = true;
|
||||
FullTOC.CDFullTOC? toc = null;
|
||||
|
||||
if(_dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
@@ -243,7 +245,8 @@ public sealed partial class MediaScan
|
||||
case 0x000A:
|
||||
case 0x0020:
|
||||
case 0x0021:
|
||||
case 0x0022: break;
|
||||
case 0x0022:
|
||||
break;
|
||||
default:
|
||||
compactDisc = false;
|
||||
|
||||
@@ -269,13 +272,13 @@ public sealed partial class MediaScan
|
||||
scsiReader.GetBlocksToRead();
|
||||
|
||||
uint blocksToRead;
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
results.ProcessingTime = 0;
|
||||
results.TotalTime = 0;
|
||||
double currentSpeed = 0;
|
||||
@@ -310,6 +313,7 @@ public sealed partial class MediaScan
|
||||
_scanStopwatch.Restart();
|
||||
|
||||
if(readcd)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
sense = _dev.ReadCd(out _, out senseBuf, 0, 2352, blocksToRead, MmcSectorTypes.AllTypes, false,
|
||||
@@ -323,6 +327,7 @@ public sealed partial class MediaScan
|
||||
blocksToRead == 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(_dev.Error)
|
||||
{
|
||||
@@ -339,7 +344,7 @@ public sealed partial class MediaScan
|
||||
mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, blocksToRead, false);
|
||||
ibgLog = new IbgLog(_ibgLogPath, currentProfile);
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
ulong sectorSpeedStart = 0;
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -362,13 +367,17 @@ public sealed partial class MediaScan
|
||||
results.MinSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)results.Blocks);
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)results.Blocks);
|
||||
|
||||
if(readcd)
|
||||
{
|
||||
sense = _dev.ReadCd(out _, out senseBuf, (uint)i, 2352, blocksToRead, MmcSectorTypes.AllTypes,
|
||||
false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None,
|
||||
MmcSubchannel.None, _dev.Timeout, out cmdDuration);
|
||||
}
|
||||
else
|
||||
sense = scsiReader.ReadBlocks(out _, i, blocksToRead, out cmdDuration, out _, out _);
|
||||
|
||||
@@ -423,6 +432,7 @@ public sealed partial class MediaScan
|
||||
|
||||
// TODO: This error happens when changing from track type afaik. Need to solve that more cleanly
|
||||
// LOGICAL BLOCK ADDRESS OUT OF RANGE
|
||||
{
|
||||
if((senseDecoded.Value.ASC != 0x21 || senseDecoded.Value.ASCQ != 0x00) &&
|
||||
|
||||
// ILLEGAL MODE FOR THIS TRACK (requesting sectors as-is, this is a firmware misconception when audio sectors
|
||||
@@ -439,6 +449,7 @@ public sealed partial class MediaScan
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!senseDecoded.HasValue)
|
||||
@@ -497,7 +508,7 @@ public sealed partial class MediaScan
|
||||
mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, scsiReader.BlocksToRead, false);
|
||||
ibgLog = new IbgLog(_ibgLogPath, currentProfile);
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
ulong sectorSpeedStart = 0;
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -520,8 +531,10 @@ public sealed partial class MediaScan
|
||||
results.MinSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)results.Blocks);
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)results.Blocks);
|
||||
|
||||
sense = scsiReader.ReadBlocks(out _, i, blocksToRead, out double cmdDuration, out _, out _);
|
||||
results.ProcessingTime += cmdDuration;
|
||||
@@ -607,12 +620,12 @@ public sealed partial class MediaScan
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
for(int i = 0; i < seekTimes; i++)
|
||||
for(var i = 0; i < seekTimes; i++)
|
||||
{
|
||||
if(_aborted || !_seekTest)
|
||||
break;
|
||||
|
||||
uint seekPos = (uint)rnd.Next((int)results.Blocks);
|
||||
var seekPos = (uint)rnd.Next((int)results.Blocks);
|
||||
|
||||
PulseProgress?.Invoke(string.Format(Localization.Core.Seeking_to_sector_0, seekPos));
|
||||
|
||||
@@ -621,9 +634,11 @@ public sealed partial class MediaScan
|
||||
if(scsiReader.CanSeek)
|
||||
scsiReader.Seek(seekPos, out seekCur);
|
||||
else if(readcd)
|
||||
{
|
||||
_dev.ReadCd(out _, out _, seekPos, 2352, 1, MmcSectorTypes.AllTypes, false, false, true,
|
||||
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, _dev.Timeout,
|
||||
out seekCur);
|
||||
}
|
||||
else
|
||||
scsiReader.ReadBlock(out _, seekPos, out seekCur, out _, out _);
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ public sealed partial class MediaScan
|
||||
const ushort sdProfile = 0x0001;
|
||||
ushort blocksToRead = 128;
|
||||
uint blockSize = 512;
|
||||
bool byteAddressed = true;
|
||||
bool supportsCmd23 = false;
|
||||
var byteAddressed = true;
|
||||
var supportsCmd23 = false;
|
||||
|
||||
switch(_dev.Type)
|
||||
{
|
||||
@@ -108,8 +108,9 @@ public sealed partial class MediaScan
|
||||
{
|
||||
Decoders.SecureDigital.CSD csd = Decoders.SecureDigital.Decoders.DecodeCSD(cmdBuf);
|
||||
|
||||
results.Blocks = (ulong)(csd.Structure == 0 ? (csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2)
|
||||
: (csd.Size + 1) * 1024);
|
||||
results.Blocks = (ulong)(csd.Structure == 0
|
||||
? (csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2)
|
||||
: (csd.Size + 1) * 1024);
|
||||
|
||||
blockSize = (uint)Math.Pow(2, csd.ReadBlockLength);
|
||||
|
||||
@@ -126,8 +127,10 @@ public sealed partial class MediaScan
|
||||
sense = _dev.ReadScr(out cmdBuf, out _, timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
supportsCmd23 = Decoders.SecureDigital.Decoders.DecodeSCR(cmdBuf)?.CommandSupport.
|
||||
HasFlag(CommandSupport.SetBlockCount) ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -189,13 +192,13 @@ public sealed partial class MediaScan
|
||||
}
|
||||
}
|
||||
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
results.ProcessingTime = 0;
|
||||
double currentSpeed = 0;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
@@ -211,11 +214,15 @@ public sealed partial class MediaScan
|
||||
if(supportsCmd23 || blocksToRead == 1)
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead));
|
||||
else if(_useBufferedReads)
|
||||
{
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time_using_OS_buffered_reads,
|
||||
blocksToRead));
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_using_sequential_single_commands,
|
||||
blocksToRead));
|
||||
}
|
||||
|
||||
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, sdProfile);
|
||||
var mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, blocksToRead, false);
|
||||
@@ -223,7 +230,7 @@ public sealed partial class MediaScan
|
||||
|
||||
_scanStopwatch.Restart();
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
for(ulong i = 0; i < results.Blocks; i += blocksToRead)
|
||||
@@ -243,22 +250,30 @@ public sealed partial class MediaScan
|
||||
results.MinSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, ByteSize.FromBytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)results.Blocks);
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks,
|
||||
ByteSize.FromBytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)results.Blocks);
|
||||
|
||||
bool error;
|
||||
|
||||
if(blocksToRead == 1)
|
||||
{
|
||||
error = _dev.ReadSingleBlock(out cmdBuf, out _, (uint)i, blockSize, byteAddressed, timeout,
|
||||
out duration);
|
||||
}
|
||||
else if(supportsCmd23)
|
||||
{
|
||||
error = _dev.ReadWithBlockCount(out cmdBuf, out _, (uint)i, blockSize, blocksToRead, byteAddressed,
|
||||
timeout, out duration);
|
||||
}
|
||||
else if(_useBufferedReads)
|
||||
error = _dev.BufferedOsRead(out cmdBuf, (long)(i * blockSize), blockSize * blocksToRead, out duration);
|
||||
else
|
||||
{
|
||||
error = _dev.ReadMultipleUsingSingle(out cmdBuf, out _, (uint)i, blockSize, blocksToRead, byteAddressed,
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
if(!error)
|
||||
{
|
||||
@@ -330,12 +345,12 @@ public sealed partial class MediaScan
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
for(int i = 0; i < seekTimes; i++)
|
||||
for(var i = 0; i < seekTimes; i++)
|
||||
{
|
||||
if(_aborted || !_seekTest)
|
||||
break;
|
||||
|
||||
uint seekPos = (uint)rnd.Next((int)results.Blocks);
|
||||
var seekPos = (uint)rnd.Next((int)results.Blocks);
|
||||
|
||||
PulseProgress?.Invoke(string.Format(Localization.Core.Seeking_to_sector_0, seekPos));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user