mirror of
https://github.com/aaru-dps/Aaru.Helpers.git
synced 2025-12-16 19:24:35 +00:00
Use merge pattern.
This commit is contained in:
@@ -40,7 +40,7 @@ public static partial class ArrayHelpers
|
|||||||
/// <summary>Checks if an array is null, filled with the NULL byte (0x00) or ASCII whitespace (0x20)</summary>
|
/// <summary>Checks if an array is null, filled with the NULL byte (0x00) or ASCII whitespace (0x20)</summary>
|
||||||
/// <param name="array">Array</param>
|
/// <param name="array">Array</param>
|
||||||
/// <returns>True if null or whitespace</returns>
|
/// <returns>True if null or whitespace</returns>
|
||||||
public static bool ArrayIsNullOrWhiteSpace(byte[] array) => array?.All(b => b == 0x00 || b == 0x20) != false;
|
public static bool ArrayIsNullOrWhiteSpace(byte[] array) => array?.All(b => b is 0x00 or 0x20) != false;
|
||||||
|
|
||||||
/// <summary>Checks if an array is null or filled with the NULL byte (0x00)</summary>
|
/// <summary>Checks if an array is null or filled with the NULL byte (0x00)</summary>
|
||||||
/// <param name="array">Array</param>
|
/// <param name="array">Array</param>
|
||||||
|
|||||||
@@ -302,8 +302,7 @@ public static class DateHandlers
|
|||||||
if(offset == -2047)
|
if(offset == -2047)
|
||||||
return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Unspecified).AddTicks(ticks);
|
return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Unspecified).AddTicks(ticks);
|
||||||
|
|
||||||
if(offset < -1440 ||
|
if(offset is < -1440 or > 1440)
|
||||||
offset > 1440)
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
return new DateTimeOffset(year, month, day, hour, minute, second, new TimeSpan(0, offset, 0)).AddTicks(ticks).
|
return new DateTimeOffset(year, month, day, hour, minute, second, new TimeSpan(0, offset, 0)).AddTicks(ticks).
|
||||||
|
|||||||
@@ -439,8 +439,7 @@ public static class Marshal
|
|||||||
{
|
{
|
||||||
outBuf = null;
|
outBuf = null;
|
||||||
|
|
||||||
if(hex is null ||
|
if(hex is null or "")
|
||||||
hex == "")
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
var off = 0;
|
var off = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user