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.
61 lines
1.5 KiB
61 lines
1.5 KiB
7 days ago
|
namespace CoreAgent.Domain.Models.System;
|
||
|
|
||
|
/// <summary>
|
||
|
/// 命令执行结果
|
||
|
/// </summary>
|
||
|
public class CommandExecutionResult
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 是否成功
|
||
|
/// </summary>
|
||
|
public bool IsSuccess { get; set; }
|
||
|
|
||
|
/// <summary>
|
||
|
/// 输出信息
|
||
|
/// </summary>
|
||
|
public string Output { get; set; }
|
||
|
|
||
|
/// <summary>
|
||
|
/// 错误信息
|
||
|
/// </summary>
|
||
|
public string Error { get; set; }
|
||
|
|
||
|
/// <summary>
|
||
|
/// 执行时间(毫秒)
|
||
|
/// </summary>
|
||
|
public long ExecutionTime { get; set; }
|
||
|
|
||
|
/// <summary>
|
||
|
/// 创建成功结果
|
||
|
/// </summary>
|
||
|
/// <param name="output">输出信息</param>
|
||
|
/// <param name="executionTime">执行时间</param>
|
||
|
/// <returns>命令执行结果</returns>
|
||
|
public static CommandExecutionResult Success(string output, long executionTime)
|
||
|
{
|
||
|
return new CommandExecutionResult
|
||
|
{
|
||
|
IsSuccess = true,
|
||
|
Output = output,
|
||
|
Error = string.Empty,
|
||
|
ExecutionTime = executionTime
|
||
|
};
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 创建失败结果
|
||
|
/// </summary>
|
||
|
/// <param name="error">错误信息</param>
|
||
|
/// <param name="executionTime">执行时间</param>
|
||
|
/// <returns>命令执行结果</returns>
|
||
|
public static CommandExecutionResult Failure(string error, long executionTime)
|
||
|
{
|
||
|
return new CommandExecutionResult
|
||
|
{
|
||
|
IsSuccess = false,
|
||
|
Output = string.Empty,
|
||
|
Error = error,
|
||
|
ExecutionTime = executionTime
|
||
|
};
|
||
|
}
|
||
|
}
|