Invert 'if' statements to reduce nesting.

This commit is contained in:
2022-11-13 21:14:18 +00:00
parent c316cef523
commit d64c48dc6d
23 changed files with 955 additions and 949 deletions

View File

@@ -842,8 +842,9 @@ public sealed class Checksum
dataChecksums.Add(chk);
}
if(enabled.HasFlag(EnableChecksum.Fletcher32))
{
if(!enabled.HasFlag(EnableChecksum.Fletcher32))
return dataChecksums;
chk = new ChecksumType
{
type = ChecksumTypeType.fletcher32,
@@ -851,7 +852,6 @@ public sealed class Checksum
};
dataChecksums.Add(chk);
}
return dataChecksums;
}

View File

@@ -179,13 +179,13 @@ public partial class Dump
break;
}
if(tmp.SequenceEqual(_gbaExtension))
{
if(!tmp.SequenceEqual(_gbaExtension))
continue;
gbaFound = true;
break;
}
}
if(!sfcFound &&
!genesisFound &&

View File

@@ -128,8 +128,9 @@ partial class Dump
bool tmpSense = dvdDecrypt.ReadTitleKey(out tmpBuf, out _, DvdCssKeyClass.DvdCssCppmOrCprm,
i + j, _dev.Timeout, out _);
if(!tmpSense)
{
if(tmpSense)
continue;
CSS_CPRM.TitleKey? titleKey = CSS.DecodeTitleKey(tmpBuf, dvdDecrypt.BusKey);
if(titleKey.HasValue)
@@ -184,7 +185,6 @@ partial class Dump
CSS.DecryptTitleKey(0, discKey, titleKey.Value.Key, out tmpBuf);
outputFormat.WriteSectorTag(tmpBuf, i + j, SectorTagType.DvdTitleKeyDecrypted);
}
}
if(!_storeEncrypted)

View File

