30 namespace OpenSim.Framework.Console
48 private string m_helpText;
52 private string[] m_cmdText;
65 m_cmdText = command.Split(
new char[] {
' ' });
66 m_commandDelegate = dlg;
82 cmdWithParams = cmdWithParams.ToLower().Trim();
83 string matchText = String.Join(
" ",m_cmdText).ToLower().Trim();
84 if (cmdWithParams.StartsWith(matchText))
87 return matchText.Length;
95 public void Run(
string cmd,
string[] cmdParams)
98 if (m_cmdText.Length > 1)
100 int currentParam = 1;
101 while (currentParam < m_cmdText.Length)
103 if (cmdParams[skipParams].ToLower().Equals(m_cmdText[currentParam].ToLower()))
111 string[] sendCmdParams = cmdParams;
114 sendCmdParams =
new string[cmdParams.Length-skipParams];
115 for (
int i=0;i<sendCmdParams.Length;i++) {
116 sendCmdParams[i] = cmdParams[skipParams++];
119 m_commandDelegate(sendCmdParams);
127 console.Output(String.Join(
" ", m_cmdText) +
" - " + m_helpText +
"\n");
135 cmdWithParams = cmdWithParams.ToLower();
136 return cmdWithParams.Contains(String.Join(
" ", m_cmdText).ToLower()) || m_helpText.ToLower().Contains(cmdWithParams);
void Run(string cmd, string[] cmdParams)
Run the delegate the incomming string may contain the command, if so, it is chopped off the cmdParams...
bool IsHelpfull(string cmdWithParams)
return true if the ShowHelp(..) method might be helpfull
int matchLength(string cmdWithParams)
Returns the match length this command has upon the 'cmdWithParams' At least a higher number for "show...
void ShowHelp(ConsoleBase console)
Shows help information on the console's Notice method
ConsolePluginCommand(string command, ConsoleCommand dlg, string help)
Construct a new ConsolePluginCommand
delegate void ConsoleCommand(string[] comParams)
Holder object for a new console plugin command