diff options
Diffstat (limited to 'OpenSim/Framework/Console/CommandConsole.cs')
-rw-r--r-- | OpenSim/Framework/Console/CommandConsole.cs | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index 9490013..851fbed 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs | |||
@@ -429,9 +429,9 @@ namespace OpenSim.Framework.Console | |||
429 | return new string[] { new List<string>(current.Keys)[0] }; | 429 | return new string[] { new List<string>(current.Keys)[0] }; |
430 | } | 430 | } |
431 | 431 | ||
432 | public string[] Resolve(string[] cmd) | 432 | private CommandInfo ResolveCommand(string[] cmd, out string[] result) |
433 | { | 433 | { |
434 | string[] result = cmd; | 434 | result = cmd; |
435 | int index = -1; | 435 | int index = -1; |
436 | 436 | ||
437 | Dictionary<string, object> current = tree; | 437 | Dictionary<string, object> current = tree; |
@@ -463,7 +463,7 @@ namespace OpenSim.Framework.Console | |||
463 | } | 463 | } |
464 | else if (found.Count > 0) | 464 | else if (found.Count > 0) |
465 | { | 465 | { |
466 | return new string[0]; | 466 | return null; |
467 | } | 467 | } |
468 | else | 468 | else |
469 | { | 469 | { |
@@ -472,21 +472,37 @@ namespace OpenSim.Framework.Console | |||
472 | } | 472 | } |
473 | 473 | ||
474 | if (current.ContainsKey(String.Empty)) | 474 | if (current.ContainsKey(String.Empty)) |
475 | return (CommandInfo)current[String.Empty]; | ||
476 | |||
477 | return null; | ||
478 | } | ||
479 | |||
480 | public bool HasCommand(string command) | ||
481 | { | ||
482 | string[] result; | ||
483 | return ResolveCommand(Parser.Parse(command), out result) != null; | ||
484 | } | ||
485 | |||
486 | public string[] Resolve(string[] cmd) | ||
487 | { | ||
488 | string[] result; | ||
489 | CommandInfo ci = ResolveCommand(cmd, out result); | ||
490 | |||
491 | if (ci == null) | ||
492 | return new string[0]; | ||
493 | |||
494 | if (ci.fn.Count == 0) | ||
495 | return new string[0]; | ||
496 | |||
497 | foreach (CommandDelegate fn in ci.fn) | ||
475 | { | 498 | { |
476 | CommandInfo ci = (CommandInfo)current[String.Empty]; | 499 | if (fn != null) |
477 | if (ci.fn.Count == 0) | 500 | fn(ci.module, result); |
501 | else | ||
478 | return new string[0]; | 502 | return new string[0]; |
479 | foreach (CommandDelegate fn in ci.fn) | ||
480 | { | ||
481 | if (fn != null) | ||
482 | fn(ci.module, result); | ||
483 | else | ||
484 | return new string[0]; | ||
485 | } | ||
486 | return result; | ||
487 | } | 503 | } |
488 | 504 | ||
489 | return new string[0]; | 505 | return result; |
490 | } | 506 | } |
491 | 507 | ||
492 | public XmlElement GetXml(XmlDocument doc) | 508 | public XmlElement GetXml(XmlDocument doc) |