mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Code style fixes.
This commit is contained in:
@@ -39,12 +39,11 @@ namespace Aaru.Helpers
|
||||
/// <summary>Checks if an array is null, filled with the NULL byte (0x00) or ASCII whitespace (0x20)</summary>
|
||||
/// <param name="array">Array</param>
|
||||
/// <returns>True if null or whitespace</returns>
|
||||
public static bool ArrayIsNullOrWhiteSpace(byte[] array) =>
|
||||
array == null || array.All(b => b == 0x00 || b == 0x20);
|
||||
public static bool ArrayIsNullOrWhiteSpace(byte[] array) => array?.All(b => b == 0x00 || b == 0x20) != false;
|
||||
|
||||
/// <summary>Checks if an array is null or filled with the NULL byte (0x00)</summary>
|
||||
/// <param name="array">Array</param>
|
||||
/// <returns>True if null</returns>
|
||||
public static bool ArrayIsNullOrEmpty(byte[] array) => array == null || array.All(b => b == 0x00);
|
||||
public static bool ArrayIsNullOrEmpty(byte[] array) => array?.All(b => b == 0x00) != false;
|
||||
}
|
||||
}
|
||||
@@ -39,8 +39,8 @@ namespace Aaru.Helpers
|
||||
/// <returns>Bits set to <c>true</c></returns>
|
||||
public static int Count(uint number)
|
||||
{
|
||||
number = number - ((number >> 1) & 0x55555555);
|
||||
number = (number & 0x33333333) + ((number >> 2) & 0x33333333);
|
||||
number -= (number >> 1) & 0x55555555;
|
||||
number = (number & 0x33333333) + ((number >> 2) & 0x33333333);
|
||||
|
||||
return (int)((((number + (number >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24);
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ namespace Aaru.Helpers
|
||||
AddTicks(ticks).DateTime;
|
||||
}
|
||||
|
||||
/// <summary>Convers a Solaris high resolution timestamp to .NET DateTime</summary>
|
||||
/// <summary>Converts a Solaris high resolution timestamp to .NET DateTime</summary>
|
||||
/// <param name="hrTimeStamp">Solaris high resolution timestamp</param>
|
||||
/// <returns>.NET DateTime</returns>
|
||||
public static DateTime UnixHrTimeToDateTime(ulong hrTimeStamp) =>
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Aaru.Helpers
|
||||
{
|
||||
/// <summary>Defines properties to help marshalling structs from binary data</summary>
|
||||
[AttributeUsage(AttributeTargets.Struct)]
|
||||
public class MarshallingPropertiesAttribute : Attribute
|
||||
public sealed class MarshallingPropertiesAttribute : Attribute
|
||||
{
|
||||
/// <summary>Defines properties to help marshalling structs from binary data</summary>
|
||||
/// <param name="endian">Defines properties to help marshalling structs from binary data</param>
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Aaru.Helpers
|
||||
/// <param name="cString">A null-terminated (aka C string) byte array in the specified encoding</param>
|
||||
/// <param name="encoding">Encoding.</param>
|
||||
/// <param name="twoBytes">Set if encoding uses 16-bit characters.</param>
|
||||
/// <param name="start">Start decodint at this position</param>
|
||||
/// <param name="start">Start decoding at this position</param>
|
||||
public static string CToString(byte[] cString, Encoding encoding, bool twoBytes = false, int start = 0)
|
||||
{
|
||||
if(cString == null)
|
||||
@@ -92,7 +92,7 @@ namespace Aaru.Helpers
|
||||
/// <returns>The corresponding C# string</returns>
|
||||
/// <param name="pascalString">A length-prefixed (aka Pascal string) ASCII byte array</param>
|
||||
/// <param name="encoding">Encoding.</param>
|
||||
/// <param name="start">Start decodint at this position</param>
|
||||
/// <param name="start">Start decoding at this position</param>
|
||||
public static string PascalToString(byte[] pascalString, Encoding encoding, int start = 0)
|
||||
{
|
||||
if(pascalString == null)
|
||||
@@ -125,7 +125,7 @@ namespace Aaru.Helpers
|
||||
/// <returns>The corresponding C# string</returns>
|
||||
/// <param name="spacePaddedString">A space (' ', 0x20, ASCII SPACE) padded ASCII byte array</param>
|
||||
/// <param name="encoding">Encoding.</param>
|
||||
/// <param name="start">Start decodint at this position</param>
|
||||
/// <param name="start">Start decoding at this position</param>
|
||||
public static string SpacePaddedToString(byte[] spacePaddedString, Encoding encoding, int start = 0)
|
||||
{
|
||||
if(spacePaddedString == null)
|
||||
|
||||
Reference in New Issue
Block a user