namespace CoreAgent.Domain.Models.System;
///
/// 命令执行结果
///
public class CommandExecutionResult
{
///
/// 是否成功
///
public bool IsSuccess { get; set; }
///
/// 输出信息
///
public string Output { get; set; }
///
/// 错误信息
///
public string Error { get; set; }
///
/// 执行时间(毫秒)
///
public long ExecutionTime { get; set; }
///
/// 创建成功结果
///
/// 输出信息
/// 执行时间
/// 命令执行结果
public static CommandExecutionResult Success(string output, long executionTime)
{
return new CommandExecutionResult
{
IsSuccess = true,
Output = output,
Error = string.Empty,
ExecutionTime = executionTime
};
}
///
/// 创建失败结果
///
/// 错误信息
/// 执行时间
/// 命令执行结果
public static CommandExecutionResult Failure(string error, long executionTime)
{
return new CommandExecutionResult
{
IsSuccess = false,
Output = string.Empty,
Error = error,
ExecutionTime = executionTime
};
}
}