mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] Use static lambdas in LINQ queries for improved performance
This commit is contained in:
@@ -40,10 +40,10 @@ public static partial class ArrayHelpers
|
||||
/// <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?.All(b => b is 0x00 or 0x20) != false;
|
||||
public static bool ArrayIsNullOrWhiteSpace(byte[] array) => array?.All(static b => b is 0x00 or 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?.All(b => b == 0x00) != false;
|
||||
public static bool ArrayIsNullOrEmpty(byte[] array) => array?.All(static b => b == 0x00) != false;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace Aaru.Helpers;
|
||||
/// </summary>
|
||||
public sealed class DirColorsParser
|
||||
{
|
||||
private static readonly Lazy<DirColorsParser> _instance = new(() => new DirColorsParser());
|
||||
private static readonly Lazy<DirColorsParser> _instance = new(static () => new DirColorsParser());
|
||||
|
||||
private DirColorsParser()
|
||||
{
|
||||
@@ -83,13 +83,13 @@ public sealed class DirColorsParser
|
||||
sgr = parts[1];
|
||||
}
|
||||
|
||||
if(!pattern.StartsWith("DIR", StringComparison.OrdinalIgnoreCase) &&
|
||||
pattern is not ['.', ..] &&
|
||||
if(!pattern.StartsWith("DIR", StringComparison.OrdinalIgnoreCase) &&
|
||||
pattern is not ['.', ..] &&
|
||||
!pattern.StartsWith("NORM", StringComparison.OrdinalIgnoreCase))
|
||||
continue; // ( DIR, FILE, LINK, EXECUTABLE, or SUID)
|
||||
|
||||
// Build ANSI escape sequence
|
||||
string ansi = $"\e[{sgr}m";
|
||||
var ansi = $"\e[{sgr}m";
|
||||
string hex;
|
||||
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user