perf: 雷电截图增强支持自动检测模拟器安装路径

This commit is contained in:
uye
2024-10-08 18:40:42 +08:00
parent 33ebf0bcca
commit a00ee14fe1
2 changed files with 33 additions and 0 deletions

View File

@@ -69,6 +69,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Inited/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=iter/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ldconsole/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ldplayer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=LD_0027s/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=leidian/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Lolicon/@EntryIndexedValue">True</s:Boolean>

View File

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