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); DecodedSense? decSense = Sense.Decode(senseBuf);
// MEDIUM ERROR, retry with ignore error below // MEDIUM ERROR, retry with ignore error below
if(decSense.HasValue && if(decSense is { ASC: 0x11 })
decSense.Value.ASC == 0x11)
if(!sectorsNotEvenPartial.Contains(badSector)) if(!sectorsNotEvenPartial.Contains(badSector))
sectorsNotEvenPartial.Add(badSector); sectorsNotEvenPartial.Add(badSector);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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