|
|
@ -501,6 +501,44 @@ namespace LTEMvcApp.Services |
|
|
|
return GetClientInstance(defaultConfig.Name); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取所有测试客户端实例
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>所有测试客户端的WebSocket实例列表</returns>
|
|
|
|
public List<LTEClientWebSocket> GetAllTestClients() |
|
|
|
{ |
|
|
|
var testClients = new List<LTEClientWebSocket>(); |
|
|
|
|
|
|
|
foreach (var config in _testClientConfigs) |
|
|
|
{ |
|
|
|
if (_clients.TryGetValue(config.Name, out var client)) |
|
|
|
{ |
|
|
|
testClients.Add(client); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return testClients; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取所有测试客户端配置和状态
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>测试客户端配置和状态列表</returns>
|
|
|
|
public List<dynamic> GetAllTestClientsWithState() |
|
|
|
{ |
|
|
|
var result = new List<dynamic>(); |
|
|
|
|
|
|
|
foreach (var config in _testClientConfigs) |
|
|
|
{ |
|
|
|
var client = GetClientInstance(config.Name); |
|
|
|
var state = client?.State ?? ClientState.Stop; |
|
|
|
|
|
|
|
result.Add(new { Config = config, State = state, Client = client }); |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 创建默认测试配置
|
|
|
|
/// </summary>
|
|
|
|