|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|