mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] General reformat and clean-up.
This commit is contained in:
@@ -63,10 +63,7 @@ public static partial class AnsiColorParser
|
||||
if(!m.Success) throw new ArgumentException("No ANSI SGR sequence found.", nameof(input));
|
||||
|
||||
int[] parts = m.Groups["params"]
|
||||
.Value.Split([
|
||||
';'
|
||||
],
|
||||
StringSplitOptions.RemoveEmptyEntries)
|
||||
.Value.Split([';'], StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(int.Parse)
|
||||
.ToArray();
|
||||
|
||||
@@ -132,10 +129,7 @@ public static partial class AnsiColorParser
|
||||
int ci = index - 16;
|
||||
int r = ci / 36, g = ci / 6 % 6, b = ci % 6;
|
||||
|
||||
int[] levels =
|
||||
[
|
||||
0, 95, 135, 175, 215, 255
|
||||
];
|
||||
int[] levels = [0, 95, 135, 175, 215, 255];
|
||||
|
||||
return Color.FromArgb(levels[r], levels[g], levels[b]);
|
||||
}
|
||||
|
||||
@@ -82,17 +82,17 @@ public static class PrintHex
|
||||
sb.Append(str);
|
||||
sb.Append(" ");
|
||||
|
||||
for(int i = 0; i < width; i++) sb.Append($" {i:X2}");
|
||||
for(var i = 0; i < width; i++) sb.Append($" {i:X2}");
|
||||
|
||||
if(color) sb.Append("\e[0m");
|
||||
|
||||
sb.AppendLine();
|
||||
|
||||
int b = 0;
|
||||
var b = 0;
|
||||
|
||||
string format = $"{{0:X{offsetLength}}}";
|
||||
var format = $"{{0:X{offsetLength}}}";
|
||||
|
||||
for(int i = 0; i < rows; i++)
|
||||
for(var i = 0; i < rows; i++)
|
||||
{
|
||||
if(color) sb.Append("\e[36m");
|
||||
|
||||
@@ -104,18 +104,18 @@ public static class PrintHex
|
||||
int lastBytes = i == rows - 1 ? last : width;
|
||||
int lastSpaces = width - lastBytes;
|
||||
|
||||
for(int j = 0; j < lastBytes; j++)
|
||||
for(var j = 0; j < lastBytes; j++)
|
||||
{
|
||||
sb.Append($" {array[b]:X2}");
|
||||
b++;
|
||||
}
|
||||
|
||||
for(int j = 0; j < lastSpaces; j++) sb.Append(" ");
|
||||
for(var j = 0; j < lastSpaces; j++) sb.Append(" ");
|
||||
|
||||
b -= lastBytes;
|
||||
sb.Append(" ");
|
||||
|
||||
for(int j = 0; j < lastBytes; j++)
|
||||
for(var j = 0; j < lastBytes; j++)
|
||||
{
|
||||
int v = array[b];
|
||||
sb.Append(v is > 31 and < 127 or > 159 ? (char)v : '.');
|
||||
|
||||
Reference in New Issue
Block a user