Convert into '?:' expression.

This commit is contained in:
2022-11-14 01:27:11 +00:00
parent 2b40eab0d2
commit ad2d0b8a24
7 changed files with 12 additions and 27 deletions

View File

@@ -237,10 +237,9 @@ public partial class Device
Error = LastError != 0; Error = LastError != 0;
if(transferLength > 1) AaruConsole.DebugWriteLine("MMC Device",
AaruConsole.DebugWriteLine("MMC Device", "READ_MULTIPLE_BLOCK took {0} ms.", duration); transferLength > 1 ? "READ_MULTIPLE_BLOCK took {0} ms."
else : "READ_SINGLE_BLOCK took {0} ms.", duration);
AaruConsole.DebugWriteLine("MMC Device", "READ_SINGLE_BLOCK took {0} ms.", duration);
return sense; return sense;
} }

View File

@@ -70,10 +70,7 @@ public partial class Device
cdb[3] = (byte)(lba & 0xFF); cdb[3] = (byte)(lba & 0xFF);
cdb[4] = transferLength; cdb[4] = transferLength;
if(transferLength == 0) buffer = transferLength == 0 ? new byte[256 * blockSize] : new byte[transferLength * blockSize];
buffer = new byte[256 * blockSize];
else
buffer = new byte[transferLength * blockSize];
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
out bool sense); out bool sense);

View File

@@ -3897,10 +3897,9 @@ public sealed partial class AaruFormat
subchannelBlock.cmpCrc64 = BitConverter.ToUInt64(blockCrc, 0); subchannelBlock.cmpCrc64 = BitConverter.ToUInt64(blockCrc, 0);
if(_compressionAlgorithm == CompressionType.Lzma) subchannelBlock.compression = _compressionAlgorithm == CompressionType.Lzma
subchannelBlock.compression = CompressionType.LzmaClauniaSubchannelTransform; ? CompressionType.LzmaClauniaSubchannelTransform
else : _compressionAlgorithm;
subchannelBlock.compression = _compressionAlgorithm;
endCompress = DateTime.Now; endCompress = DateTime.Now;

View File

@@ -109,12 +109,8 @@ public sealed partial class Dart
if(stream.Length > expectedMaxSize) if(stream.Length > expectedMaxSize)
return ErrorNumber.InvalidArgument; return ErrorNumber.InvalidArgument;
short[] bLength; var bLength =
new short[header.srcType is DISK_MAC_HD or DISK_DOS_HD ? BLOCK_ARRAY_LEN_HIGH : BLOCK_ARRAY_LEN_LOW];
if(header.srcType is DISK_MAC_HD or DISK_DOS_HD)
bLength = new short[BLOCK_ARRAY_LEN_HIGH];
else
bLength = new short[BLOCK_ARRAY_LEN_LOW];
for(var i = 0; i < bLength.Length; i++) for(var i = 0; i < bLength.Length; i++)
{ {

View File

@@ -72,10 +72,7 @@ public sealed class AppleMap : IPartition
{ {
uint sectorSize; uint sectorSize;
if(imagePlugin.Info.SectorSize is 2352 or 2448) sectorSize = imagePlugin.Info.SectorSize is 2352 or 2448 ? 2048 : imagePlugin.Info.SectorSize;
sectorSize = 2048;
else
sectorSize = imagePlugin.Info.SectorSize;
partitions = new List<Partition>(); partitions = new List<Partition>();

View File

@@ -78,10 +78,7 @@ public sealed class NeXTDisklabel : IPartition
uint sectorSize; uint sectorSize;
if(imagePlugin.Info.SectorSize is 2352 or 2448) sectorSize = imagePlugin.Info.SectorSize is 2352 or 2448 ? 2048 : imagePlugin.Info.SectorSize;
sectorSize = 2048;
else
sectorSize = imagePlugin.Info.SectorSize;
partitions = new List<Partition>(); partitions = new List<Partition>();