aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Console/CommandConsole.cs
diff options
context:
space:
mode:
authorMelanie2009-08-17 08:45:20 +0100
committerMelanie2009-08-17 08:45:20 +0100
commitcef16bec6dabc90fdccf82f755d24683d834208b (patch)
tree3265dbc64721f17eef82b06c7e16a7b4c6e0f657 /OpenSim/Framework/Console/CommandConsole.cs
parentMerge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-cef16bec6dabc90fdccf82f755d24683d834208b.zip
opensim-SC_OLD-cef16bec6dabc90fdccf82f755d24683d834208b.tar.gz
opensim-SC_OLD-cef16bec6dabc90fdccf82f755d24683d834208b.tar.bz2
opensim-SC_OLD-cef16bec6dabc90fdccf82f755d24683d834208b.tar.xz
Add the OpenSim.ConsoleClient app.
Usage: OpenSim.ConsoleClient -h <host> -p <port> -u <user> -P <pass> host defaults to localhost, port defaults to 8003.
Diffstat (limited to 'OpenSim/Framework/Console/CommandConsole.cs')
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs92
1 files changed, 91 insertions, 1 deletions
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index 7af8204..3387013 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -373,10 +373,28 @@ namespace OpenSim.Framework.Console
373 373
374 public XmlElement GetXml(XmlDocument doc) 374 public XmlElement GetXml(XmlDocument doc)
375 { 375 {
376 CommandInfo help = (CommandInfo)((Dictionary<string, object>)tree["help"])[String.Empty];
377 ((Dictionary<string, object>)tree["help"]).Remove(string.Empty);
378 if (((Dictionary<string, object>)tree["help"]).Count == 0)
379 tree.Remove("help");
380
381 CommandInfo quit = (CommandInfo)((Dictionary<string, object>)tree["quit"])[String.Empty];
382 ((Dictionary<string, object>)tree["quit"]).Remove(string.Empty);
383 if (((Dictionary<string, object>)tree["quit"]).Count == 0)
384 tree.Remove("quit");
385
376 XmlElement root = doc.CreateElement("", "HelpTree", ""); 386 XmlElement root = doc.CreateElement("", "HelpTree", "");
377 387
378 ProcessTreeLevel(tree, root, doc); 388 ProcessTreeLevel(tree, root, doc);
379 389
390 if (!tree.ContainsKey("help"))
391 tree["help"] = (object) new Dictionary<string, object>();
392 ((Dictionary<string, object>)tree["help"])[String.Empty] = help;
393
394 if (!tree.ContainsKey("quit"))
395 tree["quit"] = (object) new Dictionary<string, object>();
396 ((Dictionary<string, object>)tree["quit"])[String.Empty] = quit;
397
380 return root; 398 return root;
381 } 399 }
382 400
@@ -426,8 +444,80 @@ namespace OpenSim.Framework.Console
426 } 444 }
427 } 445 }
428 446
429 public void FromXml(XmlElement root) 447 public void FromXml(XmlElement root, CommandDelegate fn)
448 {
449 CommandInfo help = (CommandInfo)((Dictionary<string, object>)tree["help"])[String.Empty];
450 ((Dictionary<string, object>)tree["help"]).Remove(string.Empty);
451 if (((Dictionary<string, object>)tree["help"]).Count == 0)
452 tree.Remove("help");
453
454 CommandInfo quit = (CommandInfo)((Dictionary<string, object>)tree["quit"])[String.Empty];
455 ((Dictionary<string, object>)tree["quit"]).Remove(string.Empty);
456 if (((Dictionary<string, object>)tree["quit"]).Count == 0)
457 tree.Remove("quit");
458
459 tree.Clear();
460
461 ReadTreeLevel(tree, root, fn);
462
463 if (!tree.ContainsKey("help"))
464 tree["help"] = (object) new Dictionary<string, object>();
465 ((Dictionary<string, object>)tree["help"])[String.Empty] = help;
466
467 if (!tree.ContainsKey("quit"))
468 tree["quit"] = (object) new Dictionary<string, object>();
469 ((Dictionary<string, object>)tree["quit"])[String.Empty] = quit;
470 }
471
472 private void ReadTreeLevel(Dictionary<string, object> level, XmlNode node, CommandDelegate fn)
430 { 473 {
474 Dictionary<string, object> next;
475 string name;
476
477 XmlNodeList nodeL = node.ChildNodes;
478 XmlNodeList cmdL;
479 CommandInfo c;
480
481 foreach (XmlNode part in nodeL)
482 {
483 switch (part.Name)
484 {
485 case "Level":
486 name = ((XmlElement)part).GetAttribute("Name");
487 next = new Dictionary<string, object>();
488 level[name] = next;
489 ReadTreeLevel(next, part, fn);
490 break;
491 case "Command":
492 cmdL = part.ChildNodes;
493 c = new CommandInfo();
494 foreach (XmlNode cmdPart in cmdL)
495 {
496 switch (cmdPart.Name)
497 {
498 case "Module":
499 c.module = cmdPart.InnerText;
500 break;
501 case "Shared":
502 c.shared = Convert.ToBoolean(cmdPart.InnerText);
503 break;
504 case "HelpText":
505 c.help_text = cmdPart.InnerText;
506 break;
507 case "LongHelp":
508 c.long_help = cmdPart.InnerText;
509 break;
510 case "Description":
511 c.descriptive_help = cmdPart.InnerText;
512 break;
513 }
514 }
515 c.fn = new List<CommandDelegate>();
516 c.fn.Add(fn);
517 level[String.Empty] = c;
518 break;
519 }
520 }
431 } 521 }
432 } 522 }
433 523