feat:自动检测特定目录下的bluestacks.conf (#5751)

好吧就是我懒得编辑json了(
This commit is contained in:
MistEO
2023-08-03 09:41:00 +08:00
committed by GitHub

View File

@@ -2439,6 +2439,11 @@ namespace MaaWpfGui.ViewModels.UI
{ "WSA", new List<string> { "127.0.0.1:58526" } },
};
/// <summary>
/// Gets the default bluestack conf.
/// </summary>
public static List<string> DafaultBluestacksConfPath { get; } = new List<string> { "C:\\ProgramData\\BlueStacks_nxt\\bluestacks.conf", "D:\\BlueStacks_nxt\\bluestacks.conf" };
/// <summary>
/// Refreshes ADB config.
/// </summary>
@@ -2506,6 +2511,30 @@ namespace MaaWpfGui.ViewModels.UI
return true;
}
/// <summary>
/// Get the path of bluestacks.conf
/// </summary>
/// <returns>path</returns>
public static string GetBluestacksConfig()
{
var conf = ConfigurationHelper.GetValue(ConfigurationKeys.BluestacksConfigPath, string.Empty);
if (!string.IsNullOrEmpty(conf))
{
return conf;
}
foreach (var confPath in DafaultBluestacksConfPath)
{
if (File.Exists(confPath))
{
return confPath;
}
}
return null;
}
/// <summary>
/// Selects ADB program file.
/// </summary>
@@ -2572,7 +2601,7 @@ namespace MaaWpfGui.ViewModels.UI
rvm.WindowTitle = $"{prefix}MAA ({CurrentConfiguration}) - {VersionId}{poolString} - {connectConfigName} ({ConnectAddress}) - {ClientName}";
}
private readonly string _bluestacksConfig = ConfigurationHelper.GetValue(ConfigurationKeys.BluestacksConfigPath, string.Empty);
private readonly string _bluestacksConfig = GetBluestacksConfig();
private string _bluestacksKeyWord = ConfigurationHelper.GetValue(ConfigurationKeys.BluestacksConfigKeyword, string.Empty);
/// <summary>