@@ -347,13 +347,14 @@ partial class Dump
totalDuration += cmdDuration;
if(!sense &&
!_dev.Error)
{
if(sense || _dev.Error)
continue;
CSS_CPRM.TitleKey? titleKey = CSS.DecodeTitleKey(buffer, dvdDecrypt.BusKey);
if(titleKey.HasValue)
{
if(!titleKey.HasValue)
continue;
outputFormat.WriteSectorTag(new[]
{
titleKey.Value.CMI
@@ -393,8 +394,6 @@ partial class Dump
_dumpLog.WriteLine("Correctly retried title key {0} in pass {1}.", missingKey, pass);
}
}
}
}
if(pass < _retryPasses &&
!_aborted &&

View File

@@ -2022,14 +2022,15 @@ public sealed partial class DeviceReport
{
ctx.AddTask("Trying MediaTek READ DRAM command for Lead-Out...").IsIndeterminate();
if(mediaTest.Blocks > 0)
{
if(!(mediaTest.Blocks > 0))
return;
if(mediaType == "Audio CD" &&
mediaTest.SupportsReadCd == true)
{
_dev.ReadCd(out _, out _, (uint)(mediaTest.Blocks + 1), 2352, 1, MmcSectorTypes.Cdda, false,
false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None,
MmcSubchannel.None, _dev.Timeout, out _);
_dev.ReadCd(out _, out _, (uint)(mediaTest.Blocks + 1), 2352, 1, MmcSectorTypes.Cdda, false, false,
false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None,
_dev.Timeout, out _);
triedLeadOut = true;
}
@@ -2048,8 +2049,8 @@ public sealed partial class DeviceReport
mediaTest.SupportsReadCd == true)
{
_dev.ReadCd(out _, out _, (uint)(mediaTest.Blocks + 1), 2048, 1, MmcSectorTypes.AllTypes, false,
false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None,
MmcSubchannel.None, _dev.Timeout, out _);
false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None,
_dev.Timeout, out _);
triedLeadOut = true;
}
@@ -2060,28 +2061,29 @@ public sealed partial class DeviceReport
}
else if(mediaTest.SupportsRead10 == true)
{
_dev.Read10(out _, out _, 0, false, true, false, false, (uint)(mediaTest.Blocks + 1), 2048, 0,
1, _dev.Timeout, out _);
_dev.Read10(out _, out _, 0, false, true, false, false, (uint)(mediaTest.Blocks + 1), 2048, 0, 1,
_dev.Timeout, out _);
triedLeadOut = true;
}
else if(mediaTest.SupportsRead12 == true)
{
_dev.Read12(out _, out _, 0, false, true, false, false, (uint)(mediaTest.Blocks + 1), 2048, 0,
1, false, _dev.Timeout, out _);
_dev.Read12(out _, out _, 0, false, true, false, false, (uint)(mediaTest.Blocks + 1), 2048, 0, 1,
false, _dev.Timeout, out _);
triedLeadOut = true;
}
else if(mediaTest.SupportsRead16 == true)
{
_dev.Read16(out _, out _, 0, false, true, false, (ulong)(mediaTest.Blocks + 1), 2048, 0, 1,
false, _dev.Timeout, out _);
_dev.Read16(out _, out _, 0, false, true, false, (ulong)(mediaTest.Blocks + 1), 2048, 0, 1, false,
_dev.Timeout, out _);
triedLeadOut = true;
}
if(triedLeadOut)
{
if(!triedLeadOut)
return;
mediaTest.CanReadF1_06LeadOut =
!_dev.MediaTekReadDram(out buffer, out senseBuffer, 0, 0xB00, _dev.Timeout, out _);
@@ -2097,8 +2099,6 @@ public sealed partial class DeviceReport
}
AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadF1_06LeadOut);
}
}
});
}
@@ -2177,8 +2177,9 @@ public sealed partial class DeviceReport
false, MmcErrorField.None,
MmcSubchannel.Raw, _dev.Timeout, out _);
if(mediaTest.CanReadingIntersessionLeadOut == false)
{
if(mediaTest.CanReadingIntersessionLeadOut != false)
return;
mediaTest.CanReadingIntersessionLeadOut = !_dev.ReadCd(out buffer, out senseBuffer,
firstSessionLeadOutLba, 2368, 1,
MmcSectorTypes.AllTypes, false, false,
@@ -2189,13 +2190,10 @@ public sealed partial class DeviceReport
if(mediaTest.CanReadingIntersessionLeadOut == false)
mediaTest.CanReadingIntersessionLeadOut = !_dev.ReadCd(out buffer, out senseBuffer,
firstSessionLeadOutLba, 2352, 1,
MmcSectorTypes.AllTypes, false,
false, false,
MmcHeaderCodes.AllHeaders, true,
MmcSectorTypes.AllTypes, false, false,
false, MmcHeaderCodes.AllHeaders, true,
false, MmcErrorField.None,
MmcSubchannel.None, _dev.Timeout,
out _);
}
MmcSubchannel.None, _dev.Timeout, out _);
});
AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadingIntersessionLeadOut);
@@ -2213,8 +2211,9 @@ public sealed partial class DeviceReport
false, MmcErrorField.None,
MmcSubchannel.Raw, _dev.Timeout, out _);
if(mediaTest.CanReadingIntersessionLeadIn == false)
{
if(mediaTest.CanReadingIntersessionLeadIn != false)
return;
mediaTest.CanReadingIntersessionLeadIn = !_dev.ReadCd(out buffer, out senseBuffer,
secondSessionLeadInLba, 2368, 1,
MmcSectorTypes.AllTypes, false, false,
@@ -2226,11 +2225,9 @@ public sealed partial class DeviceReport
mediaTest.CanReadingIntersessionLeadIn = !_dev.ReadCd(out buffer, out senseBuffer,
secondSessionLeadInLba, 2352, 1,
MmcSectorTypes.AllTypes, false, false,
false, MmcHeaderCodes.AllHeaders,
true, false, MmcErrorField.None,
MmcSubchannel.None, _dev.Timeout,
out _);
}
false, MmcHeaderCodes.AllHeaders, true,
false, MmcErrorField.None,
MmcSubchannel.None, _dev.Timeout, out _);
});
AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadingIntersessionLeadIn);

