Merge into pattern.

This commit is contained in:
2021-08-17 18:24:01 +01:00
parent fdff1d74c9
commit 4fcaeffc85
7 changed files with 9 additions and 17 deletions

View File

@@ -324,8 +324,7 @@ namespace Aaru.Core.Devices.Dumping
DecodedSense? decSense = Sense.Decode(senseBuf);
// MEDIUM ERROR, retry with ignore error below
if(decSense.HasValue &&
decSense.Value.ASC == 0x11)
if(decSense is { ASC: 0x11 })
if(!sectorsNotEvenPartial.Contains(badSector))
sectorsNotEvenPartial.Add(badSector);
}

View File

@@ -1518,8 +1518,7 @@ namespace Aaru.Core.Media.Detection
return;
}
if(ps2BootSectors != null &&
ps2BootSectors.Length == 0x6000)
if(ps2BootSectors is { Length: 0x6000 })
{
// The decryption key is applied as XOR. As first byte is originally always NULL, it gives us the key :)
byte decryptByte = ps2BootSectors[0];
@@ -2337,8 +2336,7 @@ namespace Aaru.Core.Media.Detection
case MediaType.UHDBD:
case MediaType.Unknown:
// TODO: Nuon requires reading the filesystem, searching for a file called "/NUON/NUON.RUN"
if(ps2BootSectors != null &&
ps2BootSectors.Length == 0x6000)
if(ps2BootSectors is { Length: 0x6000 })
{
// The decryption key is applied as XOR. As first byte is originally always NULL, it gives us the key :)
byte decryptByte = ps2BootSectors[0];

View File

@@ -382,8 +382,7 @@ namespace Aaru.Core
// TODO: Detect it
sidecar.BlockMedia[0].PhysicalBlockSize = image.Info.SectorSize;
if(image is ITapeImage tapeImage &&
tapeImage.IsTape)
if(image is ITapeImage { IsTape: true } tapeImage)
{
List<TapePartitionType> tapePartitions = new List<TapePartitionType>();

View File

@@ -564,8 +564,7 @@ namespace Aaru.Core
AaruConsole.DebugWriteLine("Stats", "{0}", ex);
}
if(Settings.Settings.Current.Stats != null &&
Settings.Settings.Current.Stats.ShareStats)
if(Settings.Settings.Current.Stats is { ShareStats: true })
SubmitStats();
}

View File

@@ -320,11 +320,11 @@ namespace Aaru.Gui.ViewModels.Windows
break;
}
case MediaModel mediaModel when mediaModel.NonRemovable:
case MediaModel { NonRemovable: true }:
ContentPanel = "Non-removable device commands not yet implemented";
break;
case MediaModel mediaModel when mediaModel.NoMediaInserted:
case MediaModel { NoMediaInserted: true }:
ContentPanel = "No media inserted";
break;

View File

@@ -4482,10 +4482,7 @@ namespace Aaru.DiscImages
track = Tracks.FirstOrDefault(trk => sectorAddress >= trk.TrackStartSector &&
sectorAddress <= trk.TrackEndSector);
if(track != null &&
track.TrackSequence == 0 &&
track.TrackStartSector == 0 &&
track.TrackEndSector == 0)
if(track is { TrackSequence: 0, TrackStartSector: 0, TrackEndSector: 0 })
track.TrackType = TrackType.Data;
break;

View File

@@ -369,7 +369,7 @@ namespace Aaru.Commands.Image
break;
case ITapeImage tapeImage when tapeImage.IsTape && tapeImage.Files?.Count > 0:
case ITapeImage { IsTape: true } tapeImage when tapeImage.Files?.Count > 0:
{
Checksum trackChecksum = null;