예제 #1
0
        protected CommandAction Admin(Action invocation, params string[] keys)
        {
            var command = new CommandAction(invocation, true);

            foreach (string key in keys)
            {
                CmdActions.Add(key, command);
            }
            return(command);
        }
예제 #2
0
        protected CommandAction[] Add(string desc, Action invocation, params string[] keys)
        {
            List <CommandAction> CommandActions = new List <CommandAction>();

            // Only the first key is marked as loggable. Variations are not logged.
            bool isFirst = true;

            foreach (string key in keys)
            {
                if (isFirst)
                {
                    CmdActions.Add(key, new CommandAction(invocation, desc, false));
                    CommandActions.Add(CmdActions[key]);
                }
                else
                {
                    CmdActions.Add(key, new CommandAction(invocation, false));
                    CommandActions.Add(CmdActions[key]);
                }
                isFirst = false;
            }

            return(CommandActions.ToArray());
        }