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
This commit is contained in:
JustArchi
2020-05-21 23:42:32 +02:00
parent 1c18fab68e
commit 8db90b6c2f
2 changed files with 2 additions and 2 deletions

View File

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

View File

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