View File

@@ -650,8 +650,10 @@ public sealed partial class DeviceReport
}
}
if((mediaTest.SupportsReadLong == true || mediaTest.SupportsReadLong16 == true) &&
mediaTest.LongBlockSize == mediaTest.BlockSize)
if(mediaTest.SupportsReadLong != true && mediaTest.SupportsReadLong16 != true ||
mediaTest.LongBlockSize != mediaTest.BlockSize)
return;
switch(mediaTest.BlockSize)
{
case 512:

View File

@@ -2222,8 +2222,9 @@ public static class MMC
break;
}
if(line.StartsWith("BOOT2=cdrom0:", StringComparison.InvariantCultureIgnoreCase))
{
if(!line.StartsWith("BOOT2=cdrom0:", StringComparison.InvariantCultureIgnoreCase))
continue;
ps2BootFile = line.Substring(13);
if(ps2BootFile.StartsWith('\\'))
@@ -2234,7 +2235,6 @@ public static class MMC
break;
}
}
if(ps1BootFile != null &&
rootEntries.Contains(ps1BootFile.ToUpperInvariant()))

View File

@@ -216,11 +216,11 @@ public sealed partial class Device : Devices.Device
}
#endregion FireWire
#region PCMCIA
if(dev._remote.GetPcmciaData(out byte[] cisBuf))
{
if(!dev._remote.GetPcmciaData(out byte[] cisBuf))
return dev;
dev.IsPcmcia = true;
dev.Cis = cisBuf;
}
#endregion PCMCIA
return dev;

View File

