Convert to switch expression.

This commit is contained in:
2022-11-13 19:59:24 +00:00
parent c5b34ee3d9
commit fca57318f5
58 changed files with 1434 additions and 2456 deletions

View File

@@ -419,21 +419,12 @@ public sealed class ImageVerifyViewModel : ViewModelBase
{
ImageResultVisible = true;
switch(discCheckStatus)
{
case true:
ImageResultText = "Disc image checksums are correct";
break;
case false:
ImageResultText = "Disc image checksums are incorrect";
break;
case null:
ImageResultText = "Disc image does not contain checksums";
break;
}
ImageResultText = discCheckStatus switch
{
true => "Disc image checksums are correct",
false => "Disc image checksums are incorrect",
null => "Disc image does not contain checksums"
};
});
AaruConsole.VerboseWriteLine("Checking disc image checksums took {0} seconds", checkTime.TotalSeconds);
@@ -493,8 +484,8 @@ public sealed class ImageVerifyViewModel : ViewModelBase
{
Progress2Value = all / 512d;
Progress2Text =
$"Checking sector {all} of {_inputFormat.Info.Sectors}, on track {currentTrack.Sequence}";
Progress2Text = $"Checking sector {all} of {_inputFormat.Info.Sectors}, on track {
currentTrack.Sequence}";
});
List<ulong> tempFailingLbas;

View File

@@ -450,25 +450,13 @@ public sealed class MediaScanViewModel : ViewModelBase
case 0x0020:
case 0x0021:
case 0x0022:
switch(blocks)
{
case <= 360000:
MaxX = 360000;
break;
case <= 405000:
MaxX = 405000;
break;
case <= 445500:
MaxX = 445500;
break;
default:
MaxX = blocks;
break;
}
MaxX = blocks switch
{
<= 360000 => 360000,
<= 405000 => 405000,
<= 445500 => 445500,
_ => blocks
};
StepsX = MaxX / 10;
StepsY = 150 * 4;
@@ -504,29 +492,14 @@ public sealed class MediaScanViewModel : ViewModelBase
case 0x0042:
case 0x0043:
case 0x0040: // BD
switch(blocks)
{
case <= 12219392:
MaxX = 12219392;
break;
case <= 24438784:
MaxX = 24438784;
break;
case <= 48878592:
MaxX = 48878592;
break;
case <= 62500864:
MaxX = 62500864;
break;
default:
MaxX = blocks;
break;
}
MaxX = blocks switch
{
<= 12219392 => 12219392,
<= 24438784 => 24438784,
<= 48878592 => 48878592,
<= 62500864 => 62500864,
_ => blocks
};
StepsX = MaxX / 10;
StepsY = 4394.5;
@@ -539,21 +512,12 @@ public sealed class MediaScanViewModel : ViewModelBase
case 0x0053:
case 0x0058:
case 0x005A:
switch(blocks)
{
case <= 7361599:
MaxX = 7361599;
break;
case <= 16305407:
MaxX = 16305407;
break;
default:
MaxX = blocks;
break;
}
MaxX = blocks switch
{
<= 7361599 => 7361599,
<= 16305407 => 16305407,
_ => blocks
};
StepsX = MaxX / 10;
StepsY = 4394.5;