mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 18:47:55 +08:00
feat: 调整蓝叠hyperv端口号识别逻辑
This commit is contained in:
@@ -1125,7 +1125,6 @@ namespace MaaWpfGui.Main
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hyperV = Instances.SettingsViewModel.TryToSetBlueStacksHyperVAddress();
|
||||
if (!Instances.SettingsViewModel.AutoDetectConnection
|
||||
&& connected
|
||||
&& connectedAdb == Instances.SettingsViewModel.AdbPath
|
||||
@@ -1134,10 +1133,17 @@ namespace MaaWpfGui.Main
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!hyperV && Instances.SettingsViewModel.AutoDetectConnection &&
|
||||
!Instances.SettingsViewModel.DetectAdbConfig(ref error))
|
||||
if (Instances.SettingsViewModel.AutoDetectConnection)
|
||||
{
|
||||
return false;
|
||||
string bsHvAddress = Instances.SettingsViewModel.TryToSetBlueStacksHyperVAddress();
|
||||
if (bsHvAddress != null)
|
||||
{
|
||||
Instances.SettingsViewModel.ConnectAddress = bsHvAddress;
|
||||
}
|
||||
else if (!Instances.SettingsViewModel.DetectAdbConfig(ref error))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ret = AsstConnect(_handle, Instances.SettingsViewModel.AdbPath, Instances.SettingsViewModel.ConnectAddress, Instances.SettingsViewModel.ConnectConfig);
|
||||
|
||||
@@ -2251,17 +2251,17 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
/// Tries to set Bluestack Hyper V address.
|
||||
/// </summary>
|
||||
/// <returns>success</returns>
|
||||
public bool TryToSetBlueStacksHyperVAddress()
|
||||
public string TryToSetBlueStacksHyperVAddress()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_bluestacksConfig))
|
||||
{
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!File.Exists(_bluestacksConfig))
|
||||
{
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.BluestacksConfigError, "File not exists");
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
var all_lines = File.ReadAllLines(_bluestacksConfig);
|
||||
@@ -2284,12 +2284,11 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
if (line.StartsWith(_bluestacksKeyWord))
|
||||
{
|
||||
var sp = line.Split('"');
|
||||
ConnectAddress = "127.0.0.1:" + sp[1];
|
||||
break;
|
||||
return "127.0.0.1:" + sp[1];
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool IsAdbTouchMode()
|
||||
|
||||
Reference in New Issue
Block a user