Exemple #1
0
        /// <summary> Modifies the parameters if they match any command shortcut or command alias. </summary>
        public static void Search(ref string cmd, ref string cmdArgs)
        {
            Alias alias = Alias.Find(cmd);

            // Aliases should be able to override built in shortcuts
            if (alias == null)
            {
                Command shortcut = all.FindByShortcut(cmd);
                if (shortcut != null)
                {
                    cmd = shortcut.name;
                }
                return;
            }

            cmd = alias.Target;
            if (alias.Prefix != null)
            {
                cmdArgs = cmdArgs.Length == 0 ? alias.Prefix : alias.Prefix + " " + cmdArgs;
            }
            if (alias.Suffix != null)
            {
                cmdArgs = cmdArgs.Length == 0 ? alias.Suffix : cmdArgs + " " + alias.Suffix;
            }
        }