diff --git a/CD/ATIP.cs b/CD/ATIP.cs index c224991..c91c761 100644 --- a/CD/ATIP.cs +++ b/CD/ATIP.cs @@ -57,8 +57,7 @@ public static class ATIP { public static CDATIP Decode(byte[] CDATIPResponse) { - if(CDATIPResponse == null || - CDATIPResponse.Length <= 4) + if(CDATIPResponse is not { Length: > 4 }) return null; var decoded = new CDATIP(); diff --git a/CD/CDTextOnLeadIn.cs b/CD/CDTextOnLeadIn.cs index e8a7592..a91ad66 100644 --- a/CD/CDTextOnLeadIn.cs +++ b/CD/CDTextOnLeadIn.cs @@ -93,8 +93,7 @@ public static class CDTextOnLeadIn public static CDText? Decode(byte[] CDTextResponse) { - if(CDTextResponse == null || - CDTextResponse.Length <= 4) + if(CDTextResponse is not { Length: > 4 }) return null; var decoded = new CDText diff --git a/CD/FullTOC.cs b/CD/FullTOC.cs index 080e25e..b6d2eb1 100644 --- a/CD/FullTOC.cs +++ b/CD/FullTOC.cs @@ -69,8 +69,7 @@ public static class FullTOC public static CDFullTOC? Decode(byte[] CDFullTOCResponse) { - if(CDFullTOCResponse == null || - CDFullTOCResponse.Length <= 4) + if(CDFullTOCResponse is not { Length: > 4 }) return null; var decoded = new CDFullTOC diff --git a/CD/PMA.cs b/CD/PMA.cs index 122eca9..4851a86 100644 --- a/CD/PMA.cs +++ b/CD/PMA.cs @@ -56,8 +56,7 @@ public static class PMA { public static CDPMA? Decode(byte[] CDPMAResponse) { - if(CDPMAResponse == null || - CDPMAResponse.Length <= 4) + if(CDPMAResponse is not { Length: > 4 }) return null; var decoded = new CDPMA diff --git a/CD/Session.cs b/CD/Session.cs index e4e07de..146dfc9 100644 --- a/CD/Session.cs +++ b/CD/Session.cs @@ -55,8 +55,7 @@ public static class Session { public static CDSessionInfo? Decode(byte[] CDSessionInfoResponse) { - if(CDSessionInfoResponse == null || - CDSessionInfoResponse.Length <= 4) + if(CDSessionInfoResponse is not { Length: > 4 }) return null; var decoded = new CDSessionInfo diff --git a/CD/TOC.cs b/CD/TOC.cs index ea19943..2354283 100644 --- a/CD/TOC.cs +++ b/CD/TOC.cs @@ -58,8 +58,7 @@ public static class TOC { public static CDTOC? Decode(byte[] CDTOCResponse) { - if(CDTOCResponse == null || - CDTOCResponse.Length <= 4) + if(CDTOCResponse is not { Length: > 4 }) return null; var decoded = new CDTOC diff --git a/Floppy/Apple2.cs b/Floppy/Apple2.cs index f668021..745d9f4 100644 --- a/Floppy/Apple2.cs +++ b/Floppy/Apple2.cs @@ -151,8 +151,7 @@ public static class Apple2 /// 5and3 encoded data. public static byte[] Decode5and3(byte[] data) { - if(data == null || - data.Length != 410) + if(data is not { Length: 410 }) return null; var buffer = new byte[data.Length]; @@ -189,8 +188,7 @@ public static class Apple2 /// 6and2 encoded data. public static byte[] Decode6and2(byte[] data) { - if(data == null || - data.Length != 342) + if(data is not { Length: 342 }) return null; var buffer = new byte[data.Length]; diff --git a/LisaTag.cs b/LisaTag.cs index 7f8c049..54ce2e1 100644 --- a/LisaTag.cs +++ b/LisaTag.cs @@ -47,8 +47,7 @@ public static class LisaTag /// Decoded tag in Sony's format public static SonyTag? DecodeSonyTag(byte[] tag) { - if(tag == null || - tag.Length != 12) + if(tag is not { Length: 12 }) return null; var snTag = new SonyTag @@ -74,8 +73,7 @@ public static class LisaTag /// Decoded tag in Profile's format public static ProfileTag? DecodeProfileTag(byte[] tag) { - if(tag == null || - tag.Length != 20) + if(tag is not { Length: 20 }) return null; var phTag = new ProfileTag(); @@ -122,8 +120,7 @@ public static class LisaTag /// Decoded tag in Priam's format public static PriamTag? DecodePriamTag(byte[] tag) { - if(tag == null || - tag.Length != 24) + if(tag is not { Length: 24 }) return null; var pmTag = new PriamTag();