From 8db90b6c2f04e46b68a5d7bf2e6417ea80fb44cd Mon Sep 17 00:00:00 2001 From: JustArchi Date: Thu, 21 May 2020 23:42:32 +0200 Subject: [PATCH] Use hexadecimal strings for OS-wide resources base64 slash character can cause problems with filepaths, besides, it's best to use ASCII only there due to various OS limitations --- ArchiSteamFarm/ASF.cs | 2 +- ArchiSteamFarm/OS.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ArchiSteamFarm/ASF.cs b/ArchiSteamFarm/ASF.cs index 58175a9a3..c55532ba4 100644 --- a/ArchiSteamFarm/ASF.cs +++ b/ArchiSteamFarm/ASF.cs @@ -142,7 +142,7 @@ namespace ArchiSteamFarm { GlobalConfig = globalConfig; - string webProxyText = !string.IsNullOrEmpty(globalConfig.WebProxyText) ? "-" + Convert.ToBase64String(Encoding.UTF8.GetBytes(globalConfig.WebProxyText)) : ""; + string webProxyText = !string.IsNullOrEmpty(globalConfig.WebProxyText) ? "-" + BitConverter.ToString(Encoding.UTF8.GetBytes(globalConfig.WebProxyText)).Replace("-", "") : ""; ConfirmationsSemaphore ??= OS.CreateCrossProcessSemaphore(nameof(ConfirmationsSemaphore) + webProxyText); GiftsSemaphore ??= OS.CreateCrossProcessSemaphore(nameof(GiftsSemaphore) + webProxyText); diff --git a/ArchiSteamFarm/OS.cs b/ArchiSteamFarm/OS.cs index fb0d53308..4429a491a 100644 --- a/ArchiSteamFarm/OS.cs +++ b/ArchiSteamFarm/OS.cs @@ -114,7 +114,7 @@ namespace ArchiSteamFarm { return false; } - string uniqueName = "Global\\" + GetOsResourceName(nameof(SingleInstance)) + "-" + Convert.ToBase64String(Encoding.UTF8.GetBytes(Directory.GetCurrentDirectory())); + string uniqueName = "Global\\" + GetOsResourceName(nameof(SingleInstance)) + "-" + BitConverter.ToString(Encoding.UTF8.GetBytes(Directory.GetCurrentDirectory())).Replace("-", ""); Mutex singleInstance = new Mutex(true, uniqueName, out bool result);