Create output image.

This commit is contained in:
2019-12-14 21:41:18 +00:00
parent 26558512d4
commit 43cd299057

View File

@@ -111,6 +111,7 @@ namespace DiscImageChef.Core.Devices.Dumping
double maxSpeed = double.MinValue; double maxSpeed = double.MinValue;
double minSpeed = double.MaxValue; double minSpeed = double.MaxValue;
uint blocksToRead = 64; uint blocksToRead = 64;
bool ret;
Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>(); // Media tags Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>(); // Media tags
@@ -1141,12 +1142,26 @@ namespace DiscImageChef.Core.Devices.Dumping
UpdateStatus?.Invoke($"Device reports {blockSize} bytes per logical block."); UpdateStatus?.Invoke($"Device reports {blockSize} bytes per logical block.");
UpdateStatus?.Invoke($"SCSI device type: {dev.ScsiType}."); UpdateStatus?.Invoke($"SCSI device type: {dev.ScsiType}.");
UpdateStatus?.Invoke($"Media identified as {dskType}."); UpdateStatus?.Invoke($"Media identified as {dskType}.");
ret = outputPlugin.Create(outputPath, dskType, formatOptions, blocks,
supportsLongSectors ? blockSize : 2048);
// Cannot create image
if(!ret)
{
dumpLog.WriteLine("Error creating output image, not continuing.");
dumpLog.WriteLine(outputPlugin.ErrorMessage);
StoppingErrorMessage?.Invoke("Error creating output image, not continuing." + Environment.NewLine +
outputPlugin.ErrorMessage);
}
} }
/// <summary>Dumps a compact disc</summary> /// <summary>Dumps a compact disc</summary>
/// <param name="dskType">Disc type as detected in MMC layer</param> /// <param name="dskType">Disc type as detected in MMC layer</param>
internal void CompactDiscOld(ref MediaType dskType) internal void CompactDiscOld(ref MediaType dskType)
{ {
bool ret;
ulong blocks = 0; ulong blocks = 0;
Track[] tracks = new Track[0]; Track[] tracks = new Track[0];
List<Track> trackList = new List<Track>(); List<Track> trackList = new List<Track>();
@@ -1172,37 +1187,19 @@ namespace DiscImageChef.Core.Devices.Dumping
byte[] cmdBuf = null; byte[] cmdBuf = null;
byte[] senseBuf = null; byte[] senseBuf = null;
byte[] tmpBuf; byte[] tmpBuf;
MmcSubchannel supportedSubchannel = MmcSubchannel.Raw; MmcSubchannel supportedSubchannel = MmcSubchannel.Raw;
TrackSubchannelType subType = TrackSubchannelType.None; // Track subchannel type TrackSubchannelType subType = TrackSubchannelType.None; // Track subchannel type
bool supportsLongSectors = true; bool supportsLongSectors = true;
int sessions = 1;
int sessions = 1; int firstTrackLastSession = 0;
int firstTrackLastSession = 0; DumpHardwareType currentTry = null;
ExtentsULong extents = null;
DumpHardwareType currentTry = null; DateTime timeSpeedStart = DateTime.UtcNow;
ExtentsULong extents = null; ulong sectorSpeedStart = 0;
DateTime timeSpeedStart = DateTime.UtcNow;
ulong sectorSpeedStart = 0;
var mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead); var mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
var ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0008); var ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0008);
bool ret = outputPlugin.Create(outputPath, dskType, formatOptions, blocks,
supportsLongSectors ? blockSize : 2048);
// Cannot create image
if(!ret)
{
dumpLog.WriteLine("Error creating output image, not continuing.");
dumpLog.WriteLine(outputPlugin.ErrorMessage);
StoppingErrorMessage?.Invoke("Error creating output image, not continuing." + Environment.NewLine +
outputPlugin.ErrorMessage);
return;
}
// Send tracklist to output plugin. This may fail if subchannel is set but unsupported. // Send tracklist to output plugin. This may fail if subchannel is set but unsupported.
ret = (outputPlugin as IWritableOpticalImage).SetTracks(tracks.ToList()); ret = (outputPlugin as IWritableOpticalImage).SetTracks(tracks.ToList());