diff --git a/DateHandlers.cs b/DateHandlers.cs index 9925a16b9..af21162d6 100644 --- a/DateHandlers.cs +++ b/DateHandlers.cs @@ -299,11 +299,15 @@ public static class DateHandlers else offset = (short)(preOffset & 0x7FF); - if(offset == -2047) - return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Unspecified).AddTicks(ticks); + switch(offset) + { + case -2047: + return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Unspecified).AddTicks(ticks); + case < -1440 or > 1440: + offset = 0; - if(offset is < -1440 or > 1440) - offset = 0; + break; + } return new DateTimeOffset(year, month, day, hour, minute, second, new TimeSpan(0, offset, 0)).AddTicks(ticks). DateTime; diff --git a/PrintHex.cs b/PrintHex.cs index 999be0225..0d193e95a 100644 --- a/PrintHex.cs +++ b/PrintHex.cs @@ -62,11 +62,17 @@ public static class PrintHex int offsetLength = $"{array.Length:X}".Length; var sb = new StringBuilder(); - if(last > 0) - rows++; + switch(last) + { + case > 0: + rows++; - if(last == 0) - last = width; + break; + case 0: + last = width; + + break; + } if(offsetLength < str.Length) offsetLength = str.Length;