Automation/Commands/CommandHelper.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ComLib.Automation
{
    /// <summary>
    /// Helper class for commands.
    /// </summary>
    class CommandHelper
    {
        /// <summary>
        /// Builds a command result representing an unknown command
        /// </summary>
        /// <param name="name"></param>
        /// <param name="index"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        public static CommandResult BuildUnKnownCommandResult(string name, int index, string errorMessage)
        {
            var errorResult = new CommandResult(DateTime.Now, DateTime.Now, false, errorMessage);
            errorResult.Name = name;
            errorResult.Index = index;
            return errorResult;
        }


        /// <summary>
        /// Builds a command result representing an invalid command call with methods on a command that does not support methods
        /// </summary>
        /// <param name="name"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public static CommandResult BuildMethodCallNotSupportedResult(string name, int index)
        {
            var errorResult = new CommandResult(DateTime.Now, DateTime.Now, false, "Method call is not supported on this command");
            errorResult.Name = name;
            errorResult.Index = index;
            return errorResult;
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。