@@ -1238,15 +1238,15 @@ public class Remote : IDisposable
Array.Copy(res.ocr, 0, ocr, 0, res.ocr_len);
}
if(res.scr_len > 0)
{
if(res.scr_len <= 0)
return res.isSdhci;
if(res.scr_len > 16)
res.scr_len = 16;
scr = new byte[res.scr_len];
Array.Copy(res.scr, 0, scr, 0, res.scr_len);
}
return res.isSdhci;
}
@@ -1576,7 +1576,7 @@ public class Remote : IDisposable
/// <param name="sense">Set to <c>true</c> if any of the commands returned an error status, <c>false</c> otherwise</param>
/// <param name="timeout">Maximum allowed time to execute a single command</param>
/// <returns>0 if no error occurred, otherwise, errno</returns>
public int SendMultipleMmcCommands(Device.MmcSingleCommand[] commands, out double duration, out bool sense,
public int SendMultipleMmcCommands(Devices.Device.MmcSingleCommand[] commands, out double duration, out bool sense,
uint timeout = 0)
{
if(ServerProtocolVersion < 2)
@@ -1588,7 +1588,7 @@ public class Remote : IDisposable
long packetSize = Marshal.SizeOf<AaruPacketMultiCmdSdhci>() +
Marshal.SizeOf<AaruCmdSdhci>() * commands.LongLength;
foreach(Device.MmcSingleCommand command in commands)
foreach(Devices.Device.MmcSingleCommand command in commands)
packetSize += command.buffer?.Length ?? 0;
var packet = new AaruPacketMultiCmdSdhci
@@ -1630,7 +1630,7 @@ public class Remote : IDisposable
off += tmp.Length;
}
foreach(Device.MmcSingleCommand command in commands.Where(command => (command.buffer?.Length ?? 0) != 0))
foreach(Devices.Device.MmcSingleCommand command in commands.Where(command => (command.buffer?.Length ?? 0) != 0))
{
Array.Copy(command.buffer, 0, buf, off, command.buffer.Length);
@@ -1699,7 +1699,7 @@ public class Remote : IDisposable
var error = 0;
foreach(Device.MmcSingleCommand command in commands)
foreach(Devices.Device.MmcSingleCommand command in commands)
{
AaruResSdhci cmdRes =
Marshal.ByteArrayToStructureLittleEndian<AaruResSdhci>(buf, off, Marshal.SizeOf<AaruResSdhci>());
@@ -1720,7 +1720,7 @@ public class Remote : IDisposable
off += Marshal.SizeOf<AaruResSdhci>();
}
foreach(Device.MmcSingleCommand command in commands)
foreach(Devices.Device.MmcSingleCommand command in commands)
{
Array.Copy(buf, off, command.buffer, 0, command.buffer.Length);
off += command.buffer.Length;
@@ -1738,13 +1738,13 @@ public class Remote : IDisposable
/// <param name="sense">Set to <c>true</c> if any of the commands returned an error status, <c>false</c> otherwise</param>
/// <param name="timeout">Maximum allowed time to execute a single command</param>
/// <returns>0 if no error occurred, otherwise, errno</returns>
int SendMultipleMmcCommandsV1(Device.MmcSingleCommand[] commands, out double duration, out bool sense, uint timeout)
int SendMultipleMmcCommandsV1(Devices.Device.MmcSingleCommand[] commands, out double duration, out bool sense, uint timeout)
{
sense = false;
duration = 0;
var error = 0;
foreach(Device.MmcSingleCommand command in commands)
foreach(Devices.Device.MmcSingleCommand command in commands)
{
error = SendMmcCommand(command.command, command.write, command.isApplication, command.flags,
command.argument, command.blockSize, command.blocks, ref command.buffer,

View File

@@ -785,8 +785,9 @@ public sealed partial class FAT
return BpbKind.Atari;
}
if(useApricotBpb)
{
if(!useApricotBpb)
return BpbKind.None;
fakeBpb.bps = apricotBpb.mainBPB.bps;
fakeBpb.spc = apricotBpb.mainBPB.spc;
fakeBpb.rsectors = apricotBpb.mainBPB.rsectors;
@@ -801,12 +802,10 @@ public sealed partial class FAT
if(apricotBpb.bootLocation > 0 &&
apricotBpb.bootLocation + apricotBpb.bootSize < imagePlugin.Info.Sectors)
imagePlugin.ReadSectors(apricotBpb.bootLocation,
(uint)(apricotBpb.sectorSize * apricotBpb.bootSize) /
imagePlugin.Info.SectorSize, out fakeBpb.boot_code);
(uint)(apricotBpb.sectorSize * apricotBpb.bootSize) / imagePlugin.Info.SectorSize,
out fakeBpb.boot_code);
return BpbKind.Apricot;
}
return BpbKind.None;
}
}

View File

@@ -127,8 +127,13 @@ public sealed partial class ISO9660
offset += entry.XattrLength * _blockSize;
if(entry.CdiSystemArea?.attributes.HasFlag(CdiAttributes.DigitalAudio) == true &&
entry.Extents.Count == 1)
if(entry.CdiSystemArea?.attributes.HasFlag(CdiAttributes.DigitalAudio) != true ||
entry.Extents.Count != 1)
return ReadWithExtents(offset, size, entry.Extents,
entry.XA?.signature == XA_MAGIC &&
entry.XA?.attributes.HasFlag(XaAttributes.Interleaved) == true,
entry.XA?.filenumber ?? 0, out buf);
try
{
long firstSector = offset / 2352;

View File

@@ -127,17 +127,16 @@ public sealed partial class ISO9660
if(entry.AssociatedFile.Extents is null)
return ErrorNumber.InvalidArgument;
if(entry.AssociatedFile.Size == 0)
{
if(entry.AssociatedFile.Size != 0)
return ReadWithExtents(0, (long)entry.AssociatedFile.Size, entry.AssociatedFile.Extents,
entry.AssociatedFile.XA?.signature == XA_MAGIC &&
entry.AssociatedFile.XA?.attributes.HasFlag(XaAttributes.Interleaved) ==
true, entry.AssociatedFile.XA?.filenumber ?? 0, out buf);
buf = Array.Empty<byte>();
return ErrorNumber.NoError;
}
return ReadWithExtents(0, (long)entry.AssociatedFile.Size, entry.AssociatedFile.Extents,
entry.AssociatedFile.XA?.signature == XA_MAGIC &&
entry.AssociatedFile.XA?.attributes.HasFlag(XaAttributes.Interleaved) == true,
entry.AssociatedFile.XA?.filenumber ?? 0, out buf);
case "com.apple.dos.type":
if(entry.AppleDosType is null)
return ErrorNumber.NoSuchExtendedAttribute;
@@ -160,17 +159,16 @@ public sealed partial class ISO9660
if(entry.ResourceFork.Extents is null)
return ErrorNumber.InvalidArgument;
if(entry.ResourceFork.Size == 0)
{
buf = Array.Empty<byte>();
return ErrorNumber.NoError;
}
if(entry.ResourceFork.Size != 0)
return ReadWithExtents(0, (long)entry.ResourceFork.Size, entry.ResourceFork.Extents,
entry.ResourceFork.XA?.signature == XA_MAGIC &&
entry.ResourceFork.XA?.attributes.HasFlag(XaAttributes.Interleaved) == true,
entry.ResourceFork.XA?.filenumber ?? 0, out buf);
buf = Array.Empty<byte>();
return ErrorNumber.NoError;
case "com.apple.FinderInfo":
if(entry.FinderInfo is null)
return ErrorNumber.NoSuchExtendedAttribute;

View File

@@ -454,13 +454,13 @@ public sealed class BlockMap : ItemsControl
ctx.FillRectangle(new SolidColorBrush(color), new Rect(x, y, squareWidth, squareHeight));
x += squareWidth + 2 * borderWidth;
if(x >= sideLength)
{
if(x < sideLength)
continue;
x = 0;
y += squareHeight + 2 * borderWidth;
}
}
}
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
{

View File

@@ -595,8 +595,9 @@ public sealed class ScsiInfoViewModel : ViewModelBase
});
}
if(_configuration != null)
{
if(_configuration == null)
return;
Features.SeparatedFeatures ftr = Features.Separate(_configuration);
AaruConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION length is {0} bytes", ftr.DataLength);
@@ -682,7 +683,6 @@ public sealed class ScsiInfoViewModel : ViewModelBase
else
AaruConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION returned no feature descriptors");
}
}
public byte[] InquiryData { get; }
public string ScsiInquiryText { get; }

