diff --git a/src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml b/src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml
index 7a23018849..93d264d7ba 100644
--- a/src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml
+++ b/src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml
@@ -17,19 +17,25 @@
+ Width="250" />
+
-
+
-
+
\ No newline at end of file
diff --git a/src/MeoAsstGui/ViewModels/RecruitViewModel.cs b/src/MeoAsstGui/ViewModels/RecruitViewModel.cs
index b9dcb85399..84c07dd419 100644
--- a/src/MeoAsstGui/ViewModels/RecruitViewModel.cs
+++ b/src/MeoAsstGui/ViewModels/RecruitViewModel.cs
@@ -126,7 +126,7 @@ namespace MeoAsstGui
}
if (!_catched)
{
- RecruitInfo = "连接模拟器失败,请参考使用说明处理";
+ RecruitInfo = "连接模拟器失败,请检查连接设置";
return;
}
RecruitInfo = "正在识别……";
diff --git a/src/MeoAsstGui/ViewModels/SettingsViewModel.cs b/src/MeoAsstGui/ViewModels/SettingsViewModel.cs
index 2bbdacc655..8f0f9ee21a 100644
--- a/src/MeoAsstGui/ViewModels/SettingsViewModel.cs
+++ b/src/MeoAsstGui/ViewModels/SettingsViewModel.cs
@@ -12,6 +12,8 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Notification.Wpf.Constants;
@@ -108,6 +110,17 @@ namespace MeoAsstGui
new CombData { Display = "制造站-芯片组", Value = "Chip" }
};
+ ConnectConfigList = new List
+ {
+ new CombData { Display = "通用", Value = "General" },
+ new CombData { Display = "蓝叠模拟器", Value = "BlueStacks" },
+ new CombData { Display = "MuMu模拟器", Value = "MuMuEmulator" },
+ new CombData { Display = "雷电模拟器", Value = "LDPlayer" },
+ new CombData { Display = "夜神模拟器", Value = "Nox" },
+ new CombData { Display = "逍遥模拟器", Value = "XYAZ" },
+ new CombData { Display = "WSA", Value = "WSA" }
+ };
+
_dormThresholdLabel = "宿舍入驻心情阈值:" + _dormThreshold + "%";
RoguelikeModeList = new List
@@ -116,6 +129,10 @@ namespace MeoAsstGui
new CombData { Display = "刷源石锭投资,第一层商店后直接退出", Value = "1" },
new CombData { Display = "刷源石锭投资,投资过后退出", Value = "2" }
};
+
+ ConnectAddressList = new ObservableCollection();
+
+ UpdateAddressByConfig();
}
private bool _idle = true;
@@ -135,6 +152,8 @@ namespace MeoAsstGui
public List UsesOfDronesList { get; set; }
public List RoguelikeModeList { get; set; }
+ public List ConnectConfigList { get; set; }
+ public ObservableCollection ConnectAddressList { get; set; }
private int _dormThreshold = Convert.ToInt32(ViewStatusStorage.Get("Infrast.DormThreshold", "30"));
@@ -809,6 +828,39 @@ namespace MeoAsstGui
}
}
+ public void QueryAdbDevices()
+ {
+ ConnectAddressList.Clear();
+ var adbProcess = new Process
+ {
+ StartInfo = new ProcessStartInfo
+ {
+ FileName = AdbPath,
+ Arguments = "devices",
+ UseShellExecute = false,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ CreateNoWindow = true,
+ },
+ EnableRaisingEvents = true
+ };
+
+ adbProcess.Start();
+ adbProcess.WaitForExit();
+ string output = adbProcess.StandardOutput.ReadToEnd();
+ adbProcess.Close();
+ var addressList = new List(output.Split('\n'));
+ addressList.RemoveAt(0);
+ foreach (var address in addressList)
+ {
+ if (string.IsNullOrWhiteSpace(address))
+ continue;
+
+ var device = address.Split('\t')[0];
+ ConnectAddressList.Add(device);
+ }
+ }
+
private string _connectConfig = ViewStatusStorage.Get("Connect.ConnectConfig", "General");
public string ConnectConfig
@@ -818,6 +870,40 @@ namespace MeoAsstGui
{
SetAndNotify(ref _connectConfig, value);
ViewStatusStorage.Set("Connect.ConnectConfig", value);
+ UpdateAddressByConfig();
+ }
+ }
+
+ private readonly Dictionary> ConfigAddressesMapping = new Dictionary>
+ {
+ { "General", new List {} },
+ { "BlueStacks", new List {"127.0.0.1:5555", "127.0.0.1:5556", "127.0.0.1:5557" } },
+ { "MuMuEmulator", new List{"127.0.0.1:7555"} },
+ { "LDPlayer", new List{ "127.0.0.1:5555", "emulator-5554" } },
+ { "Nox", new List { "127.0.0.1:62001", "127.0.0.1:59865" } },
+ { "XYAZ", new List {"127.0.0.1:21503" } },
+ { "WSA", new List { "127.0.0.1:58526" } },
+ };
+
+ public void UpdateAddressByConfig()
+ {
+ var addresses = ConfigAddressesMapping[ConnectConfig];
+ ConnectAddressList.Clear();
+ foreach (var address in addresses)
+ {
+ ConnectAddressList.Add(address);
+ }
+ }
+
+ public void SelectFile()
+ {
+ var dialog = new Microsoft.Win32.OpenFileDialog();
+
+ dialog.Filter = "adb程序|*.exe";
+
+ if (dialog.ShowDialog() == true)
+ {
+ AdbPath = dialog.FileName;
}
}