From 99fc4fa61b0eb4c02eacdf7428ae14721349dece Mon Sep 17 00:00:00 2001
From: Berkan Diler <b.diler@gmx.de>
Date: Wed, 8 Feb 2023 14:54:58 +0100
Subject: Replace BitConverter.ToString(bytes).Replace("-", "") with
 Convert.ToHexString(bytes) (#4382)

---
 Ryujinx.HLE/FileSystem/ContentManager.cs                            | 2 +-
 Ryujinx.HLE/HOS/ModLoader.cs                                        | 4 ++--
 .../HOS/Services/Account/Acc/AccountService/ManagerServer.cs        | 6 +++---
 Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs                     | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Ryujinx.HLE/FileSystem/ContentManager.cs b/Ryujinx.HLE/FileSystem/ContentManager.cs
index 9ae619ad..9f0f3a4a 100644
--- a/Ryujinx.HLE/FileSystem/ContentManager.cs
+++ b/Ryujinx.HLE/FileSystem/ContentManager.cs
@@ -229,7 +229,7 @@ namespace Ryujinx.HLE.FileSystem
                     continue;
                 }
 
-                string ncaId = BitConverter.ToString(cnmt.ContentEntries[0].NcaId).Replace("-", "").ToLower();
+                string ncaId = Convert.ToHexString(cnmt.ContentEntries[0].NcaId).ToLower();
 
                 AddAocItem(cnmt.TitleId, containerPath, $"{ncaId}.nca", true);
             }
diff --git a/Ryujinx.HLE/HOS/ModLoader.cs b/Ryujinx.HLE/HOS/ModLoader.cs
index 3b269517..b6c9973f 100644
--- a/Ryujinx.HLE/HOS/ModLoader.cs
+++ b/Ryujinx.HLE/HOS/ModLoader.cs
@@ -696,8 +696,8 @@ namespace Ryujinx.HLE.HOS
 
             var buildIds = programs.Select(p => p switch
             {
-                NsoExecutable nso => BitConverter.ToString(nso.BuildId.ItemsRo.ToArray()).Replace("-", "").TrimEnd('0'),
-                NroExecutable nro => BitConverter.ToString(nro.Header.BuildId).Replace("-", "").TrimEnd('0'),
+                NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()).TrimEnd('0'),
+                NroExecutable nro => Convert.ToHexString(nro.Header.BuildId).TrimEnd('0'),
                 _ => string.Empty
             }).ToList();
 
diff --git a/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs b/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs
index 011accd2..97240311 100644
--- a/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs
+++ b/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs
@@ -51,11 +51,11 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
 
             var payload = new JwtPayload
             {
-                { "sub", BitConverter.ToString(rawUserId).Replace("-", "").ToLower() },
+                { "sub", Convert.ToHexString(rawUserId).ToLower() },
                 { "aud", "ed9e2f05d286f7b8" },
-                { "di", BitConverter.ToString(deviceId).Replace("-", "").ToLower() },
+                { "di", Convert.ToHexString(deviceId).ToLower() },
                 { "sn", "XAW10000000000" },
-                { "bs:did", BitConverter.ToString(deviceAccountId).Replace("-", "").ToLower() },
+                { "bs:did", Convert.ToHexString(deviceAccountId).ToLower() },
                 { "iss", "https://e0d67c509fb203858ebcb2fe3f88c2aa.baas.nintendo.com" },
                 { "typ", "id_token" },
                 { "iat", DateTimeOffset.UtcNow.ToUnixTimeSeconds() },
diff --git a/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs b/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs
index 522de8e0..6320fe28 100644
--- a/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs
+++ b/Ryujinx.HLE/HOS/Services/Caps/CaptureManager.cs
@@ -101,7 +101,7 @@ namespace Ryujinx.HLE.HOS.Services.Caps
                 };
 
                 // NOTE: The hex hash is a HMAC-SHA256 (first 32 bytes) using a hardcoded secret key over the titleId, we can simulate it by hashing the titleId instead.
-                string hash       = BitConverter.ToString(SHA256.HashData(BitConverter.GetBytes(titleId))).Replace("-", "").Remove(0x20);
+                string hash       = Convert.ToHexString(SHA256.HashData(BitConverter.GetBytes(titleId))).Remove(0x20);
                 string folderPath = Path.Combine(_sdCardPath, "Nintendo", "Album", currentDateTime.Year.ToString("00"), currentDateTime.Month.ToString("00"), currentDateTime.Day.ToString("00"));
                 string filePath   = GenerateFilePath(folderPath, applicationAlbumEntry, currentDateTime, hash);
 
-- 
cgit v1.2.3-70-g09d2