View File

@@ -563,12 +563,12 @@ public sealed partial class Alcohol120
extraCount += _writingTracks.Count(t => t.Session == i);
if(i < sessions)
{
if(i >= sessions)
continue;
currentExtraOffset += Marshal.SizeOf<Track>() * 2;
extraCount += 2;
}
}
long footerOffset = currentExtraOffset + Marshal.SizeOf<TrackExtra>() * extraCount;

View File

@@ -1302,9 +1302,11 @@ public sealed partial class BlindWrite5
AaruConsole.VerboseWriteLine("BlindWrite image describes a disc of type {0}", _imageInfo.MediaType);
if(_header.profile != ProfileNumber.CDR &&
_header.profile != ProfileNumber.CDRW &&
_header.profile != ProfileNumber.CDROM)
if(_header.profile == ProfileNumber.CDR ||
_header.profile == ProfileNumber.CDRW ||
_header.profile == ProfileNumber.CDROM)
return ErrorNumber.NoError;
foreach(Track track in Tracks)
{
track.Pregap = 0;

View File

@@ -726,77 +726,7 @@ public class GameBoy : IByteAddressableImage
[SuppressMessage("ReSharper", "StringLiteralTypo")]
string DecodeLicensee(byte headerLicensee, byte[] headerLicenseeNew)
{
if(headerLicensee == 0x33)
{
string licenseeNew = StringHandlers.CToString(headerLicenseeNew);
return licenseeNew switch
{
"00" => "none",
"01" => "Nintendo R&D1",
"08" => "Capcom",
"13" => "Electronic Arts",
"18" => "Hudson Soft",
"19" => "b-ai",
"20" => "kss",
"22" => "pow",
"24" => "PCM Complete",
"25" => "san-x",
"28" => "Kemco Japan",
"29" => "seta",
"30" => "Viacom",
"31" => "Nintendo",
"32" => "Bandai",
"33" => "Ocean / Acclaim",
"34" => "Konami",
"35" => "Hector",
"37" => "Taito",
"38" => "Hudson",
"39" => "Banpresto",
"41" => "Ubi Soft",
"42" => "Atlus",
"44" => "Malibu",
"46" => "angel",
"47" => "Bullet -Proof",
"49" => "irem",
"50" => "Absolute",
"51" => "Acclaim",
"52" => "Activision",
"53" => "American sammy",
"54" => "Konami",
"55" => "Hi tech entertainment",
"56" => "LJN",
"57" => "Matchbox",
"58" => "Mattel",
"59" => "Milton Bradley",
"60" => "Titus",
"61" => "Virgin",
"64" => "LucasArts",
"67" => "Ocean",
"69" => "Electronic Arts",
"70" => "Infogrames",
"71" => "Interplay",
"72" => "Brøderbund",
"73" => "sculptured",
"75" => "sci",
"78" => "THQ",
"79" => "Accolade",
"80" => "misawa",
"83" => "lozc",
"86" => "tokuma shoten i",
"87" => "tsukuda ori",
"91" => "Chunsoft",
"92" => "Video system",
"93" => "Ocean / Acclaim",
"95" => "Varie",
"96" => "Yonezawa / s'pal",
"97" => "Kaneko",
"99" => "Pack in soft",
"A4" => "Konami",
_ => "Unknown"
};
}
if(headerLicensee != 0x33)
return headerLicensee switch
{
0x00 => "none",
@@ -949,6 +879,75 @@ public class GameBoy : IByteAddressableImage
0xFF => "ljn",
_ => "Unknown"
};
string licenseeNew = StringHandlers.CToString(headerLicenseeNew);
return licenseeNew switch
{
"00" => "none",
"01" => "Nintendo R&D1",
"08" => "Capcom",
"13" => "Electronic Arts",
"18" => "Hudson Soft",
"19" => "b-ai",
"20" => "kss",
"22" => "pow",
"24" => "PCM Complete",
"25" => "san-x",
"28" => "Kemco Japan",
"29" => "seta",
"30" => "Viacom",
"31" => "Nintendo",
"32" => "Bandai",
"33" => "Ocean / Acclaim",
"34" => "Konami",
"35" => "Hector",
"37" => "Taito",
"38" => "Hudson",
"39" => "Banpresto",
"41" => "Ubi Soft",
"42" => "Atlus",
"44" => "Malibu",
"46" => "angel",
"47" => "Bullet -Proof",
"49" => "irem",
"50" => "Absolute",
"51" => "Acclaim",
"52" => "Activision",
"53" => "American sammy",
"54" => "Konami",
"55" => "Hi tech entertainment",
"56" => "LJN",
"57" => "Matchbox",
"58" => "Mattel",
"59" => "Milton Bradley",
"60" => "Titus",
"61" => "Virgin",
"64" => "LucasArts",
"67" => "Ocean",
"69" => "Electronic Arts",
"70" => "Infogrames",
"71" => "Interplay",
"72" => "Brøderbund",
"73" => "sculptured",
"75" => "sci",
"78" => "THQ",
"79" => "Accolade",
"80" => "misawa",
"83" => "lozc",
"86" => "tokuma shoten i",
"87" => "tsukuda ori",
"91" => "Chunsoft",
"92" => "Video system",
"93" => "Ocean / Acclaim",
"95" => "Varie",
"96" => "Yonezawa / s'pal",
"97" => "Kaneko",
"99" => "Pack in soft",
"A4" => "Konami",
_ => "Unknown"
};
}
static uint DecodeRomSize(byte headerRomType) => headerRomType switch

View File

@@ -83,13 +83,13 @@ public sealed partial class Gdi
if(lineNumber == 1)
{
if(!int.TryParse(line, out _))
{
if(int.TryParse(line, out _))
continue;
AaruConsole.ErrorWriteLine("Not a correct Dreamcast GDI image");
return ErrorNumber.InvalidArgument;
}
}
else
{
Match trackMatch = regexTrack.Match(line ?? "");

View File

@@ -168,8 +168,9 @@ public sealed class Xbox : IPartition
{
errno = imagePlugin.ReadSector((ulong)(XBOX_360DATA_OFF / imagePlugin.Info.SectorSize), out sector);
if(errno == ErrorNumber.NoError)
{
if(errno != ErrorNumber.NoError)
return false;
temp = BitConverter.ToUInt32(sector, 0);
if(temp != XBOX_CIGAM)
@@ -263,7 +264,6 @@ public sealed class Xbox : IPartition
return true;
}
}
return false;
}

View File

@@ -385,8 +385,9 @@ sealed class DecodeCommand : Command
break;
}
if(sectorTags)
{
if(!sectorTags)
return (int)ErrorNumber.NoError;
if(length.ToLowerInvariant() == "all") {}
else
{
@@ -412,7 +413,6 @@ sealed class DecodeCommand : Command
}
// TODO: Not implemented
}
return (int)ErrorNumber.NoError;
}

View File

@@ -173,10 +173,12 @@ sealed class VerifyCommand : Command
return (int)ErrorNumber.NotVerifiable;
}
TimeSpan checkTime;
if(verifyDisc && verifiableImage != null)
{
bool? discCheckStatus = null;
TimeSpan checkTime = new();
checkTime = new TimeSpan();
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -208,8 +210,14 @@ sealed class VerifyCommand : Command
AaruConsole.VerboseWriteLine("Checking disc image checksums took {0} seconds", checkTime.TotalSeconds);
}
if(verifySectors)
if(!verifySectors)
return correctImage switch
{
null => (int)ErrorNumber.NotVerifiable,
false => (int)ErrorNumber.BadImageSectorsNotVerified,
true => (int)ErrorNumber.CorrectImageSectorsNotVerified
};
DateTime startCheck = DateTime.Now;
DateTime endCheck = startCheck;
List<ulong> failingLbas = new();
@@ -231,8 +239,7 @@ sealed class VerifyCommand : Command
foreach(Track currentTrack in inputTracks)
{
discTask.Description =
$"Checking track {discTask.Value + 1} of {inputTracks.Count}";
discTask.Description = $"Checking track {discTask.Value + 1} of {inputTracks.Count}";
ulong remainingSectors = currentTrack.EndSector - currentTrack.StartSector + 1;
@@ -300,8 +307,7 @@ sealed class VerifyCommand : Command
while(remainingSectors > 0)
{
diskTask.Description =
$"Checking sector {currentSector} of {inputFormat.Info.Sectors}";
diskTask.Description = $"Checking sector {currentSector} of {inputFormat.Info.Sectors}";
List<ulong> tempFailingLbas;
List<ulong> tempUnknownLbas;
@@ -335,7 +341,7 @@ sealed class VerifyCommand : Command
});
}
TimeSpan checkTime = endCheck - startCheck;
checkTime = endCheck - startCheck;
if(unknownLbas.Count > 0)
AaruConsole.WriteLine("There is at least one sector that does not contain a checksum");
@@ -377,7 +383,6 @@ sealed class VerifyCommand : Command
correctSectors = false;
else if((ulong)unknownLbas.Count < inputFormat.Info.Sectors)
correctSectors = true;
}
return correctImage switch
{