ToHex() should be uppercase by default

This commit is contained in:
Tyrrrz 2023-07-30 14:54:15 +03:00
parent c9447c5c8f
commit b224fca6c0

View file

@ -4,12 +4,16 @@ namespace DiscordChatExporter.Core.Utils.Extensions;
public static class BinaryExtensions
{
public static string ToHex(this byte[] data)
public static string ToHex(this byte[] data, bool isUpperCase = true)
{
var buffer = new StringBuilder(2 * data.Length);
foreach (var b in data)
buffer.Append(b.ToString("x2"));
{
buffer.Append(
b.ToString(isUpperCase ? "X2" : "x2")
);
}
return buffer.ToString();
}