mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
More pattern matching.
This commit is contained in:
@@ -57,8 +57,7 @@ public static class ATIP
|
|||||||
{
|
{
|
||||||
public static CDATIP Decode(byte[] CDATIPResponse)
|
public static CDATIP Decode(byte[] CDATIPResponse)
|
||||||
{
|
{
|
||||||
if(CDATIPResponse == null ||
|
if(CDATIPResponse is not { Length: > 4 })
|
||||||
CDATIPResponse.Length <= 4)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var decoded = new CDATIP();
|
var decoded = new CDATIP();
|
||||||
|
|||||||
@@ -93,8 +93,7 @@ public static class CDTextOnLeadIn
|
|||||||
|
|
||||||
public static CDText? Decode(byte[] CDTextResponse)
|
public static CDText? Decode(byte[] CDTextResponse)
|
||||||
{
|
{
|
||||||
if(CDTextResponse == null ||
|
if(CDTextResponse is not { Length: > 4 })
|
||||||
CDTextResponse.Length <= 4)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var decoded = new CDText
|
var decoded = new CDText
|
||||||
|
|||||||
@@ -69,8 +69,7 @@ public static class FullTOC
|
|||||||
|
|
||||||
public static CDFullTOC? Decode(byte[] CDFullTOCResponse)
|
public static CDFullTOC? Decode(byte[] CDFullTOCResponse)
|
||||||
{
|
{
|
||||||
if(CDFullTOCResponse == null ||
|
if(CDFullTOCResponse is not { Length: > 4 })
|
||||||
CDFullTOCResponse.Length <= 4)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var decoded = new CDFullTOC
|
var decoded = new CDFullTOC
|
||||||
|
|||||||
@@ -56,8 +56,7 @@ public static class PMA
|
|||||||
{
|
{
|
||||||
public static CDPMA? Decode(byte[] CDPMAResponse)
|
public static CDPMA? Decode(byte[] CDPMAResponse)
|
||||||
{
|
{
|
||||||
if(CDPMAResponse == null ||
|
if(CDPMAResponse is not { Length: > 4 })
|
||||||
CDPMAResponse.Length <= 4)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var decoded = new CDPMA
|
var decoded = new CDPMA
|
||||||
|
|||||||
@@ -55,8 +55,7 @@ public static class Session
|
|||||||
{
|
{
|
||||||
public static CDSessionInfo? Decode(byte[] CDSessionInfoResponse)
|
public static CDSessionInfo? Decode(byte[] CDSessionInfoResponse)
|
||||||
{
|
{
|
||||||
if(CDSessionInfoResponse == null ||
|
if(CDSessionInfoResponse is not { Length: > 4 })
|
||||||
CDSessionInfoResponse.Length <= 4)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var decoded = new CDSessionInfo
|
var decoded = new CDSessionInfo
|
||||||
|
|||||||
@@ -58,8 +58,7 @@ public static class TOC
|
|||||||
{
|
{
|
||||||
public static CDTOC? Decode(byte[] CDTOCResponse)
|
public static CDTOC? Decode(byte[] CDTOCResponse)
|
||||||
{
|
{
|
||||||
if(CDTOCResponse == null ||
|
if(CDTOCResponse is not { Length: > 4 })
|
||||||
CDTOCResponse.Length <= 4)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var decoded = new CDTOC
|
var decoded = new CDTOC
|
||||||
|
|||||||
@@ -151,8 +151,7 @@ public static class Apple2
|
|||||||
/// <param name="data">5and3 encoded data.</param>
|
/// <param name="data">5and3 encoded data.</param>
|
||||||
public static byte[] Decode5and3(byte[] data)
|
public static byte[] Decode5and3(byte[] data)
|
||||||
{
|
{
|
||||||
if(data == null ||
|
if(data is not { Length: 410 })
|
||||||
data.Length != 410)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var buffer = new byte[data.Length];
|
var buffer = new byte[data.Length];
|
||||||
@@ -189,8 +188,7 @@ public static class Apple2
|
|||||||
/// <param name="data">6and2 encoded data.</param>
|
/// <param name="data">6and2 encoded data.</param>
|
||||||
public static byte[] Decode6and2(byte[] data)
|
public static byte[] Decode6and2(byte[] data)
|
||||||
{
|
{
|
||||||
if(data == null ||
|
if(data is not { Length: 342 })
|
||||||
data.Length != 342)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var buffer = new byte[data.Length];
|
var buffer = new byte[data.Length];
|
||||||
|
|||||||
@@ -47,8 +47,7 @@ public static class LisaTag
|
|||||||
/// <returns>Decoded tag in Sony's format</returns>
|
/// <returns>Decoded tag in Sony's format</returns>
|
||||||
public static SonyTag? DecodeSonyTag(byte[] tag)
|
public static SonyTag? DecodeSonyTag(byte[] tag)
|
||||||
{
|
{
|
||||||
if(tag == null ||
|
if(tag is not { Length: 12 })
|
||||||
tag.Length != 12)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var snTag = new SonyTag
|
var snTag = new SonyTag
|
||||||
@@ -74,8 +73,7 @@ public static class LisaTag
|
|||||||
/// <returns>Decoded tag in Profile's format</returns>
|
/// <returns>Decoded tag in Profile's format</returns>
|
||||||
public static ProfileTag? DecodeProfileTag(byte[] tag)
|
public static ProfileTag? DecodeProfileTag(byte[] tag)
|
||||||
{
|
{
|
||||||
if(tag == null ||
|
if(tag is not { Length: 20 })
|
||||||
tag.Length != 20)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var phTag = new ProfileTag();
|
var phTag = new ProfileTag();
|
||||||
@@ -122,8 +120,7 @@ public static class LisaTag
|
|||||||
/// <returns>Decoded tag in Priam's format</returns>
|
/// <returns>Decoded tag in Priam's format</returns>
|
||||||
public static PriamTag? DecodePriamTag(byte[] tag)
|
public static PriamTag? DecodePriamTag(byte[] tag)
|
||||||
{
|
{
|
||||||
if(tag == null ||
|
if(tag is not { Length: 24 })
|
||||||
tag.Length != 24)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var pmTag = new PriamTag();
|
var pmTag = new PriamTag();
|
||||||
|
|||||||
Reference in New Issue
Block a user