mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-06-06 09:31:16 -04:00
ToHex()
should be uppercase by default
This commit is contained in:
parent
c9447c5c8f
commit
b224fca6c0
1 changed files with 6 additions and 2 deletions
|
@ -4,12 +4,16 @@ namespace DiscordChatExporter.Core.Utils.Extensions;
|
||||||
|
|
||||||
public static class BinaryExtensions
|
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);
|
var buffer = new StringBuilder(2 * data.Length);
|
||||||
|
|
||||||
foreach (var b in data)
|
foreach (var b in data)
|
||||||
buffer.Append(b.ToString("x2"));
|
{
|
||||||
|
buffer.Append(
|
||||||
|
b.ToString(isUpperCase ? "X2" : "x2")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return buffer.ToString();
|
return buffer.ToString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue