From a00ee14fe1ae4fad10dafc3bc8d5f1aa79a98e44 Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Tue, 8 Oct 2024 18:40:42 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E9=9B=B7=E7=94=B5=E6=88=AA=E5=9B=BE?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E6=94=AF=E6=8C=81=E8=87=AA=E5=8A=A8=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E6=A8=A1=E6=8B=9F=E5=99=A8=E5=AE=89=E8=A3=85=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MAA.sln.DotSettings | 1 + .../ViewModels/UI/SettingsViewModel.cs | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/MAA.sln.DotSettings b/MAA.sln.DotSettings index 10229301c4..de1dfb6710 100644 --- a/MAA.sln.DotSettings +++ b/MAA.sln.DotSettings @@ -69,6 +69,7 @@ True True True + True True True True diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index 5f60593e1c..c076f37012 100644 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -4320,6 +4320,38 @@ namespace MaaWpfGui.ViewModels.UI if (value) { MessageBoxHelper.Show(LocalizationHelper.GetString("LdExtrasEnabledTip")); + + // 读取 LD 注册表地址 并填充GUI + if (string.IsNullOrEmpty(EmulatorPath)) + { + try + { + const string UninstallKeyPath = @"Software\leidian\ldplayer9"; + const string InstallDirValueName = "InstallDir"; + + using RegistryKey? driverKey = Registry.CurrentUser.OpenSubKey(UninstallKeyPath); + if (driverKey == null) + { + EmulatorPath = string.Empty; + return; + } + + string? installDir = driverKey.GetValue(InstallDirValueName) as string; + + if (string.IsNullOrEmpty(installDir)) + { + EmulatorPath = string.Empty; + return; + } + + EmulatorPath = installDir; + } + catch (Exception e) + { + _logger.Warning($"An error occurred: {e.Message}"); + EmulatorPath = string.Empty; + } + } } Instances.AsstProxy.Connected = false;