From 89af24a80e179dfbb8c8f3788f3f2aaa80df5e97 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 30 Jan 2020 23:10:21 +0000 Subject: [PATCH] Change order of checking SBC media type. --- DiscImageChef.Core/Devices/Dumping/SBC.cs | 76 +++++++++++------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/DiscImageChef.Core/Devices/Dumping/SBC.cs b/DiscImageChef.Core/Devices/Dumping/SBC.cs index cf203a452..d971e4b39 100644 --- a/DiscImageChef.Core/Devices/Dumping/SBC.cs +++ b/DiscImageChef.Core/Devices/Dumping/SBC.cs @@ -92,44 +92,6 @@ namespace DiscImageChef.Core.Devices.Dumping ulong blocks = scsiReader.GetDeviceBlocks(); uint blockSize = scsiReader.LogicalBlockSize; - if(scsiReader.FindReadCommand()) - { - _dumpLog.WriteLine("ERROR: Cannot find correct read command: {0}.", scsiReader.ErrorMessage); - StoppingErrorMessage?.Invoke("Unable to read medium."); - - return; - } - - if(blocks != 0 && - blockSize != 0) - { - blocks++; - - UpdateStatus?. - Invoke($"Media has {blocks} blocks of {blockSize} bytes/each. (for a total of {blocks * (ulong)blockSize} bytes)"); - } - - // Check how many blocks to read, if error show and return - if(scsiReader.GetBlocksToRead(_maximumReadable)) - { - _dumpLog.WriteLine("ERROR: Cannot get blocks to read: {0}.", scsiReader.ErrorMessage); - StoppingErrorMessage?.Invoke(scsiReader.ErrorMessage); - - return; - } - - uint blocksToRead = scsiReader.BlocksToRead; - uint logicalBlockSize = blockSize; - uint physicalBlockSize = scsiReader.PhysicalBlockSize; - - if(blocks == 0) - { - _dumpLog.WriteLine("ERROR: Unable to read medium or empty medium present..."); - StoppingErrorMessage?.Invoke("Unable to read medium or empty medium present..."); - - return; - } - if(!opticalDisc) { mediaTags = new Dictionary(); @@ -215,6 +177,44 @@ namespace DiscImageChef.Core.Devices.Dumping containsFloppyPage) dskType = MediaType.FlashDrive; + if(scsiReader.FindReadCommand()) + { + _dumpLog.WriteLine("ERROR: Cannot find correct read command: {0}.", scsiReader.ErrorMessage); + StoppingErrorMessage?.Invoke("Unable to read medium."); + + return; + } + + if(blocks != 0 && + blockSize != 0) + { + blocks++; + + UpdateStatus?. + Invoke($"Media has {blocks} blocks of {blockSize} bytes/each. (for a total of {blocks * (ulong)blockSize} bytes)"); + } + + // Check how many blocks to read, if error show and return + if(scsiReader.GetBlocksToRead(_maximumReadable)) + { + _dumpLog.WriteLine("ERROR: Cannot get blocks to read: {0}.", scsiReader.ErrorMessage); + StoppingErrorMessage?.Invoke(scsiReader.ErrorMessage); + + return; + } + + uint blocksToRead = scsiReader.BlocksToRead; + uint logicalBlockSize = blockSize; + uint physicalBlockSize = scsiReader.PhysicalBlockSize; + + if(blocks == 0) + { + _dumpLog.WriteLine("ERROR: Unable to read medium or empty medium present..."); + StoppingErrorMessage?.Invoke("Unable to read medium or empty medium present..."); + + return; + } + UpdateStatus?.Invoke($"Device reports {blocks} blocks ({blocks * blockSize} bytes)."); UpdateStatus?.Invoke($"Device can read {blocksToRead} blocks at a time."); UpdateStatus?.Invoke($"Device reports {blockSize} bytes per logical block.");