From c1f8c8b8a7c8a7691b0ffe6d8d3bfab18cd24ad0 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 30 Sep 2021 02:26:33 +0100 Subject: [PATCH] Fix setting tracks in image when non-CD optical disc does not return a proper track list. Fixes #675 --- Aaru.Core/Devices/Dumping/Sbc/Dump.cs | 48 +++++++++++++-------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs index 7f433bc2e..f494ef46d 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs @@ -367,7 +367,8 @@ namespace Aaru.Core.Devices.Dumping } start = DateTime.UtcNow; - double imageWriteDuration = 0; + double imageWriteDuration = 0; + bool writeSingleOpticalTrack = true; if(opticalDisc) { @@ -376,8 +377,6 @@ namespace Aaru.Core.Devices.Dumping sense = _dev.ReadDiscInformation(out readBuffer, out _, MmcDiscInformationDataTypes.DiscInformation, _dev.Timeout, out _); - bool writeSingleOpticalTrack = true; - if(!sense) { DiscInformation.StandardDiscInformation? discInformation = @@ -560,28 +559,6 @@ namespace Aaru.Core.Devices.Dumping }); } } - - if(writeSingleOpticalTrack) - { - _dumpLog.WriteLine("Creating single track as could not retrieve track list from drive."); - - StoppingErrorMessage?. - Invoke("Creating single track as could not retrieve track list from drive."); - - opticalPlugin.SetTracks(new List - { - new() - { - BytesPerSector = (int)blockSize, - EndSector = blocks - 1, - Sequence = 1, - RawBytesPerSector = (int)blockSize, - SubchannelType = TrackSubchannelType.None, - Session = 1, - Type = TrackType.Data - } - }); - } } else { @@ -653,6 +630,27 @@ namespace Aaru.Core.Devices.Dumping return; } + + if(writeSingleOpticalTrack) + { + _dumpLog.WriteLine("Creating single track as could not retrieve track list from drive."); + + UpdateStatus?.Invoke("Creating single track as could not retrieve track list from drive."); + + (_outputPlugin as IWritableOpticalImage)?.SetTracks(new List + { + new() + { + BytesPerSector = (int)blockSize, + EndSector = blocks - 1, + Sequence = 1, + RawBytesPerSector = (int)blockSize, + SubchannelType = TrackSubchannelType.None, + Session = 1, + Type = TrackType.Data + } + }); + } } DumpHardwareType currentTry = null;