Exemplo n.º 1
0
 protected virtual void LoadCommandsList()
 {
     foreach (var com in GetAPICommandClasses())
     {
         if (com != null)
         {
             if (com.IsAbstract == false)
             {
                 API_interface D = (API_interface)Activator.CreateInstance(com);
                 if (D != null)
                 {
                     if (subtype_map.ContainsKey(D.CommandName) == false)
                     {
                         string worknamespace = com.Namespace;
                         worknamespace = worknamespace.Replace("BSB.Commands.", "");
                         worknamespace = worknamespace.Replace("BSB.RLV.", "");
                         worknamespace = worknamespace.Replace("BetterSecondBot.HttpServer.View.", "");
                         worknamespace = worknamespace.Replace("BetterSecondBot.HttpServer.Control.", "");
                         worknamespace = worknamespace.Replace("CMD_", "");
                         subtype_map.Add(D.CommandName, D.GetType());
                         subtype_workspace_map.Add(D.CommandName, worknamespace);
                     }
                     else
                     {
                         ConsoleLog.Crit("[CMD] command: " + D.CommandName + " already defined!");
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
        public virtual int GetCommandArgs(string cmd)
        {
            API_interface cmdGet = GetCommand(cmd);

            if (cmdGet != null)
            {
                return(cmdGet.MinArgs);
            }
            return(0);
        }
Exemplo n.º 3
0
        public virtual string[] GetCommandArgHints(string cmd)
        {
            API_interface CmdGet = GetCommand(cmd);

            if (CmdGet != null)
            {
                return(CmdGet.ArgHints);
            }
            return(new string[] { });
        }
Exemplo n.º 4
0
        public virtual string GetCommandHelp(string cmd)
        {
            API_interface cmdGet = GetCommand(cmd);

            if (cmdGet != null)
            {
                return(cmdGet.Helpfile);
            }
            return("None given");
        }