From 217fd1efa611bfb29a45bf62566bf3cfe6c7083b Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 7 Nov 2020 13:00:31 +0000 Subject: [PATCH] Move image creation in multimedia SBC dump until after retrieval of track list. Fixes #414 --- Aaru.Core/Devices/Dumping/Sbc/Dump.cs | 60 ++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs index 19a706792..4d0e8efb4 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs @@ -336,20 +336,27 @@ namespace Aaru.Core.Devices.Dumping UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time."); _dumpLog.WriteLine("Reading {0} sectors at a time.", blocksToRead); - var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private); - var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); - ret = _outputPlugin.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); + var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private); + var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); + bool imageCreated = false; - // Cannot create image - if(!ret) + if(!opticalDisc) { - _dumpLog.WriteLine("Error creating output image, not continuing."); - _dumpLog.WriteLine(_outputPlugin.ErrorMessage); + ret = _outputPlugin.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); - StoppingErrorMessage?.Invoke("Error creating output image, not continuing." + Environment.NewLine + - _outputPlugin.ErrorMessage); + // Cannot create image + if(!ret) + { + _dumpLog.WriteLine("Error creating output image, not continuing."); + _dumpLog.WriteLine(_outputPlugin.ErrorMessage); - return; + StoppingErrorMessage?.Invoke("Error creating output image, not continuing." + Environment.NewLine + + _outputPlugin.ErrorMessage); + + return; + } + + imageCreated = true; } start = DateTime.UtcNow; @@ -468,6 +475,22 @@ namespace Aaru.Core.Devices.Dumping tracks = tracks.OrderBy(t => t.TrackSequence).ToList(); + ret = _outputPlugin.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); + + // 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; + } + + imageCreated = true; + #if DEBUG foreach(Track trk in tracks) UpdateStatus?. @@ -562,6 +585,23 @@ namespace Aaru.Core.Devices.Dumping } } + if(!imageCreated) + { + ret = _outputPlugin.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); + + // 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; + } + } + DumpHardwareType currentTry = null; ExtentsULong extents = null;