From 02d6222ae9603d9462ea5ae2f64ff8bdfe4c5ecd Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 13 Nov 2022 19:38:02 +0000 Subject: [PATCH] Convert if to switch statement. --- ATA/Identify.cs | 165 ++++++++++++++++++++------------- CD/Subchannel.cs | 211 +++++++++++++++++++++++++++++++++++-------- DVD/CSS&CPRM.cs | 106 +++++++++++++--------- DVD/PFI.cs | 196 +++++++++++++++++++++------------------- Floppy/Apple2.cs | 29 +++--- MMC/CSD.cs | 27 ++++-- MMC/ExtendedCSD.cs | 111 +++++++++++++++-------- SCSI/MMC/Features.cs | 112 ++++++++++++++++------- SCSI/Modes/11.cs | 29 ++++-- SCSI/Modes/2A.cs | 40 +++++--- SCSI/Modes/Mode10.cs | 59 ++++++------ SecureDigital/CSD.cs | 60 ++++++++---- Xbox/SS.cs | 17 ++-- 13 files changed, 752 insertions(+), 410 deletions(-) diff --git a/ATA/Identify.cs b/ATA/Identify.cs index f64bbd8fd..5517d4d0a 100644 --- a/ATA/Identify.cs +++ b/ATA/Identify.cs @@ -826,60 +826,85 @@ public static class Identify } if(ATAID.Capabilities.HasFlag(CommonTypes.Structs.Devices.ATA.Identify.CapabilitiesBit.LBASupport)) - if((ulong)ATAID.LBASectors * logicalSectorSize / 1024 / 1024 > 1000000) - sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", - (ulong)ATAID.LBASectors * logicalSectorSize, - (ulong)ATAID.LBASectors * logicalSectorSize / 1000 / 1000 / 1000 / 1000, - (ulong)ATAID.LBASectors * 512 / 1024 / 1024 / 1024 / 1024).AppendLine(); - else if((ulong)ATAID.LBASectors * logicalSectorSize / 1024 / 1024 > 1000) - sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", - (ulong)ATAID.LBASectors * logicalSectorSize, - (ulong)ATAID.LBASectors * logicalSectorSize / 1000 / 1000 / 1000, - (ulong)ATAID.LBASectors * 512 / 1024 / 1024 / 1024).AppendLine(); - else - sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", - (ulong)ATAID.LBASectors * logicalSectorSize, - (ulong)ATAID.LBASectors * logicalSectorSize / 1000 / 1000, - (ulong)ATAID.LBASectors * 512 / 1024 / 1024).AppendLine(); + switch((ulong)ATAID.LBASectors * logicalSectorSize / 1024 / 1024) + { + case > 1000000: + sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", + (ulong)ATAID.LBASectors * logicalSectorSize, + (ulong)ATAID.LBASectors * logicalSectorSize / 1000 / 1000 / 1000 / 1000, + (ulong)ATAID.LBASectors * 512 / 1024 / 1024 / 1024 / 1024).AppendLine(); + + break; + case > 1000: + sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", + (ulong)ATAID.LBASectors * logicalSectorSize, + (ulong)ATAID.LBASectors * logicalSectorSize / 1000 / 1000 / 1000, + (ulong)ATAID.LBASectors * 512 / 1024 / 1024 / 1024).AppendLine(); + + break; + default: + sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", + (ulong)ATAID.LBASectors * logicalSectorSize, + (ulong)ATAID.LBASectors * logicalSectorSize / 1000 / 1000, + (ulong)ATAID.LBASectors * 512 / 1024 / 1024).AppendLine(); + + break; + } if(ATAID.CommandSet2.HasFlag(CommonTypes.Structs.Devices.ATA.Identify.CommandSetBit2.LBA48)) if(ATAID.CommandSet5.HasFlag(CommonTypes.Structs.Devices.ATA.Identify.CommandSetBit5.ExtSectors)) - if(ATAID.ExtendedUserSectors * logicalSectorSize / 1024 / 1024 > 1000000) - sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", - ATAID.ExtendedUserSectors * logicalSectorSize, - ATAID.ExtendedUserSectors * logicalSectorSize / 1000 / 1000 / 1000 / 1000, - ATAID.ExtendedUserSectors * logicalSectorSize / 1024 / 1024 / 1024 / 1024). - AppendLine(); - else if(ATAID.ExtendedUserSectors * logicalSectorSize / 1024 / 1024 > 1000) - sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", - ATAID.ExtendedUserSectors * logicalSectorSize, - ATAID.ExtendedUserSectors * logicalSectorSize / 1000 / 1000 / 1000, - ATAID.ExtendedUserSectors * logicalSectorSize / 1024 / 1024 / 1024). - AppendLine(); - else - sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", - ATAID.ExtendedUserSectors * logicalSectorSize, - ATAID.ExtendedUserSectors * logicalSectorSize / 1000 / 1000, - ATAID.ExtendedUserSectors * logicalSectorSize / 1024 / 1024).AppendLine(); + switch(ATAID.ExtendedUserSectors * logicalSectorSize / 1024 / 1024) + { + case > 1000000: + sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", + ATAID.ExtendedUserSectors * logicalSectorSize, + ATAID.ExtendedUserSectors * logicalSectorSize / 1000 / 1000 / 1000 / 1000, + ATAID.ExtendedUserSectors * logicalSectorSize / 1024 / 1024 / 1024 / 1024). + AppendLine(); + + break; + case > 1000: + sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", + ATAID.ExtendedUserSectors * logicalSectorSize, + ATAID.ExtendedUserSectors * logicalSectorSize / 1000 / 1000 / 1000, + ATAID.ExtendedUserSectors * logicalSectorSize / 1024 / 1024 / 1024). + AppendLine(); + + break; + default: + sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", + ATAID.ExtendedUserSectors * logicalSectorSize, + ATAID.ExtendedUserSectors * logicalSectorSize / 1000 / 1000, + ATAID.ExtendedUserSectors * logicalSectorSize / 1024 / 1024).AppendLine(); + + break; + } else - { - if(ATAID.LBA48Sectors * logicalSectorSize / 1024 / 1024 > 1000000) - sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", - ATAID.LBA48Sectors * logicalSectorSize, - ATAID.LBA48Sectors * logicalSectorSize / 1000 / 1000 / 1000 / 1000, - ATAID.LBA48Sectors * logicalSectorSize / 1024 / 1024 / 1024 / 1024). - AppendLine(); - else if(ATAID.LBA48Sectors * logicalSectorSize / 1024 / 1024 > 1000) - sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", - ATAID.LBA48Sectors * logicalSectorSize, - ATAID.LBA48Sectors * logicalSectorSize / 1000 / 1000 / 1000, - ATAID.LBA48Sectors * logicalSectorSize / 1024 / 1024 / 1024).AppendLine(); - else - sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", - ATAID.LBA48Sectors * logicalSectorSize, - ATAID.LBA48Sectors * logicalSectorSize / 1000 / 1000, - ATAID.LBA48Sectors * logicalSectorSize / 1024 / 1024).AppendLine(); - } + switch(ATAID.LBA48Sectors * logicalSectorSize / 1024 / 1024) + { + case > 1000000: + sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", + ATAID.LBA48Sectors * logicalSectorSize, + ATAID.LBA48Sectors * logicalSectorSize / 1000 / 1000 / 1000 / 1000, + ATAID.LBA48Sectors * logicalSectorSize / 1024 / 1024 / 1024 / 1024). + AppendLine(); + + break; + case > 1000: + sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", + ATAID.LBA48Sectors * logicalSectorSize, + ATAID.LBA48Sectors * logicalSectorSize / 1000 / 1000 / 1000, + ATAID.LBA48Sectors * logicalSectorSize / 1024 / 1024 / 1024).AppendLine(); + + break; + default: + sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", + ATAID.LBA48Sectors * logicalSectorSize, + ATAID.LBA48Sectors * logicalSectorSize / 1000 / 1000, + ATAID.LBA48Sectors * logicalSectorSize / 1024 / 1024).AppendLine(); + + break; + } if(ata1 || cfa) { @@ -1964,27 +1989,37 @@ public static class Identify sb.Append(" and enabled"); } - if(!atapi) - if(ATAID.SATAFeatures.HasFlag(CommonTypes.Structs.Devices.ATA.Identify.SATAFeaturesBit. - HardwareFeatureControl)) + switch(atapi) + { + case false: { - sb.AppendLine().Append("Hardware Feature Control is supported"); + if(ATAID.SATAFeatures.HasFlag(CommonTypes.Structs.Devices.ATA.Identify.SATAFeaturesBit. + HardwareFeatureControl)) + { + sb.AppendLine().Append("Hardware Feature Control is supported"); - if(ATAID.EnabledSATAFeatures.HasFlag(CommonTypes.Structs.Devices.ATA.Identify.SATAFeaturesBit. - HardwareFeatureControl)) - sb.Append(" and enabled"); + if(ATAID.EnabledSATAFeatures.HasFlag(CommonTypes.Structs.Devices.ATA.Identify. + SATAFeaturesBit.HardwareFeatureControl)) + sb.Append(" and enabled"); + } + + break; } - - if(atapi) - if(ATAID.SATAFeatures.HasFlag(CommonTypes.Structs.Devices.ATA.Identify.SATAFeaturesBit. - AsyncNotification)) + case true: { - sb.AppendLine().Append("Asynchronous notification is supported"); + if(ATAID.SATAFeatures.HasFlag(CommonTypes.Structs.Devices.ATA.Identify.SATAFeaturesBit. + AsyncNotification)) + { + sb.AppendLine().Append("Asynchronous notification is supported"); - if(ATAID.EnabledSATAFeatures.HasFlag(CommonTypes.Structs.Devices.ATA.Identify.SATAFeaturesBit. - AsyncNotification)) - sb.Append(" and enabled"); + if(ATAID.EnabledSATAFeatures.HasFlag(CommonTypes.Structs.Devices.ATA.Identify. + SATAFeaturesBit.AsyncNotification)) + sb.Append(" and enabled"); + } + + break; } + } if(ATAID.SATAFeatures.HasFlag(CommonTypes.Structs.Devices.ATA.Identify.SATAFeaturesBit. SettingsPreserve)) diff --git a/CD/Subchannel.cs b/CD/Subchannel.cs index 7f9e0e3c3..a7ae43668 100644 --- a/CD/Subchannel.cs +++ b/CD/Subchannel.cs @@ -367,8 +367,15 @@ public static class Subchannel switch(adr) { case 1 when subBuf[2] < 0xA0: - return - $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr} position: {subBuf[3]:X2}:{subBuf[4]:X2}:{subBuf[5]:X2} (LBA {qPos}), track {subBuf[2]:X} starts at {subBuf[7]:X2}:{subBuf[8]:X2}:{subBuf[9]:X2} (LBA {qStart}), Q CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; + return $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr} position: {subBuf[3] + :X2}:{subBuf[4]:X2}:{subBuf[5]:X2} (LBA {qPos}), track {subBuf[2] + :X} starts at {subBuf[7]:X2}:{subBuf[8]:X2}:{subBuf[9]:X2} (LBA {qStart + }), Q CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W { + (rwEmpty ? "empty" : "not empty")}"; case 1 when subBuf[2] == 0xA0: { string format = subBuf[8] switch @@ -379,44 +386,136 @@ public static class Subchannel _ => $"unknown {subBuf[0]:X2}" }; - return - $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr} position: {subBuf[3]:X2}:{subBuf[4]:X2}:{subBuf[5]:X2} (LBA {qPos}), track {subBuf[2]:X} is first program area track in {format} format, Q CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; + return $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr} position: {subBuf[3] + :X2}:{subBuf[4]:X2}:{subBuf[5]:X2} (LBA {qPos}), track {subBuf[2] + :X} is first program area track in {format} format, Q CRC 0x{subBuf[10]:X2}{ + subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W { + (rwEmpty ? "empty" : "not empty")}"; } case 1 when subBuf[2] == 0xA1: - return - $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr} position: {subBuf[3]:X2}:{subBuf[4]:X2}:{subBuf[5]:X2} (LBA {qPos}), track {subBuf[2]:X} is last program area track, Q CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; + return $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr} position: {subBuf[3] + :X2}:{subBuf[4]:X2}:{subBuf[5]:X2} (LBA {qPos}), track {subBuf[2] + :X} is last program area track, Q CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({ + (crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; case 1: - return subBuf[2] == 0xA2 - ? $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr} position: {subBuf[3]:X2}:{subBuf[4]:X2}:{subBuf[5]:X2} (LBA {qPos}), track {subBuf[2]:X} starts at {subBuf[7]:X2}{subBuf[8]:X2}{subBuf[9]:X2} (LBA {qStart}), Q CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}" - : $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q: {subBuf[0]:X2} {subBuf[1]:X2} {subBuf[2]:X2} {subBuf[3]:X2} {subBuf[4]:X2} {subBuf[5]:X2} {subBuf[6]:X2} {subBuf[7]:X2} {subBuf[8]:X2} {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; + return subBuf[2] == 0xA2 ? $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, { + (corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr} position: {subBuf[3]:X2}:{ + subBuf[4]:X2}:{subBuf[5]:X2} (LBA {qPos}), track {subBuf[2]:X} starts at {subBuf[7] + :X2}{subBuf[8]:X2}{subBuf[9]:X2} (LBA {qStart}), Q CRC 0x{subBuf[10]:X2}{subBuf[11] + :X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}" : $"{ + minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q: {subBuf[0] + :X2} {subBuf[1]:X2} {subBuf[2]:X2} {subBuf[3]:X2} { + subBuf[4]:X2} {subBuf[5]:X2} {subBuf[6]:X2} {subBuf[7] + :X2} {subBuf[8]:X2} {subBuf[9]:X2} CRC 0x{ + subBuf[10]:X2}{subBuf[11]:X2} ({ + (crcOk ? "OK" : "BAD")}), R-W { + (rwEmpty ? "empty" : "not empty")}"; case 2: - return - $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr} MCN: {DecodeMcn(subBuf)} frame {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; + return $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr} MCN: {DecodeMcn(subBuf) + } frame {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({ + (crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; } if(adr != 5) - return - $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q: {subBuf[0]:X2} {subBuf[1]:X2} {subBuf[2]:X2} {subBuf[3]:X2} {subBuf[4]:X2} {subBuf[5]:X2} {subBuf[6]:X2} {subBuf[7]:X2} {subBuf[8]:X2} {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; + return $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q: {subBuf[0]:X2} {subBuf[1]:X2} { + subBuf[2]:X2} {subBuf[3]:X2} {subBuf[4]:X2} {subBuf[5]:X2} {subBuf[6]:X2} { + subBuf[7]:X2} {subBuf[8]:X2} {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{subBuf[11] + :X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty") + }"; - if(subBuf[2] <= 0x40) - return - $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr} skip interval start time {subBuf[7]:X2}{subBuf[8]:X2}{subBuf[9]:X2}, skip interval stop time {subBuf[3]:X2}{subBuf[4]:X2}{subBuf[5]:X2}, CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; - - if(subBuf[2] == 0xB0) - return final - ? $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr} next program area can start at {subBuf[3]:X2}:{subBuf[4]:X2}:{subBuf[5]:X2} (LBA {nextPos}), last-session, {zero} mode 5 pointers, CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}" - : $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr} next program area can start at {subBuf[3]:X2}:{subBuf[4]:X2}:{subBuf[5]:X2} (LBA {nextPos}), maximum Lead-out at {subBuf[7]:X2}:{subBuf[8]:X2}:{subBuf[9]:X2} (LBA {maxOut}), {zero} mode 5 pointers, CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; - - if(subBuf[2] == 0xB1) - return - $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr}, {pmin} skip interval pointers, {psec} skip track assignments, CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; + switch(subBuf[2]) + { + case <= 0x40: + return $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr + } skip interval start time {subBuf[7]:X2}{subBuf[8]:X2}{subBuf[9] + :X2}, skip interval stop time {subBuf[3]:X2}{subBuf[4]:X2}{subBuf[5] + :X2}, CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W { + (rwEmpty ? "empty" : "not empty")}"; + case 0xB0: + return final ? $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr + } next program area can start at {subBuf[3]:X2}:{subBuf[4]:X2}:{subBuf[5] + :X2} (LBA {nextPos}), last-session, {zero} mode 5 pointers, CRC 0x{ + subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W { + (rwEmpty ? "empty" : "not empty")}" : $"{minute:D2}:{second:D2}:{frame + :D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode { + adr} next program area can start at {subBuf[3] + :X2}:{subBuf[4]:X2}:{subBuf[5]:X2} (LBA { + nextPos}), maximum Lead-out at {subBuf[7] + :X2}:{subBuf[8]:X2}:{subBuf[9] + :X2} (LBA {maxOut}), {zero + } mode 5 pointers, CRC 0x{subBuf[10]:X2}{ + subBuf[11]:X2} ({(crcOk ? "OK" : "BAD") + }), R-W {(rwEmpty ? "empty" + : "not empty")}"; + case 0xB1: + return $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr}, {pmin + } skip interval pointers, {psec} skip track assignments, CRC 0x{subBuf[10]:X2}{ + subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W { + (rwEmpty ? "empty" : "not empty")}"; + } if(subBuf[2] != 0xB2 && subBuf[2] != 0xB3 && subBuf[2] != 0xB4) - return subBuf[2] == 0xC0 - ? $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr}, ATIP values {subBuf[3]:X2}, {subBuf[4]:X2}, {subBuf[5]:X2}, first disc Lead-in starts at {subBuf[7]:X2}{subBuf[8]:X2}{subBuf[9]:X2} (LBA {qStart}), CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}" - : $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q: {subBuf[0]:X2} {subBuf[1]:X2} {subBuf[2]:X2} {subBuf[3]:X2} {subBuf[4]:X2} {subBuf[5]:X2} {subBuf[6]:X2} {subBuf[7]:X2} {subBuf[8]:X2} {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; + return subBuf[2] == 0xC0 ? $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, { + (corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr}, ATIP values {subBuf[3]:X2}, { + subBuf[4]:X2}, {subBuf[5]:X2}, first disc Lead-in starts at {subBuf[7]:X2}{subBuf[8]:X2}{ + subBuf[9]:X2} (LBA {qStart}), CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({ + (crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}" : $"{minute + :D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q: {subBuf[0]:X2} { + subBuf[1]:X2} {subBuf[2]:X2} {subBuf[3]:X2} {subBuf[4] + :X2} {subBuf[5]:X2} {subBuf[6]:X2} {subBuf[7]:X2} { + subBuf[8]:X2} {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{ + subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W { + (rwEmpty ? "empty" : "not empty")}"; string skipTracks = $"{subBuf[3]:X2}"; @@ -435,27 +534,59 @@ public static class Subchannel if(subBuf[9] > 0) skipTracks += $", {subBuf[4]:X2}"; - return - $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr}, tracks {skipTracks} to be skipped, CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}"; + return $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr}, tracks {skipTracks + } to be skipped, CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W { + (rwEmpty ? "empty" : "not empty")}"; } area = subBuf[1] == 0xAA ? "Lead-out" : "Program"; return adr switch { - 1 => - $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr} position: track {subBuf[1]:X} index {subBuf[2]:X} relative position {subBuf[3]:X2}:{subBuf[4]:X2}:{subBuf[5]:X2} (LBA {qPos + 150}), absolute position {subBuf[7]:X2}:{subBuf[8]:X2}:{subBuf[9]:X2} (LBA {qStart}), Q CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}", - 2 => - $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr} MCN: {DecodeMcn(subBuf)} frame {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}", - 3 => - $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q mode {adr} ISRC: {DecodeIsrc(subBuf)} frame {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}", - _ => - $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause ? "corrupted pause" : pause ? "pause" : "not pause")}, {controlInfo}, {copy}, Q: {subBuf[0]:X2} {subBuf[1]:X2} {subBuf[2]:X2} {subBuf[3]:X2} {subBuf[4]:X2} {subBuf[5]:X2} {subBuf[6]:X2} {subBuf[7]:X2} {subBuf[8]:X2} {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}" + 1 => $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr} position: track { + subBuf[1]:X} index {subBuf[2]:X} relative position {subBuf[3]:X2}:{subBuf[4] + :X2}:{subBuf[5]:X2} (LBA {qPos + 150}), absolute position {subBuf[7] + :X2}:{subBuf[8]:X2}:{subBuf[9]:X2} (LBA {qStart}), Q CRC 0x{subBuf[10] + :X2}{subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W { + (rwEmpty ? "empty" : "not empty")}", + 2 => $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr} MCN: {DecodeMcn(subBuf) + } frame {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{subBuf[11]:X2} ({ + (crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty")}", + 3 => $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q mode {adr} ISRC: { + DecodeIsrc(subBuf)} frame {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{subBuf[11] + :X2} ({(crcOk ? "OK" : "BAD")}), R-W {(rwEmpty ? "empty" : "not empty") + }", + _ => $"{minute:D2}:{second:D2}:{frame:D2} - LBA {lba,6}: {area} area, {(corruptedPause + ? "corrupted pause" + : pause + ? "pause" + : "not pause")}, {controlInfo}, {copy}, Q: {subBuf[0]:X2} {subBuf[1]:X2} { + subBuf[2]:X2} {subBuf[3]:X2} {subBuf[4]:X2} {subBuf[5]:X2} {subBuf[6]:X2} { + subBuf[7]:X2} {subBuf[8]:X2} {subBuf[9]:X2} CRC 0x{subBuf[10]:X2}{ + subBuf[11]:X2} ({(crcOk ? "OK" : "BAD")}), R-W { + (rwEmpty ? "empty" : "not empty")}" }; } - public static string DecodeIsrc(byte[] q) => - $"{_isrcTable[q[1] / 4]}{_isrcTable[(q[1] & 3) * 16 + q[2] / 16]}{_isrcTable[(q[2] & 0xF) * 4 + q[3] / 64]}{_isrcTable[q[3] & 0x3F]}{_isrcTable[q[4] / 4]}{q[5]:X2}{q[6]:X2}{q[7]:X2}{q[8] / 16:X1}"; + public static string DecodeIsrc(byte[] q) => $"{_isrcTable[q[1] / 4]}{_isrcTable[(q[1] & 3) * 16 + q[2] / 16]}{ + _isrcTable[(q[2] & 0xF) * 4 + q[3] / 64]}{_isrcTable[q[3] & 0x3F]}{_isrcTable[q[4] / 4]}{q[5]:X2}{q[6]:X2}{q[7] + :X2}{q[8] / 16:X1}"; public static string DecodeMcn(byte[] q) => $"{q[1]:X2}{q[2]:X2}{q[3]:X2}{q[4]:X2}{q[5]:X2}{q[6]:X2}{q[7] >> 4:X}"; diff --git a/DVD/CSS&CPRM.cs b/DVD/CSS&CPRM.cs index 188c31d9b..102238dc7 100644 --- a/DVD/CSS&CPRM.cs +++ b/DVD/CSS&CPRM.cs @@ -125,37 +125,46 @@ public static class CSS_CPRM sb.AppendLine($"Drive has {vendorResets} vendor resets available."); sb.AppendLine($"Drive has {userControlledChanges} user controlled changes available."); - if(decoded.RegionMask == 0xFF) - sb.AppendLine("Drive has no region set."); - else if(decoded.RegionMask == 0x00) - sb.AppendLine("Drive is region free."); - else + switch(decoded.RegionMask) { - sb.Append("Drive has the following regions set:"); + case 0xFF: + sb.AppendLine("Drive has no region set."); - if((decoded.RegionMask & 0x01) != 0x01) - sb.Append(" 1"); + break; + case 0x00: + sb.AppendLine("Drive is region free."); - if((decoded.RegionMask & 0x02) != 0x02) - sb.Append(" 2"); + break; + default: + { + sb.Append("Drive has the following regions set:"); - if((decoded.RegionMask & 0x04) != 0x04) - sb.Append(" 3"); + if((decoded.RegionMask & 0x01) != 0x01) + sb.Append(" 1"); - if((decoded.RegionMask & 0x08) != 0x08) - sb.Append(" 4"); + if((decoded.RegionMask & 0x02) != 0x02) + sb.Append(" 2"); - if((decoded.RegionMask & 0x10) != 0x10) - sb.Append(" 5"); + if((decoded.RegionMask & 0x04) != 0x04) + sb.Append(" 3"); - if((decoded.RegionMask & 0x20) != 0x20) - sb.Append(" 6"); + if((decoded.RegionMask & 0x08) != 0x08) + sb.Append(" 4"); - if((decoded.RegionMask & 0x40) != 0x40) - sb.Append(" 7"); + if((decoded.RegionMask & 0x10) != 0x10) + sb.Append(" 5"); - if((decoded.RegionMask & 0x80) != 0x80) - sb.Append(" 8"); + if((decoded.RegionMask & 0x20) != 0x20) + sb.Append(" 6"); + + if((decoded.RegionMask & 0x40) != 0x40) + sb.Append(" 7"); + + if((decoded.RegionMask & 0x80) != 0x80) + sb.Append(" 8"); + + break; + } } sb.AppendLine(""); @@ -217,37 +226,46 @@ public static class CSS_CPRM if(decoded.CopyrightType == 0) return sb.ToString(); - if(decoded.RegionInformation == 0xFF) - sb.AppendLine("Disc cannot be played in any region at all."); - else if(decoded.RegionInformation == 0x00) - sb.AppendLine("Disc can be played in any region."); - else + switch(decoded.RegionInformation) { - sb.Append("Disc can be played in the following regions:"); + case 0xFF: + sb.AppendLine("Disc cannot be played in any region at all."); - if((decoded.RegionInformation & 0x01) != 0x01) - sb.Append(" 1"); + break; + case 0x00: + sb.AppendLine("Disc can be played in any region."); - if((decoded.RegionInformation & 0x02) != 0x02) - sb.Append(" 2"); + break; + default: + { + sb.Append("Disc can be played in the following regions:"); - if((decoded.RegionInformation & 0x04) != 0x04) - sb.Append(" 3"); + if((decoded.RegionInformation & 0x01) != 0x01) + sb.Append(" 1"); - if((decoded.RegionInformation & 0x08) != 0x08) - sb.Append(" 4"); + if((decoded.RegionInformation & 0x02) != 0x02) + sb.Append(" 2"); - if((decoded.RegionInformation & 0x10) != 0x10) - sb.Append(" 5"); + if((decoded.RegionInformation & 0x04) != 0x04) + sb.Append(" 3"); - if((decoded.RegionInformation & 0x20) != 0x20) - sb.Append(" 6"); + if((decoded.RegionInformation & 0x08) != 0x08) + sb.Append(" 4"); - if((decoded.RegionInformation & 0x40) != 0x40) - sb.Append(" 7"); + if((decoded.RegionInformation & 0x10) != 0x10) + sb.Append(" 5"); - if((decoded.RegionInformation & 0x80) != 0x80) - sb.Append(" 8"); + if((decoded.RegionInformation & 0x20) != 0x20) + sb.Append(" 6"); + + if((decoded.RegionInformation & 0x40) != 0x40) + sb.Append(" 7"); + + if((decoded.RegionInformation & 0x80) != 0x80) + sb.Append(" 8"); + + break; + } } return sb.ToString(); diff --git a/DVD/PFI.cs b/DVD/PFI.cs index e03e29d45..77179c3cd 100644 --- a/DVD/PFI.cs +++ b/DVD/PFI.cs @@ -211,95 +211,98 @@ public static class PFI case DiskCategory.DVDRAM: pfi.DiscType = (DVDRAMDiscType)response[36]; - if(pfi.PartVersion == 1) + switch(pfi.PartVersion) { - pfi.Velocity = response[52]; - pfi.ReadPower = response[53]; - pfi.PeakPower = response[54]; - pfi.BiasPower = response[55]; - pfi.FirstPulseStart = response[56]; - pfi.FirstPulseEnd = response[57]; - pfi.MultiPulseDuration = response[58]; - pfi.LastPulseStart = response[59]; - pfi.LastPulseEnd = response[60]; - pfi.BiasPowerDuration = response[61]; - pfi.PeakPowerGroove = response[62]; - pfi.BiasPowerGroove = response[63]; - pfi.FirstPulseStartGroove = response[64]; - pfi.FirstPulseEndGroove = response[65]; - pfi.MultiplePulseDurationGroove = response[66]; - pfi.LastPulseStartGroove = response[67]; - pfi.LastPulseEndGroove = response[68]; - pfi.BiasPowerDurationGroove = response[69]; - } - else if(pfi.PartVersion >= 6) - { - pfi.Velocity = response[504]; - pfi.ReadPower = response[505]; - pfi.AdaptativeWritePulseControlFlag |= (response[506] & 0x80) == 0x80; - pfi.PeakPower = response[507]; - pfi.BiasPower1 = response[508]; - pfi.BiasPower2 = response[509]; - pfi.BiasPower3 = response[510]; - pfi.PeakPowerGroove = response[511]; - pfi.BiasPower1Groove = response[512]; - pfi.BiasPower2Groove = response[513]; - pfi.BiasPower3Groove = response[514]; - pfi.FirstPulseEnd = response[515]; - pfi.FirstPulseDuration = response[516]; - pfi.MultiPulseDuration = response[518]; - pfi.LastPulseStart = response[519]; - pfi.BiasPower2Duration = response[520]; - pfi.FirstPulseStart3TSpace3T = response[521]; - pfi.FirstPulseStart4TSpace3T = response[522]; - pfi.FirstPulseStart5TSpace3T = response[523]; - pfi.FirstPulseStartSpace3T = response[524]; - pfi.FirstPulseStart3TSpace4T = response[525]; - pfi.FirstPulseStart4TSpace4T = response[526]; - pfi.FirstPulseStart5TSpace4T = response[527]; - pfi.FirstPulseStartSpace4T = response[528]; - pfi.FirstPulseStart3TSpace5T = response[529]; - pfi.FirstPulseStart4TSpace5T = response[530]; - pfi.FirstPulseStart5TSpace5T = response[531]; - pfi.FirstPulseStartSpace5T = response[532]; - pfi.FirstPulseStart3TSpace = response[533]; - pfi.FirstPulseStart4TSpace = response[534]; - pfi.FirstPulseStart5TSpace = response[535]; - pfi.FirstPulseStartSpace = response[536]; - pfi.FirstPulse3TStartTSpace3T = response[537]; - pfi.FirstPulse4TStartTSpace3T = response[538]; - pfi.FirstPulse5TStartTSpace3T = response[539]; - pfi.FirstPulseStartTSpace3T = response[540]; - pfi.FirstPulse3TStartTSpace4T = response[541]; - pfi.FirstPulse4TStartTSpace4T = response[542]; - pfi.FirstPulse5TStartTSpace4T = response[543]; - pfi.FirstPulseStartTSpace4T = response[544]; - pfi.FirstPulse3TStartTSpace5T = response[545]; - pfi.FirstPulse4TStartTSpace5T = response[546]; - pfi.FirstPulse5TStartTSpace5T = response[547]; - pfi.FirstPulseStartTSpace5T = response[548]; - pfi.FirstPulse3TStartTSpace = response[549]; - pfi.FirstPulse4TStartTSpace = response[550]; - pfi.FirstPulse5TStartTSpace = response[551]; - pfi.FirstPulseStartTSpace = response[552]; - tmp = new byte[48]; - Array.Copy(response, 553, tmp, 0, 48); - pfi.DiskManufacturer = StringHandlers.SpacePaddedToString(tmp); - tmp = new byte[16]; - Array.Copy(response, 601, tmp, 0, 16); - pfi.DiskManufacturerSupplementary = StringHandlers.SpacePaddedToString(tmp); - pfi.WritePowerControlParams = new byte[2]; - pfi.WritePowerControlParams[0] = response[617]; - pfi.WritePowerControlParams[1] = response[618]; - pfi.PowerRatioLandThreshold = response[619]; - pfi.TargetAsymmetry = response[620]; - pfi.TemporaryPeakPower = response[621]; - pfi.TemporaryBiasPower1 = response[622]; - pfi.TemporaryBiasPower2 = response[623]; - pfi.TemporaryBiasPower3 = response[624]; - pfi.PowerRatioGrooveThreshold = response[625]; - pfi.PowerRatioLandThreshold6T = response[626]; - pfi.PowerRatioGrooveThreshold6T = response[627]; + case 1: + pfi.Velocity = response[52]; + pfi.ReadPower = response[53]; + pfi.PeakPower = response[54]; + pfi.BiasPower = response[55]; + pfi.FirstPulseStart = response[56]; + pfi.FirstPulseEnd = response[57]; + pfi.MultiPulseDuration = response[58]; + pfi.LastPulseStart = response[59]; + pfi.LastPulseEnd = response[60]; + pfi.BiasPowerDuration = response[61]; + pfi.PeakPowerGroove = response[62]; + pfi.BiasPowerGroove = response[63]; + pfi.FirstPulseStartGroove = response[64]; + pfi.FirstPulseEndGroove = response[65]; + pfi.MultiplePulseDurationGroove = response[66]; + pfi.LastPulseStartGroove = response[67]; + pfi.LastPulseEndGroove = response[68]; + pfi.BiasPowerDurationGroove = response[69]; + + break; + case >= 6: + pfi.Velocity = response[504]; + pfi.ReadPower = response[505]; + pfi.AdaptativeWritePulseControlFlag |= (response[506] & 0x80) == 0x80; + pfi.PeakPower = response[507]; + pfi.BiasPower1 = response[508]; + pfi.BiasPower2 = response[509]; + pfi.BiasPower3 = response[510]; + pfi.PeakPowerGroove = response[511]; + pfi.BiasPower1Groove = response[512]; + pfi.BiasPower2Groove = response[513]; + pfi.BiasPower3Groove = response[514]; + pfi.FirstPulseEnd = response[515]; + pfi.FirstPulseDuration = response[516]; + pfi.MultiPulseDuration = response[518]; + pfi.LastPulseStart = response[519]; + pfi.BiasPower2Duration = response[520]; + pfi.FirstPulseStart3TSpace3T = response[521]; + pfi.FirstPulseStart4TSpace3T = response[522]; + pfi.FirstPulseStart5TSpace3T = response[523]; + pfi.FirstPulseStartSpace3T = response[524]; + pfi.FirstPulseStart3TSpace4T = response[525]; + pfi.FirstPulseStart4TSpace4T = response[526]; + pfi.FirstPulseStart5TSpace4T = response[527]; + pfi.FirstPulseStartSpace4T = response[528]; + pfi.FirstPulseStart3TSpace5T = response[529]; + pfi.FirstPulseStart4TSpace5T = response[530]; + pfi.FirstPulseStart5TSpace5T = response[531]; + pfi.FirstPulseStartSpace5T = response[532]; + pfi.FirstPulseStart3TSpace = response[533]; + pfi.FirstPulseStart4TSpace = response[534]; + pfi.FirstPulseStart5TSpace = response[535]; + pfi.FirstPulseStartSpace = response[536]; + pfi.FirstPulse3TStartTSpace3T = response[537]; + pfi.FirstPulse4TStartTSpace3T = response[538]; + pfi.FirstPulse5TStartTSpace3T = response[539]; + pfi.FirstPulseStartTSpace3T = response[540]; + pfi.FirstPulse3TStartTSpace4T = response[541]; + pfi.FirstPulse4TStartTSpace4T = response[542]; + pfi.FirstPulse5TStartTSpace4T = response[543]; + pfi.FirstPulseStartTSpace4T = response[544]; + pfi.FirstPulse3TStartTSpace5T = response[545]; + pfi.FirstPulse4TStartTSpace5T = response[546]; + pfi.FirstPulse5TStartTSpace5T = response[547]; + pfi.FirstPulseStartTSpace5T = response[548]; + pfi.FirstPulse3TStartTSpace = response[549]; + pfi.FirstPulse4TStartTSpace = response[550]; + pfi.FirstPulse5TStartTSpace = response[551]; + pfi.FirstPulseStartTSpace = response[552]; + tmp = new byte[48]; + Array.Copy(response, 553, tmp, 0, 48); + pfi.DiskManufacturer = StringHandlers.SpacePaddedToString(tmp); + tmp = new byte[16]; + Array.Copy(response, 601, tmp, 0, 16); + pfi.DiskManufacturerSupplementary = StringHandlers.SpacePaddedToString(tmp); + pfi.WritePowerControlParams = new byte[2]; + pfi.WritePowerControlParams[0] = response[617]; + pfi.WritePowerControlParams[1] = response[618]; + pfi.PowerRatioLandThreshold = response[619]; + pfi.TargetAsymmetry = response[620]; + pfi.TemporaryPeakPower = response[621]; + pfi.TemporaryBiasPower1 = response[622]; + pfi.TemporaryBiasPower2 = response[623]; + pfi.TemporaryBiasPower3 = response[624]; + pfi.PowerRatioGrooveThreshold = response[625]; + pfi.PowerRatioLandThreshold6T = response[626]; + pfi.PowerRatioGrooveThreshold6T = response[627]; + + break; } break; @@ -781,12 +784,17 @@ public static class PFI sb.AppendFormat("Disc has {0} layers", decoded.Layers + 1).AppendLine(); - if(decoded.TrackPath && - decoded.Layers == 1) - sb.AppendLine("Layers are in parallel track path"); - else if(!decoded.TrackPath && - decoded.Layers == 1) - sb.AppendLine("Layers are in opposite track path"); + switch(decoded.TrackPath) + { + case true when decoded.Layers == 1: + sb.AppendLine("Layers are in parallel track path"); + + break; + case false when decoded.Layers == 1: + sb.AppendLine("Layers are in opposite track path"); + + break; + } switch(decoded.LinearDensity) { diff --git a/Floppy/Apple2.cs b/Floppy/Apple2.cs index 99e440c14..f6680214d 100644 --- a/Floppy/Apple2.cs +++ b/Floppy/Apple2.cs @@ -208,20 +208,23 @@ public static class Apple2 { output[i] = (byte)((buffer[86 + i] << 2) & 0xFF); - if(i < 86) + switch(i) { - output[i] |= (byte)(((buffer[i] & 1) << 1) & 0xFF); - output[i] |= (byte)(((buffer[i] & 2) >> 1) & 0xFF); - } - else if(i < 86 * 2) - { - output[i] |= (byte)(((buffer[i - 86] & 4) >> 1) & 0xFF); - output[i] |= (byte)(((buffer[i - 86] & 8) >> 3) & 0xFF); - } - else - { - output[i] |= (byte)(((buffer[i - 86 * 2] & 0x10) >> 3) & 0xFF); - output[i] |= (byte)(((buffer[i - 86 * 2] & 0x20) >> 5) & 0xFF); + case < 86: + output[i] |= (byte)(((buffer[i] & 1) << 1) & 0xFF); + output[i] |= (byte)(((buffer[i] & 2) >> 1) & 0xFF); + + break; + case < 86 * 2: + output[i] |= (byte)(((buffer[i - 86] & 4) >> 1) & 0xFF); + output[i] |= (byte)(((buffer[i - 86] & 8) >> 3) & 0xFF); + + break; + default: + output[i] |= (byte)(((buffer[i - 86 * 2] & 0x10) >> 3) & 0xFF); + output[i] |= (byte)(((buffer[i - 86 * 2] & 0x20) >> 5) & 0xFF); + + break; } } diff --git a/MMC/CSD.cs b/MMC/CSD.cs index 2b7b2088f..c6ea55b36 100644 --- a/MMC/CSD.cs +++ b/MMC/CSD.cs @@ -421,14 +421,25 @@ public static partial class Decoders result = (csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2) * Math.Pow(2, csd.ReadBlockLength); - if(result > 1073741824) - sb.AppendFormat("\tDevice has {0} GiB", result / 1073741824.0).AppendLine(); - else if(result > 1048576) - sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine(); - else if(result > 1024) - sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine(); - else - sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine(); + switch(result) + { + case > 1073741824: + sb.AppendFormat("\tDevice has {0} GiB", result / 1073741824.0).AppendLine(); + + break; + case > 1048576: + sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine(); + + break; + case > 1024: + sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine(); + + break; + default: + sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine(); + + break; + } switch(csd.ReadCurrentAtVddMin & 0x07) { diff --git a/MMC/ExtendedCSD.cs b/MMC/ExtendedCSD.cs index 73daf48c4..c80e1f67d 100644 --- a/MMC/ExtendedCSD.cs +++ b/MMC/ExtendedCSD.cs @@ -438,18 +438,27 @@ public static partial class Decoders { unit = Math.Pow(2, csd.OperationCodesTimeout) * 100; - if(unit > 1000000) - sb. - AppendFormat("\t\tMaximum timeout for switch command when setting a value to the mode operation codes field is {0:D2}s", - unit / 1000000).AppendLine(); - else if(unit > 1000) - sb. - AppendFormat("\tMaximum timeout for switch command when setting a value to the mode operation codes field is {0:D2}ms", - unit / 1000).AppendLine(); - else - sb. - AppendFormat("\tMaximum timeout for switch command when setting a value to the mode operation codes field is {0:D2}µs", - unit).AppendLine(); + switch(unit) + { + case > 1000000: + sb. + AppendFormat("\t\tMaximum timeout for switch command when setting a value to the mode operation codes field is {0:D2}s", + unit / 1000000).AppendLine(); + + break; + case > 1000: + sb. + AppendFormat("\tMaximum timeout for switch command when setting a value to the mode operation codes field is {0:D2}ms", + unit / 1000).AppendLine(); + + break; + default: + sb. + AppendFormat("\tMaximum timeout for switch command when setting a value to the mode operation codes field is {0:D2}µs", + unit).AppendLine(); + + break; + } } } @@ -716,43 +725,71 @@ public static partial class Decoders { unit = Math.Pow(2, csd.ProductionStateAwareness) * 100; - if(unit > 1000000) - sb.AppendFormat("\tDevice takes a maximum of {0} s to switch production state awareness", - unit / 1000000).AppendLine(); - else if(unit > 1000) - sb.AppendFormat("\tDevice takes a maximum of {0} ms to switch production state awareness", unit / 1000). - AppendLine(); - else - sb.AppendFormat("\tDevice takes a maximum of {0} μs to switch production state awareness", unit). - AppendLine(); + switch(unit) + { + case > 1000000: + sb.AppendFormat("\tDevice takes a maximum of {0} s to switch production state awareness", + unit / 1000000).AppendLine(); + + break; + case > 1000: + sb.AppendFormat("\tDevice takes a maximum of {0} ms to switch production state awareness", + unit / 1000).AppendLine(); + + break; + default: + sb.AppendFormat("\tDevice takes a maximum of {0} μs to switch production state awareness", unit). + AppendLine(); + + break; + } } if(csd.SleepAwakeTimeout > 0) { unit = Math.Pow(2, csd.SleepAwakeTimeout) * 100; - if(unit > 1000000) - sb.AppendFormat("\tDevice takes a maximum of {0} ms to transition between sleep and standby states", - unit / 1000000).AppendLine(); - else if(unit > 1000) - sb.AppendFormat("\tDevice takes a maximum of {0} μs to transition between sleep and standby states", - unit / 1000).AppendLine(); - else - sb.AppendFormat("\tDevice takes a maximum of {0} ns to transition between sleep and standby states", - unit).AppendLine(); + switch(unit) + { + case > 1000000: + sb.AppendFormat("\tDevice takes a maximum of {0} ms to transition between sleep and standby states", + unit / 1000000).AppendLine(); + + break; + case > 1000: + sb.AppendFormat("\tDevice takes a maximum of {0} μs to transition between sleep and standby states", + unit / 1000).AppendLine(); + + break; + default: + sb.AppendFormat("\tDevice takes a maximum of {0} ns to transition between sleep and standby states", + unit).AppendLine(); + + break; + } } if(csd.SleepNotificationTimeout > 0) { unit = Math.Pow(2, csd.SleepNotificationTimeout) * 10; - if(unit > 1000000) - sb.AppendFormat("\tDevice takes a maximum of {0} s to move to sleep state", unit / 1000000). - AppendLine(); - else if(unit > 1000) - sb.AppendFormat("\tDevice takes a maximum of {0} ms to move to sleep state", unit / 1000).AppendLine(); - else - sb.AppendFormat("\tDevice takes a maximum of {0} μs to move to sleep state", unit).AppendLine(); + switch(unit) + { + case > 1000000: + sb.AppendFormat("\tDevice takes a maximum of {0} s to move to sleep state", unit / 1000000). + AppendLine(); + + break; + case > 1000: + sb.AppendFormat("\tDevice takes a maximum of {0} ms to move to sleep state", unit / 1000). + AppendLine(); + + break; + default: + sb.AppendFormat("\tDevice takes a maximum of {0} μs to move to sleep state", unit).AppendLine(); + + break; + } } sb.AppendFormat("\tDevice has {0} sectors", csd.SectorCount).AppendLine(); diff --git a/SCSI/MMC/Features.cs b/SCSI/MMC/Features.cs index 0d7bc197f..7295691c9 100644 --- a/SCSI/MMC/Features.cs +++ b/SCSI/MMC/Features.cs @@ -3741,15 +3741,27 @@ public static class Features else if(ftr.DVDPRead && ftr.DVDPWrite) sb.Append("Drive can read and write DVD+MRW"); - else if(ftr.Write && - ftr.DVDPRead) - sb.Append("Drive and read DVD+MRW and read and write CD-MRW"); - else if(ftr.Write) - sb.Append("Drive can read and write CD-MRW"); - else if(ftr.DVDPRead) - sb.Append("Drive can read CD-MRW and DVD+MRW"); else - sb.Append("Drive can read CD-MRW"); + switch(ftr.Write) + { + case true when ftr.DVDPRead: + sb.Append("Drive and read DVD+MRW and read and write CD-MRW"); + + break; + case true: + sb.Append("Drive can read and write CD-MRW"); + + break; + default: + { + if(ftr.DVDPRead) + sb.Append("Drive can read CD-MRW and DVD+MRW"); + else + sb.Append("Drive can read CD-MRW"); + + break; + } + } if(ftr.Current) sb.AppendLine(" (current)"); @@ -3968,14 +3980,21 @@ public static class Features Feature_002E ftr = feature.Value; var sb = new StringBuilder(); - if(ftr.SAO && - !ftr.RAW) - sb.AppendLine("Drive can write CDs in Session at Once Mode:"); - else if(!ftr.SAO && - ftr.RAW) - sb.AppendLine("Drive can write CDs in raw Mode:"); - else - sb.AppendLine("Drive can write CDs in Session at Once and in Raw Modes:"); + switch(ftr.SAO) + { + case true when !ftr.RAW: + sb.AppendLine("Drive can write CDs in Session at Once Mode:"); + + break; + case false when ftr.RAW: + sb.AppendLine("Drive can write CDs in raw Mode:"); + + break; + default: + sb.AppendLine("Drive can write CDs in Session at Once and in Raw Modes:"); + + break; + } if(ftr.RAW && ftr.RAWMS) @@ -4270,7 +4289,8 @@ public static class Features } public static string Prettify_0042(Feature_0042? feature) => - !feature.HasValue ? null : "Drive is able to detect and report defective writable unit and behave accordingly\n"; + !feature.HasValue ? null + : "Drive is able to detect and report defective writable unit and behave accordingly\n"; public static string Prettify_0050(Feature_0050? feature) { @@ -4280,15 +4300,26 @@ public static class Features Feature_0050 ftr = feature.Value; var sb = new StringBuilder(); - if(ftr.HDDVDR && - ftr.HDDVDRAM) - sb.Append("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM"); - else if(ftr.HDDVDR) - sb.Append("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R"); - else if(ftr.HDDVDRAM) - sb.Append("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM"); - else - sb.Append("Drive can read HD DVD-ROM and HD DVD-RW"); + switch(ftr.HDDVDR) + { + case true when ftr.HDDVDRAM: + sb.Append("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM"); + + break; + case true: + sb.Append("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R"); + + break; + default: + { + if(ftr.HDDVDRAM) + sb.Append("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM"); + else + sb.Append("Drive can read HD DVD-ROM and HD DVD-RW"); + + break; + } + } if(ftr.Current) sb.AppendLine(" (current)"); @@ -4306,15 +4337,26 @@ public static class Features Feature_0051 ftr = feature.Value; var sb = new StringBuilder(); - if(ftr.HDDVDR && - ftr.HDDVDRAM) - sb.Append("Drive can write HD DVD-RW, HD DVD-R and HD DVD-RAM"); - else if(ftr.HDDVDR) - sb.Append("Drive can write HD DVD-RW and HD DVD-R"); - else if(ftr.HDDVDRAM) - sb.Append("Drive can write HD DVD-RW and HD DVD-RAM"); - else - sb.Append("Drive can write HD DVD-RW"); + switch(ftr.HDDVDR) + { + case true when ftr.HDDVDRAM: + sb.Append("Drive can write HD DVD-RW, HD DVD-R and HD DVD-RAM"); + + break; + case true: + sb.Append("Drive can write HD DVD-RW and HD DVD-R"); + + break; + default: + { + if(ftr.HDDVDRAM) + sb.Append("Drive can write HD DVD-RW and HD DVD-RAM"); + else + sb.Append("Drive can write HD DVD-RW"); + + break; + } + } if(ftr.Current) sb.AppendLine(" (current)"); diff --git a/SCSI/Modes/11.cs b/SCSI/Modes/11.cs index deff75dd2..ac217c987 100644 --- a/SCSI/Modes/11.cs +++ b/SCSI/Modes/11.cs @@ -163,16 +163,25 @@ public static partial class Modes if(page.POFM) sb.AppendLine("\tPartition parameters will not be applied until a FORMAT MEDIUM command is received"); - if(!page.CLEAR && - !page.ADDP) - sb.AppendLine("\tDevice may erase any or all partitions on MODE SELECT for partitioning"); - else if(page.CLEAR && - !page.ADDP) - sb.AppendLine("\tDevice shall erase all partitions on MODE SELECT for partitioning"); - else if(!page.CLEAR) - sb.AppendLine("\tDevice shall not erase any partition on MODE SELECT for partitioning"); - else - sb.AppendLine("\tDevice shall erase all partitions differing on size on MODE SELECT for partitioning"); + switch(page.CLEAR) + { + case false when !page.ADDP: + sb.AppendLine("\tDevice may erase any or all partitions on MODE SELECT for partitioning"); + + break; + case true when !page.ADDP: + sb.AppendLine("\tDevice shall erase all partitions on MODE SELECT for partitioning"); + + break; + case false: + sb.AppendLine("\tDevice shall not erase any partition on MODE SELECT for partitioning"); + + break; + default: + sb.AppendLine("\tDevice shall erase all partitions differing on size on MODE SELECT for partitioning"); + + break; + } string measure; diff --git a/SCSI/Modes/2A.cs b/SCSI/Modes/2A.cs index 8cbf54306..a5d1adf6a 100644 --- a/SCSI/Modes/2A.cs +++ b/SCSI/Modes/2A.cs @@ -187,14 +187,19 @@ public static partial class Modes sb.AppendLine("\tDrive contains a changer that can report the exact contents of the slots"); if(page.CurrentWriteSpeedSelected > 0) - { - if(page.RotationControlSelected == 0) - sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec. in CLV mode", - page.CurrentWriteSpeedSelected).AppendLine(); - else if(page.RotationControlSelected == 1) - sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec. in pure CAV mode", - page.CurrentWriteSpeedSelected).AppendLine(); - } + switch(page.RotationControlSelected) + { + case 0: + sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec. in CLV mode", + page.CurrentWriteSpeedSelected).AppendLine(); + + break; + case 1: + sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec. in pure CAV mode", + page.CurrentWriteSpeedSelected).AppendLine(); + + break; + } else { if(page.MaxWriteSpeed > 0) @@ -208,12 +213,19 @@ public static partial class Modes if(page.WriteSpeedPerformanceDescriptors != null) foreach(ModePage_2A_WriteDescriptor descriptor in page.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0)) - if(descriptor.RotationControl == 0) - sb.AppendFormat("\tDrive supports writing at {0} Kbyte/sec. in CLV mode", descriptor.WriteSpeed). - AppendLine(); - else if(descriptor.RotationControl == 1) - sb.AppendFormat("\tDrive supports writing at is {0} Kbyte/sec. in pure CAV mode", - descriptor.WriteSpeed).AppendLine(); + switch(descriptor.RotationControl) + { + case 0: + sb.AppendFormat("\tDrive supports writing at {0} Kbyte/sec. in CLV mode", + descriptor.WriteSpeed).AppendLine(); + + break; + case 1: + sb.AppendFormat("\tDrive supports writing at is {0} Kbyte/sec. in pure CAV mode", + descriptor.WriteSpeed).AppendLine(); + + break; + } if(page.TestWrite) sb.AppendLine("\tDrive supports test writing"); diff --git a/SCSI/Modes/Mode10.cs b/SCSI/Modes/Mode10.cs index 4478bf369..7aaae9010 100644 --- a/SCSI/Modes/Mode10.cs +++ b/SCSI/Modes/Mode10.cs @@ -200,36 +200,43 @@ public static partial class Modes offset += pg.PageResponse.Length; } else - { - if(isSubpage && offset + 3 < modeResponse.Length) + switch(isSubpage) { - pg.PageResponse = new byte[(modeResponse[offset + 2] << 8) + modeResponse[offset + 3] + 4]; - int copyLen = pg.PageResponse.Length; + case true when offset + 3 < modeResponse.Length: + { + pg.PageResponse = new byte[(modeResponse[offset + 2] << 8) + modeResponse[offset + 3] + 4]; + int copyLen = pg.PageResponse.Length; - if(pg.PageResponse.Length + offset > modeResponse.Length) - copyLen = modeResponse.Length - offset; + if(pg.PageResponse.Length + offset > modeResponse.Length) + copyLen = modeResponse.Length - offset; - Array.Copy(modeResponse, offset, pg.PageResponse, 0, copyLen); - pg.Page = (byte)(modeResponse[offset] & 0x3F); - pg.Subpage = modeResponse[offset + 1]; - offset += pg.PageResponse.Length; + Array.Copy(modeResponse, offset, pg.PageResponse, 0, copyLen); + pg.Page = (byte)(modeResponse[offset] & 0x3F); + pg.Subpage = modeResponse[offset + 1]; + offset += pg.PageResponse.Length; + + break; + } + case true when offset + 1 < modeResponse.Length: + { + pg.PageResponse = new byte[modeResponse[offset + 1] + 2]; + int copyLen = pg.PageResponse.Length; + + if(pg.PageResponse.Length + offset > modeResponse.Length) + copyLen = modeResponse.Length - offset; + + Array.Copy(modeResponse, offset, pg.PageResponse, 0, copyLen); + pg.Page = (byte)(modeResponse[offset] & 0x3F); + pg.Subpage = 0; + offset += pg.PageResponse.Length; + + break; + } + default: + offset = modeResponse.Length; + + break; } - else if(isSubpage && offset + 1 < modeResponse.Length) - { - pg.PageResponse = new byte[modeResponse[offset + 1] + 2]; - int copyLen = pg.PageResponse.Length; - - if(pg.PageResponse.Length + offset > modeResponse.Length) - copyLen = modeResponse.Length - offset; - - Array.Copy(modeResponse, offset, pg.PageResponse, 0, copyLen); - pg.Page = (byte)(modeResponse[offset] & 0x3F); - pg.Subpage = 0; - offset += pg.PageResponse.Length; - } - else - offset = modeResponse.Length; - } listpages.Add(pg); } diff --git a/SecureDigital/CSD.cs b/SecureDigital/CSD.cs index 9e4b73ce4..da1ac6221 100644 --- a/SecureDigital/CSD.cs +++ b/SecureDigital/CSD.cs @@ -408,30 +408,54 @@ public static partial class Decoders result = (csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2) * Math.Pow(2, csd.ReadBlockLength); - if(result > 1073741824) - sb.AppendFormat("\tDevice has {0} GiB", result / 1073741824.0).AppendLine(); - else if(result > 1048576) - sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine(); - else if(result > 1024) - sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine(); - else - sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine(); + switch(result) + { + case > 1073741824: + sb.AppendFormat("\tDevice has {0} GiB", result / 1073741824.0).AppendLine(); + + break; + case > 1048576: + sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine(); + + break; + case > 1024: + sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine(); + + break; + default: + sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine(); + + break; + } } else { sb.AppendFormat("\tDevice has {0} blocks", (csd.Size + 1) * 1024).AppendLine(); result = ((ulong)csd.Size + 1) * 1024 * 512; - if(result > 1099511627776) - sb.AppendFormat("\tDevice has {0} TiB", result / 1099511627776.0).AppendLine(); - else if(result > 1073741824) - sb.AppendFormat("\tDevice has {0} GiB", result / 1073741824.0).AppendLine(); - else if(result > 1048576) - sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine(); - else if(result > 1024) - sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine(); - else - sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine(); + switch(result) + { + case > 1099511627776: + sb.AppendFormat("\tDevice has {0} TiB", result / 1099511627776.0).AppendLine(); + + break; + case > 1073741824: + sb.AppendFormat("\tDevice has {0} GiB", result / 1073741824.0).AppendLine(); + + break; + case > 1048576: + sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine(); + + break; + case > 1024: + sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine(); + + break; + default: + sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine(); + + break; + } } if(csd.Structure == 0) diff --git a/Xbox/SS.cs b/Xbox/SS.cs index 5725f6073..f2275d58d 100644 --- a/Xbox/SS.cs +++ b/Xbox/SS.cs @@ -209,12 +209,17 @@ public static class SS sb.AppendFormat("Disc has {0} layers", decoded.Layers + 1).AppendLine(); - if(decoded.TrackPath && - decoded.Layers == 1) - sb.AppendLine("Layers are in parallel track path"); - else if(!decoded.TrackPath && - decoded.Layers == 1) - sb.AppendLine("Layers are in opposite track path"); + switch(decoded.TrackPath) + { + case true when decoded.Layers == 1: + sb.AppendLine("Layers are in parallel track path"); + + break; + case false when decoded.Layers == 1: + sb.AppendLine("Layers are in opposite track path"); + + break; + } switch(decoded.LinearDensity) {