mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] Convert to switch expressions.
This commit is contained in:
@@ -398,18 +398,11 @@ sealed partial class Dump
|
||||
break;
|
||||
}
|
||||
|
||||
switch(desiredSubchannel)
|
||||
{
|
||||
case MmcSubchannel.None:
|
||||
subType = TrackSubchannelType.None;
|
||||
|
||||
break;
|
||||
case MmcSubchannel.Raw:
|
||||
case MmcSubchannel.Q16:
|
||||
subType = TrackSubchannelType.Raw;
|
||||
|
||||
break;
|
||||
}
|
||||
subType = desiredSubchannel switch
|
||||
{
|
||||
MmcSubchannel.None => TrackSubchannelType.None,
|
||||
MmcSubchannel.Raw or MmcSubchannel.Q16 => TrackSubchannelType.Raw
|
||||
};
|
||||
|
||||
blockSize = sectorSize + subSize;
|
||||
|
||||
|
||||
@@ -91,15 +91,11 @@ partial class Dump
|
||||
|
||||
if(opticalDisc)
|
||||
{
|
||||
switch(dskType)
|
||||
{
|
||||
case MediaType.REV35:
|
||||
case MediaType.REV70:
|
||||
case MediaType.REV120:
|
||||
opticalDisc = false;
|
||||
|
||||
break;
|
||||
}
|
||||
opticalDisc = dskType switch
|
||||
{
|
||||
MediaType.REV35 or MediaType.REV70 or MediaType.REV120 => false,
|
||||
_ => opticalDisc
|
||||
};
|
||||
}
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Initializing_reader);
|
||||
|
||||
@@ -81,21 +81,14 @@ public sealed partial class MediaScan
|
||||
/// <exception cref="NotSupportedException">Unknown device type</exception>
|
||||
public ScanResults Scan()
|
||||
{
|
||||
switch(_dev.Type)
|
||||
{
|
||||
case DeviceType.ATA:
|
||||
return Ata();
|
||||
case DeviceType.MMC:
|
||||
case DeviceType.SecureDigital:
|
||||
return SecureDigital();
|
||||
case DeviceType.NVMe:
|
||||
return Nvme();
|
||||
case DeviceType.ATAPI:
|
||||
case DeviceType.SCSI:
|
||||
return Scsi();
|
||||
default:
|
||||
throw new NotSupportedException(Localization.Core.Unknown_device_type);
|
||||
}
|
||||
return _dev.Type switch
|
||||
{
|
||||
DeviceType.ATA => Ata(),
|
||||
DeviceType.MMC or DeviceType.SecureDigital => SecureDigital(),
|
||||
DeviceType.NVMe => Nvme(),
|
||||
DeviceType.ATAPI or DeviceType.SCSI => Scsi(),
|
||||
_ => throw new NotSupportedException(Localization.Core.Unknown_device_type)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Aborts the running media scan</summary>
|
||||
|
||||
Reference in New Issue
Block a user