mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Merge null/pattern checks into complex pattern.
This commit is contained in:
Submodule Aaru.CommonTypes updated: 6d8fcb4d8b...df78159688
@@ -847,8 +847,7 @@ public partial class Dump
|
||||
if(maxSpeed > 0)
|
||||
UpdateStatus?.Invoke($"Fastest speed burst: {maxSpeed:F3} MiB/sec.");
|
||||
|
||||
if(minSpeed > 0 &&
|
||||
minSpeed < double.MaxValue)
|
||||
if(minSpeed is > 0 and < double.MaxValue)
|
||||
UpdateStatus?.Invoke($"Slowest speed burst: {minSpeed:F3} MiB/sec.");
|
||||
|
||||
UpdateStatus?.Invoke($"{_resume.BadBlocks.Count} sectors could not be read.");
|
||||
|
||||
@@ -382,7 +382,7 @@ partial class Dump
|
||||
DecodedSense? decSense = Sense.Decode(senseBuf);
|
||||
|
||||
// Try to workaround firmware
|
||||
if(decSense?.ASC == 0x11 && decSense?.ASCQ == 0x05 ||
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } ||
|
||||
decSense?.ASC == 0x64)
|
||||
{
|
||||
sense = _dev.ReadCd(out cmdBuf, out _, firstSectorToRead, blockSize, blocksToRead,
|
||||
|
||||
@@ -1393,8 +1393,7 @@ sealed partial class Dump
|
||||
if(maxSpeed > 0)
|
||||
UpdateStatus?.Invoke($"Fastest speed burst: {maxSpeed:F3} MiB/sec.");
|
||||
|
||||
if(minSpeed > 0 &&
|
||||
minSpeed < double.MaxValue)
|
||||
if(minSpeed is > 0 and < double.MaxValue)
|
||||
UpdateStatus?.Invoke($"Slowest speed burst: {minSpeed:F3} MiB/sec.");
|
||||
|
||||
UpdateStatus?.Invoke($"{_resume.BadBlocks.Count} sectors could not be read.");
|
||||
|
||||
@@ -257,7 +257,7 @@ partial class Dump
|
||||
DecodedSense? decSense = Sense.Decode(senseBuf);
|
||||
|
||||
// Try to workaround firmware
|
||||
if(decSense?.ASC == 0x11 && decSense?.ASCQ == 0x05 ||
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } ||
|
||||
decSense?.ASC == 0x64)
|
||||
{
|
||||
sense = _dev.ReadCd(out cmdBuf, out _, badSectorToReRead, blockSize, sectorsToReRead,
|
||||
@@ -280,7 +280,7 @@ partial class Dump
|
||||
DecodedSense? decSense = Sense.Decode(senseBuf);
|
||||
|
||||
// Try to workaround firmware
|
||||
if(decSense?.ASC == 0x11 && decSense?.ASCQ == 0x05 ||
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } ||
|
||||
decSense?.ASC == 0x64)
|
||||
{
|
||||
sense = _dev.ReadCd(out cmdBuf, out _, badSectorToReRead, blockSize, sectorsToReRead,
|
||||
|
||||
@@ -159,7 +159,7 @@ partial class Dump
|
||||
DecodedSense? decSense = Sense.Decode(senseBuf);
|
||||
|
||||
// Try to workaround firmware
|
||||
if(decSense?.ASC == 0x11 && decSense?.ASCQ == 0x05 ||
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } ||
|
||||
decSense?.ASC == 0x64)
|
||||
{
|
||||
sense = _dev.ReadCd(out cmdBuf, out _, badSectorToRead, blockSize, sectorsToTrim,
|
||||
|
||||
@@ -305,8 +305,7 @@ partial class Dump
|
||||
{
|
||||
PFI.PhysicalFormatInformation? nintendoPfi = PFI.Decode(cmdBuf, dskType);
|
||||
|
||||
if(nintendoPfi?.DiskCategory == DiskCategory.Nintendo &&
|
||||
nintendoPfi.Value.PartVersion == 15)
|
||||
if(nintendoPfi is { DiskCategory: DiskCategory.Nintendo, PartVersion: 15 })
|
||||
{
|
||||
_dumpLog.WriteLine("Dumping Nintendo GameCube or Wii discs is not yet implemented.");
|
||||
|
||||
|
||||
@@ -829,8 +829,7 @@ partial class Dump
|
||||
if(maxSpeed > 0)
|
||||
UpdateStatus?.Invoke($"Fastest speed burst: {maxSpeed:F3} MiB/sec.");
|
||||
|
||||
if(minSpeed > 0 &&
|
||||
minSpeed < double.MaxValue)
|
||||
if(minSpeed is > 0 and < double.MaxValue)
|
||||
UpdateStatus?.Invoke($"Slowest speed burst: {minSpeed:F3} MiB/sec.");
|
||||
|
||||
UpdateStatus?.Invoke($"{_resume.BadBlocks.Count} sectors could not be read.");
|
||||
|
||||
@@ -385,7 +385,7 @@ public partial class Dump
|
||||
|
||||
if(dcMode6.HasValue)
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
modePage.Page == 0x01 && modePage.Subpage == 0x00))
|
||||
modePage.Page == 0x01 && modePage.Subpage == 0x00))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
|
||||
@@ -681,8 +681,7 @@ public partial class Dump
|
||||
if(maxSpeed > 0)
|
||||
UpdateStatus?.Invoke($"Fastest speed burst: {maxSpeed:F3} MiB/sec.");
|
||||
|
||||
if(minSpeed > 0 &&
|
||||
minSpeed < double.MaxValue)
|
||||
if(minSpeed is > 0 and < double.MaxValue)
|
||||
UpdateStatus?.Invoke($"Slowest speed burst: {minSpeed:F3} MiB/sec.");
|
||||
|
||||
UpdateStatus?.Invoke($"{_resume.BadBlocks.Count} sectors could not be read.");
|
||||
|
||||
@@ -383,7 +383,7 @@ public partial class Dump
|
||||
|
||||
if(dcMode6.HasValue)
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
modePage.Page == 0x01 && modePage.Subpage == 0x00))
|
||||
modePage.Page == 0x01 && modePage.Subpage == 0x00))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
|
||||
@@ -589,8 +589,7 @@ public partial class Dump
|
||||
if(maxSpeed > 0)
|
||||
UpdateStatus?.Invoke($"Fastest speed burst: {maxSpeed:F3} MiB/sec.");
|
||||
|
||||
if(minSpeed > 0 &&
|
||||
minSpeed < double.MaxValue)
|
||||
if(minSpeed is > 0 and < double.MaxValue)
|
||||
UpdateStatus?.Invoke($"Slowest speed burst: {minSpeed:F3} MiB/sec.");
|
||||
|
||||
UpdateStatus?.Invoke($"{_resume.BadBlocks.Count} sectors could not be read.");
|
||||
|
||||
@@ -187,8 +187,7 @@ partial class Dump
|
||||
PulseProgress?.Invoke("Rewinding, please wait...");
|
||||
_dev.RequestSense(out senseBuf, _dev.Timeout, out duration);
|
||||
decSense = Sense.Decode(senseBuf);
|
||||
} while(decSense is { ASC: 0x00 } &&
|
||||
decSense.Value.ASCQ is 0x1A or 0x19);
|
||||
} while(decSense is { ASC: 0x00, ASCQ: 0x1A or 0x19 });
|
||||
|
||||
// And yet, did not rewind!
|
||||
if(decSense.HasValue &&
|
||||
@@ -732,8 +731,7 @@ partial class Dump
|
||||
PulseProgress?.Invoke("Rewinding, please wait...");
|
||||
_dev.RequestSense(out senseBuf, _dev.Timeout, out duration);
|
||||
decSense = Sense.Decode(senseBuf);
|
||||
} while(decSense is { ASC: 0x00 } &&
|
||||
decSense.Value.ASCQ is 0x1A or 0x19);
|
||||
} while(decSense is { ASC: 0x00, ASCQ: 0x1A or 0x19 });
|
||||
|
||||
// And yet, did not rewind!
|
||||
if(decSense.HasValue &&
|
||||
@@ -1410,8 +1408,7 @@ partial class Dump
|
||||
if(maxSpeed > 0)
|
||||
UpdateStatus?.Invoke($"Fastest speed burst: {maxSpeed:F3} MiB/sec.");
|
||||
|
||||
if(minSpeed > 0 &&
|
||||
minSpeed < double.MaxValue)
|
||||
if(minSpeed is > 0 and < double.MaxValue)
|
||||
UpdateStatus?.Invoke($"Slowest speed burst: {minSpeed:F3} MiB/sec.");
|
||||
|
||||
UpdateStatus?.Invoke($"{_resume.BadBlocks.Count} sectors could not be read.");
|
||||
|
||||
@@ -1254,8 +1254,7 @@ partial class Dump
|
||||
if(maxSpeed > 0)
|
||||
UpdateStatus?.Invoke($"Fastest speed burst: {maxSpeed:F3} MiB/sec.");
|
||||
|
||||
if(minSpeed > 0 &&
|
||||
minSpeed < double.MaxValue)
|
||||
if(minSpeed is > 0 and < double.MaxValue)
|
||||
UpdateStatus?.Invoke($"Slowest speed burst: {minSpeed:F3} MiB/sec.");
|
||||
|
||||
UpdateStatus?.Invoke($"{_resume.BadBlocks.Count} sectors could not be read.");
|
||||
|
||||
@@ -952,8 +952,7 @@ public partial class Dump
|
||||
if(maxSpeed > 0)
|
||||
UpdateStatus?.Invoke($"Fastest speed burst: {maxSpeed:F3} MiB/sec.");
|
||||
|
||||
if(minSpeed > 0 &&
|
||||
minSpeed < double.MaxValue)
|
||||
if(minSpeed is > 0 and < double.MaxValue)
|
||||
UpdateStatus?.Invoke($"Slowest speed burst: {minSpeed:F3} MiB/sec.");
|
||||
|
||||
UpdateStatus?.Invoke($"{_resume.BadBlocks.Count} sectors could not be read.");
|
||||
|
||||
@@ -1010,7 +1010,7 @@ partial class Dump
|
||||
|
||||
if(dcMode6.HasValue)
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
modePage.Page == 0x01 && modePage.Subpage == 0x00))
|
||||
modePage.Page == 0x01 && modePage.Subpage == 0x00))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
|
||||
@@ -1249,8 +1249,7 @@ partial class Dump
|
||||
if(maxSpeed > 0)
|
||||
UpdateStatus?.Invoke($"Fastest speed burst: {maxSpeed:F3} MiB/sec.");
|
||||
|
||||
if(minSpeed > 0 &&
|
||||
minSpeed < double.MaxValue)
|
||||
if(minSpeed is > 0 and < double.MaxValue)
|
||||
UpdateStatus?.Invoke($"Slowest speed burst: {minSpeed:F3} MiB/sec.");
|
||||
|
||||
UpdateStatus?.Invoke($"{_resume.BadBlocks.Count} sectors could not be read.");
|
||||
|
||||
@@ -194,9 +194,7 @@ sealed partial class Reader
|
||||
{
|
||||
decSense = Sense.Decode(senseBuf);
|
||||
|
||||
if(decSense?.SenseKey == SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
if(decSense is { SenseKey: SenseKeys.IllegalRequest, ASC: 0x24, ASCQ: 0x00 })
|
||||
{
|
||||
CanReadRaw = true;
|
||||
|
||||
@@ -437,9 +435,7 @@ sealed partial class Reader
|
||||
{
|
||||
decSense = Sense.Decode(senseBuf);
|
||||
|
||||
if(decSense?.SenseKey == SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
if(decSense is { SenseKey: SenseKeys.IllegalRequest, ASC: 0x24, ASCQ: 0x00 })
|
||||
{
|
||||
CanReadRaw = true;
|
||||
|
||||
|
||||
@@ -96,10 +96,7 @@ public sealed partial class DeviceReport
|
||||
|
||||
DecodedSense? decodedSense = Sense.Decode(senseBuffer);
|
||||
|
||||
if(decodedSense?.ASC != 0x04)
|
||||
break;
|
||||
|
||||
if(decodedSense?.ASCQ != 0x01)
|
||||
if(decodedSense is not { ASC: 0x04, ASCQ: 0x01 })
|
||||
break;
|
||||
|
||||
Thread.Sleep(2000);
|
||||
@@ -218,10 +215,7 @@ public sealed partial class DeviceReport
|
||||
|
||||
DecodedSense? decodedSense = Sense.Decode(senseBuffer);
|
||||
|
||||
if(decodedSense?.ASC != 0x04)
|
||||
break;
|
||||
|
||||
if(decodedSense?.ASCQ != 0x01)
|
||||
if(decodedSense is not { ASC: 0x04, ASCQ: 0x01 })
|
||||
break;
|
||||
} while(retries < 25);
|
||||
|
||||
@@ -1618,10 +1612,7 @@ public sealed partial class DeviceReport
|
||||
|
||||
DecodedSense? decoded = Sense.Decode(senseBuffer);
|
||||
|
||||
if(decoded?.ASC != 0x64)
|
||||
break;
|
||||
|
||||
if(decoded?.ASCQ != 0x00)
|
||||
if(decoded is not { ASC: 0x64, ASCQ: 0x00 })
|
||||
break;
|
||||
|
||||
trackModeChange = true;
|
||||
|
||||
@@ -1874,9 +1874,7 @@ public sealed partial class DeviceReport
|
||||
{
|
||||
DecodedSense? decSense = Sense.Decode(senseBuffer);
|
||||
|
||||
if(decSense?.SenseKey == SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
if(decSense is { SenseKey: SenseKeys.IllegalRequest, ASC: 0x24, ASCQ: 0x00 })
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
|
||||
|
||||
@@ -599,9 +599,7 @@ public sealed partial class DeviceReport
|
||||
{
|
||||
DecodedSense? decSense = Sense.Decode(senseBuffer);
|
||||
|
||||
if(decSense?.SenseKey == SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
if(decSense is { SenseKey: SenseKeys.IllegalRequest, ASC: 0x24, ASCQ: 0x00 })
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
|
||||
@@ -631,9 +629,7 @@ public sealed partial class DeviceReport
|
||||
{
|
||||
DecodedSense? decSense = Sense.Decode(senseBuffer);
|
||||
|
||||
if(decSense?.SenseKey == SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
if(decSense is { SenseKey: SenseKeys.IllegalRequest, ASC: 0x24, ASCQ: 0x00 })
|
||||
{
|
||||
mediaTest.SupportsReadLong16 = true;
|
||||
|
||||
@@ -908,9 +904,7 @@ public sealed partial class DeviceReport
|
||||
{
|
||||
DecodedSense? decSense = Sense.Decode(senseBuffer);
|
||||
|
||||
if(decSense?.SenseKey == SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
if(decSense is { SenseKey: SenseKeys.IllegalRequest, ASC: 0x24, ASCQ: 0x00 })
|
||||
{
|
||||
capabilities.SupportsReadLong = true;
|
||||
|
||||
@@ -942,9 +936,7 @@ public sealed partial class DeviceReport
|
||||
capabilities.SupportsReadLong16 = true;
|
||||
DecodedSense? decSense = Sense.Decode(senseBuffer);
|
||||
|
||||
if(decSense?.SenseKey == SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
if(decSense is { SenseKey: SenseKeys.IllegalRequest, ASC: 0x24, ASCQ: 0x00 })
|
||||
{
|
||||
capabilities.SupportsReadLong16 = true;
|
||||
|
||||
|
||||
@@ -173,8 +173,7 @@ public static class ImageInfo
|
||||
AaruConsole.WriteLine("[bold]Media geometry:[/] [italic]{0} cylinders, {1} heads, {2} sectors per track[/]",
|
||||
imageFormat.Info.Cylinders, imageFormat.Info.Heads, imageFormat.Info.SectorsPerTrack);
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||
imageFormat.Info.ReadableMediaTags.Count > 0)
|
||||
if(imageFormat.Info.ReadableMediaTags is { Count: > 0 })
|
||||
{
|
||||
AaruConsole.WriteLine("[bold]Contains {0} readable media tags:[/]",
|
||||
imageFormat.Info.ReadableMediaTags.Count);
|
||||
@@ -185,8 +184,7 @@ public static class ImageInfo
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(imageFormat.Info.ReadableSectorTags != null &&
|
||||
imageFormat.Info.ReadableSectorTags.Count > 0)
|
||||
if(imageFormat.Info.ReadableSectorTags is { Count: > 0 })
|
||||
{
|
||||
AaruConsole.WriteLine("[bold]Contains {0} readable sector tags:[/]",
|
||||
imageFormat.Info.ReadableSectorTags.Count);
|
||||
@@ -805,8 +803,7 @@ public static class ImageInfo
|
||||
|
||||
try
|
||||
{
|
||||
if(opticalImage.Sessions != null &&
|
||||
opticalImage.Sessions.Count > 0)
|
||||
if(opticalImage.Sessions is { Count: > 0 })
|
||||
{
|
||||
var table = new Table
|
||||
{
|
||||
|
||||
@@ -485,7 +485,7 @@ public static class MMC
|
||||
}
|
||||
|
||||
foreach(FullTOC.TrackDataDescriptor track in
|
||||
decodedToc.Value.TrackDescriptors.Where(t => t.POINT > 0 && t.POINT <= 0x99))
|
||||
decodedToc.Value.TrackDescriptors.Where(t => t.POINT is > 0 and <= 0x99))
|
||||
{
|
||||
if(track.TNO == 1 &&
|
||||
((TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrack ||
|
||||
@@ -553,8 +553,7 @@ public static class MMC
|
||||
}
|
||||
|
||||
if(mediaType is MediaType.CD or MediaType.CDROM && hasDataTrack)
|
||||
foreach(uint startAddress in decodedToc.Value.TrackDescriptors.
|
||||
Where(t => t.POINT > 0 && t.POINT <= 0x99 &&
|
||||
foreach(uint startAddress in decodedToc.Value.TrackDescriptors.Where(t => t.POINT is > 0 and <= 0x99 &&
|
||||
((TocControl)(t.CONTROL & 0x0D) ==
|
||||
TocControl.DataTrack ||
|
||||
(TocControl)(t.CONTROL & 0x0D) ==
|
||||
@@ -2327,8 +2326,7 @@ public static class MMC
|
||||
}
|
||||
}
|
||||
|
||||
if(blurayDi != null &&
|
||||
blurayDi?.Units?.Length > 0 &&
|
||||
if(blurayDi is { Units.Length: > 0 } &&
|
||||
blurayDi?.Units[0].DiscTypeIdentifier != null)
|
||||
{
|
||||
string blurayType = StringHandlers.CToString(blurayDi?.Units[0].DiscTypeIdentifier);
|
||||
|
||||
Submodule Aaru.Decoders updated: e727683929...83612d6084
@@ -312,10 +312,8 @@ public sealed partial class FAT
|
||||
useDos32Bpb = true;
|
||||
minBootNearJump = 0x1E;
|
||||
}
|
||||
else if(dos30Bpb.sptrk > 0 &&
|
||||
dos30Bpb.sptrk < 64 &&
|
||||
dos30Bpb.heads > 0 &&
|
||||
dos30Bpb.heads < 256)
|
||||
else if(dos30Bpb.sptrk is > 0 and < 64 &&
|
||||
dos30Bpb.heads is > 0 and < 256)
|
||||
if(atariBpb.jump[0] == 0x60 ||
|
||||
atariBpb.jump[0] == 0xE9 && atariBpb.jump[1] == 0x00 &&
|
||||
Encoding.ASCII.GetString(dos33Bpb.oem_name) != "NEXT ")
|
||||
|
||||
@@ -268,8 +268,7 @@ public sealed partial class FAT
|
||||
nextEntry = (int)(nextCluster % _fatEntriesPerSector);
|
||||
}
|
||||
else if(_fat16)
|
||||
while(nextCluster > 0 &&
|
||||
nextCluster <= FAT16_RESERVED)
|
||||
while(nextCluster is > 0 and <= FAT16_RESERVED)
|
||||
{
|
||||
if(nextCluster > _fatEntries.Length)
|
||||
return null;
|
||||
@@ -278,8 +277,7 @@ public sealed partial class FAT
|
||||
nextCluster = _fatEntries[nextCluster];
|
||||
}
|
||||
else
|
||||
while(nextCluster > 0 &&
|
||||
nextCluster <= FAT12_RESERVED)
|
||||
while(nextCluster is > 0 and <= FAT12_RESERVED)
|
||||
{
|
||||
if(nextCluster > _fatEntries.Length)
|
||||
return null;
|
||||
|
||||
@@ -625,8 +625,7 @@ public sealed partial class FAT
|
||||
XmlFsType.FreeClustersSpecified = true;
|
||||
}
|
||||
|
||||
if(fsInfo.last_cluster > 2 &&
|
||||
fsInfo.last_cluster < 0xFFFFFFFF)
|
||||
if(fsInfo.last_cluster is > 2 and < 0xFFFFFFFF)
|
||||
sb.AppendFormat("Last allocated cluster {0}", fsInfo.last_cluster).AppendLine();
|
||||
}
|
||||
}
|
||||
@@ -930,10 +929,8 @@ public sealed partial class FAT
|
||||
|
||||
sb.AppendFormat("{0} sectors per FAT.", fakeBpb.spfat).AppendLine();
|
||||
|
||||
if(fakeBpb.sptrk > 0 &&
|
||||
fakeBpb.sptrk < 64 &&
|
||||
fakeBpb.heads > 0 &&
|
||||
fakeBpb.heads < 256)
|
||||
if(fakeBpb.sptrk is > 0 and < 64 &&
|
||||
fakeBpb.heads is > 0 and < 256)
|
||||
{
|
||||
sb.AppendFormat("{0} sectors per track.", fakeBpb.sptrk).AppendLine();
|
||||
sb.AppendFormat("{0} heads.", fakeBpb.heads).AppendLine();
|
||||
|
||||
@@ -239,8 +239,7 @@ public sealed partial class XboxFatPlugin
|
||||
nextCluster = _fat32[nextCluster];
|
||||
}
|
||||
else
|
||||
while(nextCluster > 0 &&
|
||||
nextCluster <= FAT16_RESERVED)
|
||||
while(nextCluster is > 0 and <= FAT16_RESERVED)
|
||||
{
|
||||
clusters.Add(nextCluster);
|
||||
nextCluster = _fat16[nextCluster];
|
||||
|
||||
@@ -201,7 +201,7 @@ public sealed partial class HPOFS
|
||||
sb.AppendFormat("Volume created on {0}", DateHandlers.DosToDateTime(mib.creationDate, mib.creationTime)).
|
||||
AppendLine();
|
||||
|
||||
sb.AppendFormat("Volume uses {0} codepage {1}", mib.codepageType > 0 && mib.codepageType < 3
|
||||
sb.AppendFormat("Volume uses {0} codepage {1}", mib.codepageType is > 0 and < 3
|
||||
? mib.codepageType == 2
|
||||
? "EBCDIC"
|
||||
: "ASCII" : "Unknown", mib.codepage).AppendLine();
|
||||
|
||||
@@ -74,10 +74,10 @@ public sealed class ZZZNoFilter : IFilter
|
||||
public bool HasResourceFork => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(byte[] buffer) => buffer != null && buffer.Length > 0;
|
||||
public bool Identify(byte[] buffer) => buffer is { Length: > 0 };
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(Stream stream) => stream != null && stream.Length > 0;
|
||||
public bool Identify(Stream stream) => stream is { Length: > 0 };
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(string path) => File.Exists(path);
|
||||
|
||||
@@ -188,13 +188,11 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
MediaGeometryText =
|
||||
$"Media geometry: {imageFormat.Info.Cylinders} cylinders, {imageFormat.Info.Heads} heads, {imageFormat.Info.SectorsPerTrack} sectors per track";
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||
imageFormat.Info.ReadableMediaTags.Count > 0)
|
||||
if(imageFormat.Info.ReadableMediaTags is { Count: > 0 })
|
||||
foreach(MediaTagType tag in imageFormat.Info.ReadableMediaTags.OrderBy(t => t))
|
||||
MediaTagsList.Add(tag.ToString());
|
||||
|
||||
if(imageFormat.Info.ReadableSectorTags != null &&
|
||||
imageFormat.Info.ReadableSectorTags.Count > 0)
|
||||
if(imageFormat.Info.ReadableSectorTags is { Count: > 0 })
|
||||
foreach(SectorTagType tag in imageFormat.Info.ReadableSectorTags.OrderBy(t => t))
|
||||
SectorTagsList.Add(tag.ToString());
|
||||
|
||||
@@ -624,8 +622,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
{
|
||||
try
|
||||
{
|
||||
if(opticalMediaImage.Sessions != null &&
|
||||
opticalMediaImage.Sessions.Count > 0)
|
||||
if(opticalMediaImage.Sessions is { Count: > 0 })
|
||||
foreach(Session session in opticalMediaImage.Sessions)
|
||||
Sessions.Add(session);
|
||||
}
|
||||
@@ -636,8 +633,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
|
||||
try
|
||||
{
|
||||
if(opticalMediaImage.Tracks != null &&
|
||||
opticalMediaImage.Tracks.Count > 0)
|
||||
if(opticalMediaImage.Tracks is { Count: > 0 })
|
||||
foreach(Track track in opticalMediaImage.Tracks)
|
||||
Tracks.Add(track);
|
||||
}
|
||||
|
||||
@@ -99,8 +99,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
if(!string.IsNullOrEmpty(mcn))
|
||||
McnText = mcn;
|
||||
|
||||
if(isrcs != null &&
|
||||
isrcs.Count > 0)
|
||||
if(isrcs is { Count: > 0 })
|
||||
foreach(KeyValuePair<byte, string> isrc in isrcs)
|
||||
IsrcList.Add(new IsrcModel
|
||||
{
|
||||
|
||||
@@ -37,7 +37,6 @@ using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Reactive;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core;
|
||||
@@ -302,9 +301,7 @@ public sealed class ImageEntropyViewModel : ViewModelBase
|
||||
StopVisible = false;
|
||||
ProgressVisible = true;
|
||||
|
||||
if(WholeDiscChecked &&
|
||||
_inputFormat is IOpticalMediaImage opticalFormat &&
|
||||
opticalFormat.Sessions?.Count > 1)
|
||||
if(WholeDiscChecked && _inputFormat is IOpticalMediaImage { Sessions.Count: > 1 })
|
||||
{
|
||||
AaruConsole.ErrorWriteLine("Calculating disc entropy of multisession images is not yet implemented.");
|
||||
WholeDiscChecked = false;
|
||||
|
||||
Submodule Aaru.Helpers updated: 98f08919d6...7fbeaebfd3
@@ -3127,7 +3127,7 @@ public sealed partial class AaruFormat
|
||||
// Write the sector prefix, suffix and subchannels if present
|
||||
switch(_imageInfo.XmlMediaType)
|
||||
{
|
||||
case XmlMediaType.OpticalDisc when Tracks != null && Tracks.Count > 0:
|
||||
case XmlMediaType.OpticalDisc when Tracks is { Count: > 0 }:
|
||||
DateTime startCompress;
|
||||
DateTime endCompress;
|
||||
|
||||
|
||||
@@ -154,9 +154,8 @@ public sealed partial class Alcohol120
|
||||
oldIncorrectImage = true;
|
||||
|
||||
// Solve our own mistake here, sorry, but anyway seems Alcohol doesn't support DDCD
|
||||
if(track.zero > 0 &&
|
||||
track.point >= 1 &&
|
||||
track.point <= 99)
|
||||
if(track.zero > 0 &&
|
||||
track.point is >= 1 and <= 99)
|
||||
{
|
||||
track.pmin += (byte)(track.zero * 60);
|
||||
track.zero = 0;
|
||||
|
||||
@@ -625,8 +625,8 @@ public sealed partial class Alcohol120
|
||||
allBlocks = (byte)(decodedToc?.TrackDescriptors.Count(t => t.SessionNumber == i) ??
|
||||
_writingTracks.Count(t => t.Session == i) + 3),
|
||||
nonTrackBlocks =
|
||||
(byte)(decodedToc?.TrackDescriptors.Count(t => t.SessionNumber == i && t.POINT >= 0xA0 &&
|
||||
t.POINT <= 0xAF) ?? 3),
|
||||
(byte)(decodedToc?.TrackDescriptors.Count(t => t.SessionNumber == i &&
|
||||
t.POINT is >= 0xA0 and <= 0xAF) ?? 3),
|
||||
firstTrack = (ushort)firstTrack.Sequence,
|
||||
lastTrack = (ushort)lastTrack.Sequence,
|
||||
trackOffset = (uint)currentTrackOffset
|
||||
@@ -646,11 +646,11 @@ public sealed partial class Alcohol120
|
||||
|
||||
(byte minute, byte second, byte frame) leadinPmsf = LbaToMsf(lastTrack.EndSector + 1);
|
||||
|
||||
if(decodedToc?.TrackDescriptors.Any(t => t.SessionNumber == i && t.POINT >= 0xA0 && t.POINT <= 0xAF) ==
|
||||
if(decodedToc?.TrackDescriptors.Any(t => t.SessionNumber == i && t.POINT is >= 0xA0 and <= 0xAF) ==
|
||||
true)
|
||||
foreach(FullTOC.TrackDataDescriptor tocTrk in
|
||||
decodedToc.Value.TrackDescriptors.Where(t => t.SessionNumber == i && t.POINT >= 0xA0 &&
|
||||
t.POINT <= 0xAF))
|
||||
decodedToc.Value.TrackDescriptors.Where(t => t.SessionNumber == i &&
|
||||
t.POINT is >= 0xA0 and <= 0xAF))
|
||||
{
|
||||
thisSessionTracks.Add(tocTrk.POINT, new Track
|
||||
{
|
||||
|
||||
@@ -1550,9 +1550,9 @@ public sealed partial class CdrWin
|
||||
|
||||
var mediaTypeAsInt = (int)_discImage.MediaType;
|
||||
|
||||
_isCd = mediaTypeAsInt >= 10 && mediaTypeAsInt <= 39 || mediaTypeAsInt is 112 or 113 ||
|
||||
mediaTypeAsInt >= 150 && mediaTypeAsInt <= 152 || mediaTypeAsInt is 154 or 155 ||
|
||||
mediaTypeAsInt >= 171 && mediaTypeAsInt <= 179 || mediaTypeAsInt >= 740 && mediaTypeAsInt <= 749;
|
||||
_isCd = mediaTypeAsInt is >= 10 and <= 39 || mediaTypeAsInt is 112 or 113 ||
|
||||
mediaTypeAsInt is >= 150 and <= 152 || mediaTypeAsInt is 154 or 155 ||
|
||||
mediaTypeAsInt is >= 171 and <= 179 || mediaTypeAsInt is >= 740 and <= 749;
|
||||
|
||||
if(currentSession > 1 &&
|
||||
leadouts.Count == 0 &&
|
||||
|
||||
@@ -107,9 +107,9 @@ public sealed partial class CdrWin
|
||||
|
||||
var mediaTypeAsInt = (int)_discImage.MediaType;
|
||||
|
||||
_isCd = mediaTypeAsInt >= 10 && mediaTypeAsInt <= 39 || mediaTypeAsInt is 112 or 113 ||
|
||||
mediaTypeAsInt >= 150 && mediaTypeAsInt <= 152 || mediaTypeAsInt is 154 or 155 ||
|
||||
mediaTypeAsInt >= 171 && mediaTypeAsInt <= 179 || mediaTypeAsInt >= 740 && mediaTypeAsInt <= 749;
|
||||
_isCd = mediaTypeAsInt is >= 10 and <= 39 || mediaTypeAsInt is 112 or 113 ||
|
||||
mediaTypeAsInt is >= 150 and <= 152 || mediaTypeAsInt is 154 or 155 ||
|
||||
mediaTypeAsInt is >= 171 and <= 179 || mediaTypeAsInt is >= 740 and <= 749;
|
||||
|
||||
if(_isCd)
|
||||
{
|
||||
|
||||
@@ -457,8 +457,7 @@ public sealed partial class CloneCd
|
||||
|
||||
break;
|
||||
default:
|
||||
if(descriptor.POINT >= 0x01 &&
|
||||
descriptor.POINT <= 0x63)
|
||||
if(descriptor.POINT is >= 0x01 and <= 0x63)
|
||||
{
|
||||
if(!firstTrackInSession)
|
||||
{
|
||||
|
||||
@@ -159,9 +159,9 @@ public sealed partial class Ndif
|
||||
}
|
||||
|
||||
// TODO: Handle compressed chunks
|
||||
if(bChnk.type > CHUNK_TYPE_COPY && bChnk.type < CHUNK_TYPE_KENCODE ||
|
||||
bChnk.type > CHUNK_TYPE_ADC && bChnk.type < CHUNK_TYPE_STUFFIT ||
|
||||
bChnk.type > CHUNK_TYPE_STUFFIT && bChnk.type < CHUNK_TYPE_END ||
|
||||
if(bChnk.type is > CHUNK_TYPE_COPY and < CHUNK_TYPE_KENCODE ||
|
||||
bChnk.type is > CHUNK_TYPE_ADC and < CHUNK_TYPE_STUFFIT ||
|
||||
bChnk.type is > CHUNK_TYPE_STUFFIT and < CHUNK_TYPE_END ||
|
||||
bChnk.type == 1)
|
||||
{
|
||||
AaruConsole.ErrorWriteLine($"Unsupported chunk type 0x{bChnk.type:X8} found");
|
||||
|
||||
@@ -414,8 +414,8 @@ public sealed partial class Udif
|
||||
return ErrorNumber.NotImplemented;
|
||||
}
|
||||
|
||||
if(bChnk.type > CHUNK_TYPE_NOCOPY && bChnk.type < CHUNK_TYPE_COMMNT ||
|
||||
bChnk.type > CHUNK_TYPE_LZMA && bChnk.type < CHUNK_TYPE_END)
|
||||
if(bChnk.type is > CHUNK_TYPE_NOCOPY and < CHUNK_TYPE_COMMNT ||
|
||||
bChnk.type is > CHUNK_TYPE_LZMA and < CHUNK_TYPE_END)
|
||||
{
|
||||
AaruConsole.ErrorWriteLine($"Unsupported chunk type 0x{bChnk.type:X8} found");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user