示例#1
0
        protected override ReturnCode ExecuteInternal(Interpreter interpreter, IClientData clientData, ArgumentList arguments, ref Result result)
        {
            InternalLogger.Info("Executing Infotag command.");
            InternalLogger.Debug($"Parameters: {string.Join(", ", arguments.Select(a => $"{a.Name}: {a.Value}"))}");

            if (arguments.Count < 2)
            {
                result = Utility.WrongNumberOfArguments(this, 2, arguments, string.Empty);
                ResultLogger.Error($"Incorrect number of arguments: {arguments.Count} for command infotag.");
                return(ReturnCode.Error);
            }

            var subCommand = arguments[0];

            if (subCommand == _infotagGet.Name)
            {
                return(_infotagGet.Execute(interpreter, clientData, arguments, ref result));
            }
            if (subCommand == _infotagSet.Name)
            {
                return(_infotagSet.Execute(interpreter, clientData, arguments, ref result));
            }

            ErrorLogger.Error($"Incorrect subcommand argument: {subCommand}");
            result = $"Incorrect subcommand argument: {subCommand}";
            return(ReturnCode.Error);
        }