From 0dd475f520b488b4d7b6d109988fb8135a4f54ea Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 10 Apr 2018 05:44:57 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9BCorrect=20status=20printing=20on=20?= =?UTF-8?q?verify=20command.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DiscImageChef/Commands/Verify.cs | 44 +++++++++----------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/DiscImageChef/Commands/Verify.cs b/DiscImageChef/Commands/Verify.cs index 26860ad7..f495da3d 100644 --- a/DiscImageChef/Commands/Verify.cs +++ b/DiscImageChef/Commands/Verify.cs @@ -116,7 +116,6 @@ namespace DiscImageChef.Commands DateTime endCheck; List failingLbas = new List(); List unknownLbas = new List(); - bool? checkStatus = null; if(formatHasTracks) { @@ -136,21 +135,15 @@ namespace DiscImageChef.Commands List tempfailingLbas; List tempunknownLbas; - bool? tempStatus; if(remainingSectors < 512) - tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors, + inputFormat.VerifySectors(currentSector, (uint)remainingSectors, currentTrack.TrackSequence, out tempfailingLbas, out tempunknownLbas); else - tempStatus = inputFormat.VerifySectors(currentSector, 512, currentTrack.TrackSequence, + inputFormat.VerifySectors(currentSector, 512, currentTrack.TrackSequence, out tempfailingLbas, out tempunknownLbas); - if(checkStatus == null || tempStatus == null) checkStatus = null; - else if(checkStatus == false || tempStatus == false) checkStatus = false; - else if(checkStatus == true && tempStatus == true) checkStatus = true; - else checkStatus = null; - failingLbas.AddRange(tempfailingLbas); unknownLbas.AddRange(tempunknownLbas); @@ -184,19 +177,12 @@ namespace DiscImageChef.Commands List tempfailingLbas; List tempunknownLbas; - bool? tempStatus; if(remainingSectors < 512) - tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors, + inputFormat.VerifySectors(currentSector, (uint)remainingSectors, out tempfailingLbas, out tempunknownLbas); else - tempStatus = - inputFormat.VerifySectors(currentSector, 512, out tempfailingLbas, out tempunknownLbas); - - if(checkStatus == null || tempStatus == null) checkStatus = null; - else if(checkStatus == false || tempStatus == false) checkStatus = false; - else if(checkStatus == true && tempStatus == true) checkStatus = true; - else checkStatus = null; + inputFormat.VerifySectors(currentSector, 512, out tempfailingLbas, out tempunknownLbas); failingLbas.AddRange(tempfailingLbas); @@ -219,21 +205,15 @@ namespace DiscImageChef.Commands TimeSpan checkTime = endCheck - startCheck; - DicConsole.Write("\r"); - - switch(checkStatus) - { - case true: - DicConsole.WriteLine("All sector checksums are correct"); - break; - case false: - DicConsole.WriteLine("There is at least one sector with incorrect checksum or errors"); - break; - case null: - DicConsole.WriteLine("There is at least one sector that does not contain a checksum"); - break; - } + DicConsole.Write("\r" + new string(' ', System.Console.WindowWidth-1) + "\r"); + if(unknownSectors > 0) + DicConsole.WriteLine("There is at least one sector that does not contain a checksum"); + if(errorSectors > 0) + DicConsole.WriteLine("There is at least one sector with incorrect checksum or errors"); + if(unknownSectors == 0 && errorSectors == 0) + DicConsole.WriteLine("All sector checksums are correct"); + DicConsole.VerboseWriteLine("Checking sector checksums took {0} seconds", checkTime.TotalSeconds); if(options.Verbose)