Use database to check for maximum number of sectors to dump at once.

This commit is contained in:
2019-12-26 01:41:05 +00:00
parent 0d86e70f2e
commit c57a42aaa3
3 changed files with 19 additions and 11 deletions

View File

@@ -120,7 +120,7 @@ namespace DiscImageChef.Core.Devices.Dumping
} }
// Check how many blocks to read, if error show and return // Check how many blocks to read, if error show and return
if(ataReader.GetBlocksToRead()) if(ataReader.GetBlocksToRead(_maximumReadable))
{ {
_dumpLog.WriteLine("ERROR: Cannot get blocks to read: {0}.", ataReader.ErrorMessage); _dumpLog.WriteLine("ERROR: Cannot get blocks to read: {0}.", ataReader.ErrorMessage);
ErrorMessage(ataReader.ErrorMessage); ErrorMessage(ataReader.ErrorMessage);
@@ -612,8 +612,7 @@ namespace DiscImageChef.Core.Devices.Dumping
DateTime chkStart = DateTime.UtcNow; DateTime chkStart = DateTime.UtcNow;
_sidecarClass = _sidecarClass = new Sidecar(inputPlugin, _outputPath, filter.Id, _encoding);
new Sidecar(inputPlugin, _outputPath, filter.Id, _encoding);
_sidecarClass.InitProgressEvent += InitProgress; _sidecarClass.InitProgressEvent += InitProgress;
_sidecarClass.UpdateProgressEvent += UpdateProgress; _sidecarClass.UpdateProgressEvent += UpdateProgress;

View File

@@ -108,7 +108,7 @@ namespace DiscImageChef.Core.Devices.Dumping
} }
// Check how many blocks to read, if error show and return // Check how many blocks to read, if error show and return
if(scsiReader.GetBlocksToRead()) if(scsiReader.GetBlocksToRead(_maximumReadable))
{ {
_dumpLog.WriteLine("ERROR: Cannot get blocks to read: {0}.", scsiReader.ErrorMessage); _dumpLog.WriteLine("ERROR: Cannot get blocks to read: {0}.", scsiReader.ErrorMessage);
StoppingErrorMessage?.Invoke(scsiReader.ErrorMessage); StoppingErrorMessage?.Invoke(scsiReader.ErrorMessage);

View File

@@ -37,13 +37,11 @@ using DiscImageChef.Devices;
namespace DiscImageChef.Core.Devices namespace DiscImageChef.Core.Devices
{ {
/// <summary> /// <summary>Reduces common code used for scanning and dumping</summary>
/// Reduces common code used for scanning and dumping internal partial class Reader
/// </summary>
partial class Reader
{ {
Device dev; readonly Device dev;
uint timeout; readonly uint timeout;
internal Reader(Device dev, uint timeout, byte[] identification, bool raw = false) internal Reader(Device dev, uint timeout, byte[] identification, bool raw = false)
{ {
@@ -56,7 +54,10 @@ namespace DiscImageChef.Core.Devices
{ {
case DeviceType.ATA: case DeviceType.ATA:
Identify.IdentifyDevice? ataIdNullable = Identify.Decode(identification); Identify.IdentifyDevice? ataIdNullable = Identify.Decode(identification);
if(ataIdNullable.HasValue) ataId = ataIdNullable.Value;
if(ataIdNullable.HasValue)
ataId = ataIdNullable.Value;
break; break;
case DeviceType.NVMe: throw new NotImplementedException("NVMe devices not yet supported."); case DeviceType.NVMe: throw new NotImplementedException("NVMe devices not yet supported.");
} }
@@ -81,6 +82,7 @@ namespace DiscImageChef.Core.Devices
case DeviceType.SCSI: return ScsiGetBlocks(); case DeviceType.SCSI: return ScsiGetBlocks();
default: default:
ErrorMessage = $"Unknown device type {dev.Type}."; ErrorMessage = $"Unknown device type {dev.Type}.";
return 0; return 0;
} }
} }
@@ -94,6 +96,7 @@ namespace DiscImageChef.Core.Devices
case DeviceType.SCSI: return ScsiFindReadCommand(); case DeviceType.SCSI: return ScsiFindReadCommand();
default: default:
ErrorMessage = $"Unknown device type {dev.Type}."; ErrorMessage = $"Unknown device type {dev.Type}.";
return true; return true;
} }
} }
@@ -107,6 +110,7 @@ namespace DiscImageChef.Core.Devices
case DeviceType.SCSI: return ScsiGetBlockSize(); case DeviceType.SCSI: return ScsiGetBlockSize();
default: default:
ErrorMessage = $"Unknown device type {dev.Type}."; ErrorMessage = $"Unknown device type {dev.Type}.";
return true; return true;
} }
} }
@@ -120,6 +124,7 @@ namespace DiscImageChef.Core.Devices
case DeviceType.SCSI: return ScsiGetBlocksToRead(startWithBlocks); case DeviceType.SCSI: return ScsiGetBlocksToRead(startWithBlocks);
default: default:
ErrorMessage = $"Unknown device type {dev.Type}."; ErrorMessage = $"Unknown device type {dev.Type}.";
return true; return true;
} }
} }
@@ -140,6 +145,7 @@ namespace DiscImageChef.Core.Devices
default: default:
buffer = null; buffer = null;
duration = 0d; duration = 0d;
return true; return true;
} }
} }
@@ -152,6 +158,7 @@ namespace DiscImageChef.Core.Devices
default: default:
buffer = null; buffer = null;
duration = 0d; duration = 0d;
return true; return true;
} }
} }
@@ -165,6 +172,7 @@ namespace DiscImageChef.Core.Devices
case DeviceType.SCSI: return ScsiSeek(block, out duration); case DeviceType.SCSI: return ScsiSeek(block, out duration);
default: default:
duration = 0d; duration = 0d;
return true; return true;
} }
} }
@@ -176,6 +184,7 @@ namespace DiscImageChef.Core.Devices
case DeviceType.ATA: return AtaSeekChs(cylinder, head, sector, out duration); case DeviceType.ATA: return AtaSeekChs(cylinder, head, sector, out duration);
default: default:
duration = 0; duration = 0;
return true; return true;
} }
} }