You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
using System.Text.Json.Serialization;
|
|
|
|
namespace CoreAgent.Domain.Models.System;
|
|
|
|
/// <summary>
|
|
/// 网络命令配置
|
|
/// </summary>
|
|
public class NetworkCommandConfig
|
|
{
|
|
/// <summary>
|
|
/// 默认重试次数
|
|
/// </summary>
|
|
[JsonPropertyName("DefaultRetryCount")]
|
|
public int DefaultRetryCount { get; set; }
|
|
|
|
/// <summary>
|
|
/// 默认重试间隔(毫秒)
|
|
/// </summary>
|
|
[JsonPropertyName("DefaultRetryInterval")]
|
|
public int DefaultRetryInterval { get; set; }
|
|
|
|
/// <summary>
|
|
/// 网络命令配置列表
|
|
/// </summary>
|
|
[JsonPropertyName("NetworkCommands")]
|
|
public List<CommandTemplateConfig> NetworkCommands { get; set; }
|
|
|
|
/// <summary>
|
|
/// 获取指定类型的命令配置
|
|
/// </summary>
|
|
/// <param name="type">命令类型</param>
|
|
/// <returns>命令配置列表</returns>
|
|
public List<CommandTemplateConfig> GetCommandsByType(NetworkCommandType type)
|
|
{
|
|
return NetworkCommands?.Where(c => c.Type == type).ToList() ?? new List<CommandTemplateConfig>();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取所有命令类型
|
|
/// </summary>
|
|
/// <returns>命令类型数组</returns>
|
|
public NetworkCommandType[] GetCommandTypes()
|
|
{
|
|
return NetworkCommands?.Select(c => c.Type).Distinct().ToArray() ?? Array.Empty<NetworkCommandType>();
|
|
}
|
|
}
|