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:
15
SCSI/EVPD.cs
15
SCSI/EVPD.cs
@@ -2214,24 +2214,19 @@ public static class EVPD
|
||||
break;
|
||||
}
|
||||
|
||||
if(page.Component != null &&
|
||||
page.Component.Length > 0)
|
||||
if(page.Component is { Length: > 0 })
|
||||
sb.AppendFormat("\tComponent: {0}", StringHandlers.CToString(page.Component)).AppendLine();
|
||||
|
||||
if(page.Version != null &&
|
||||
page.Version.Length > 0)
|
||||
if(page.Version is { Length: > 0 })
|
||||
sb.AppendFormat("\tVersion: {0}", StringHandlers.CToString(page.Version)).AppendLine();
|
||||
|
||||
if(page.Date != null &&
|
||||
page.Date.Length > 0)
|
||||
if(page.Date is { Length: > 0 })
|
||||
sb.AppendFormat("\tDate: {0}", StringHandlers.CToString(page.Date)).AppendLine();
|
||||
|
||||
if(page.Variant != null &&
|
||||
page.Variant.Length > 0)
|
||||
if(page.Variant is { Length: > 0 })
|
||||
sb.AppendFormat("\tVariant: {0}", StringHandlers.CToString(page.Variant)).AppendLine();
|
||||
|
||||
if(page.Copyright != null &&
|
||||
page.Copyright.Length > 0)
|
||||
if(page.Copyright is { Length: > 0 })
|
||||
sb.AppendFormat("\tCopyright: {0}", StringHandlers.CToString(page.Copyright)).AppendLine();
|
||||
|
||||
return sb.ToString();
|
||||
|
||||
@@ -44,10 +44,7 @@ public static class DensitySupport
|
||||
{
|
||||
public static DensitySupportHeader? DecodeDensity(byte[] response)
|
||||
{
|
||||
if(response == null)
|
||||
return null;
|
||||
|
||||
if(response.Length <= 56)
|
||||
if(response is not { Length: > 56 })
|
||||
return null;
|
||||
|
||||
var responseLen = (ushort)((response[0] << 8) + response[1] + 2);
|
||||
@@ -147,10 +144,7 @@ public static class DensitySupport
|
||||
|
||||
public static MediaTypeSupportHeader? DecodeMediumType(byte[] response)
|
||||
{
|
||||
if(response == null)
|
||||
return null;
|
||||
|
||||
if(response.Length <= 60)
|
||||
if(response is not { Length: > 60 })
|
||||
return null;
|
||||
|
||||
var responseLen = (ushort)((response[0] << 8) + response[1] + 2);
|
||||
|
||||
Reference in New Issue
Block a user