From e505e91931a04c82d3f84c355b1776f11aa3bd9b Mon Sep 17 00:00:00 2001 From: RMBGAME Date: Fri, 22 Nov 2024 00:57:29 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20#3519=20#3530=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=88=98=E7=BD=91=E8=B4=A6=E5=8F=B7=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=9B=BD=E6=9C=8D=E5=9B=BD=E9=99=85=E6=9C=8D?= =?UTF-8?q?=E5=88=87=E6=8D=A2(=E5=BB=BA=E8=AE=AE=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E4=B8=80=E6=AC=A1=E8=B4=A6=E5=8F=B7)=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BD=E6=9C=8D=E5=9B=BD=E9=99=85=E6=9C=8D?= =?UTF-8?q?=E6=88=98=E7=BD=91=E9=82=AE=E7=AE=B1=E7=9B=B8=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=90=8C=E6=97=B6=E4=BF=9D=E5=AD=98=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E9=97=AE=E9=A2=98=20=E4=BF=AE=E5=A4=8D=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E8=B4=A6=E5=8F=B7=E5=88=87=E6=8D=A2=E7=9A=84?= =?UTF-8?q?=E7=82=B8=E5=BC=B9=EF=BC=8C=E5=8F=AF=E8=83=BD=E4=BC=9A=E8=AE=A9?= =?UTF-8?q?GOG=E5=88=87=E6=8D=A2=E5=8F=98=E5=A5=BD=EF=BC=88=E6=9C=AA?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BasicPlatformSwitcher.cs | 41 +++---------------- .../UI/Assets/Platforms.json | 10 +++-- 2 files changed, 13 insertions(+), 38 deletions(-) diff --git a/src/BD.WTTS.Client.Plugins.GameAccount/Services.Implementation/BasicPlatformSwitcher.cs b/src/BD.WTTS.Client.Plugins.GameAccount/Services.Implementation/BasicPlatformSwitcher.cs index 83fbf41aeb0..1090b0e1290 100644 --- a/src/BD.WTTS.Client.Plugins.GameAccount/Services.Implementation/BasicPlatformSwitcher.cs +++ b/src/BD.WTTS.Client.Plugins.GameAccount/Services.Implementation/BasicPlatformSwitcher.cs @@ -63,17 +63,10 @@ async ValueTask BasicCopyInAccount(string accId, PlatformAccount platform) var regValue = regJson[accFile] ?? ""; - if (DesktopBridge.IsRunningAsUwp) + if (!Registry2.SetRegistryKey(accFile[4..], regValue)) // Remove "REG:" and read data { - await SetEpicCurrentUserAsync(regValue); - } - else - { - if (!Registry2.SetRegistryKey(accFile[4..], regValue)) // Remove "REG:" and read data - { - Toast.Show(ToastIcon.Error, AppResources.Error_WriteRegistryFailed); - return false; - } + Toast.Show(ToastIcon.Error, AppResources.Error_WriteRegistryFailed); + return false; } continue; } @@ -90,7 +83,7 @@ async ValueTask BasicCopyInAccount(string accId, PlatformAccount platform) if (!JTokenHelper.ReplaceVarInJsonFile(path, selector, jToken)) { Toast.Show(ToastIcon.Error, AppResources.Error_ModifyJsonFileFailed); - return false; + //return false; } continue; } @@ -143,7 +136,7 @@ public async ValueTask SwapToAccount(IAccount? account, PlatformAccount pl } //if (BasicSettings.AutoStart) - RunPlatformProcess(platform, true); + RunPlatformProcess(platform, false); //if (accName != "" && BasicSettings.AutoStart && AppSettings.MinimizeOnSwitch) _ = AppData.InvokeVoidAsync("hideWindow"); @@ -197,21 +190,6 @@ async ValueTask ClearCurrentLoginUserCore(PlatformAccount platform) return true; } - async ValueTask SetEpicCurrentUserAsync(string userName) - { -#if WINDOWS - string contents = -$""" -Windows Registry Editor Version 5.00 -; {AssemblyInfo.Trademark} BD.WTTS.Services.Implementation.BasicPlatformSwitcher.SetEpicCurrentUserAsync -[HKEY_CURRENT_USER\Software\Epic Games\Unreal Engine\Identifiers] -"AccountId"="{userName}" -"""; - var regpath = IOPath.GetCacheFilePath(WindowsPlatformServiceImpl.CacheTempDirName, "SwitchEpicUser", FileEx.Reg); - await WindowsPlatformServiceImpl.StartProcessRegeditAsync(regpath, contents); -#endif - } - async ValueTask DeleteFileOrFolder(string accFile, PlatformAccount platform) { // The "file" is a registry key @@ -225,14 +203,7 @@ async ValueTask DeleteFileOrFolder(string accFile, PlatformAccount platfor } else { - if (DesktopBridge.IsRunningAsUwp) - { - await SetEpicCurrentUserAsync(string.Empty); - return true; - } - else - if (Registry2.SetRegistryKey(accFile[4..])) return true; - + if (Registry2.SetRegistryKey(accFile[4..])) return true; } Toast.Show(ToastIcon.Error, AppResources.Error_WriteRegistryFailed); return false; diff --git a/src/BD.WTTS.Client.Plugins.GameAccount/UI/Assets/Platforms.json b/src/BD.WTTS.Client.Plugins.GameAccount/UI/Assets/Platforms.json index ea939fb48a3..1bb43935eef 100644 --- a/src/BD.WTTS.Client.Plugins.GameAccount/UI/Assets/Platforms.json +++ b/src/BD.WTTS.Client.Plugins.GameAccount/UI/Assets/Platforms.json @@ -150,11 +150,15 @@ "ExesToEnd": [ "Battle.net" ], "ClearPaths": [ "SAME_AS_LOGIN_FILES" ], "LoginFiles": { - "JSON_SELECT_FIRST,::%AppData%\\Battle.net\\Battle.net.config::$.Client.SavedAccountNames": "email.json" + "JSON_SELECT_FIRST,::%AppData%\\Battle.net\\Battle.net.config::$.Client.SavedAccountNames": "email.json", + "JSON_SELECT_FIRST,::%AppData%\\Battle.net\\Battle.net.config::$..Services.LastLoginRegion": "LastLoginRegion", + "JSON_SELECT_FIRST,::%AppData%\\Battle.net\\Battle.net.config::$..Services.LastLoginAddress": "LastLoginAddress", + "JSON_SELECT_FIRST,::%AppData%\\Battle.net\\Battle.net.config::$..Services.LastLoginTassadar": "LastLoginTassadar", + "%AppData%\\Battle.net\\WattToolkit.id": "WattToolkit.id" }, "IsExitBeforeInteract": true, - "UniqueIdPath": "%AppData%\\Battle.net\\Battle.net.config::$.Client.SavedAccountNames", - "UniqueIdType": 5, + "UniqueIdPath": "%AppData%\\Battle.net\\WattToolkit.id", + "UniqueIdType": 1, "AllFilesRequired": true }, {