diff options
author | Melanie | 2009-08-17 05:00:30 +0100 |
---|---|---|
committer | Melanie | 2009-08-17 05:00:30 +0100 |
commit | 002940dd5dc8a4b5fa23ea6d5183e00431dd48df (patch) | |
tree | 793c49a583cd9f59a7d42c01de017a557e0cac5d /OpenSim/Framework/Console/CommandConsole.cs | |
parent | * handle litjson errors for now. We'll remove this when we hear back from ... (diff) | |
download | opensim-SC_OLD-002940dd5dc8a4b5fa23ea6d5183e00431dd48df.zip opensim-SC_OLD-002940dd5dc8a4b5fa23ea6d5183e00431dd48df.tar.gz opensim-SC_OLD-002940dd5dc8a4b5fa23ea6d5183e00431dd48df.tar.bz2 opensim-SC_OLD-002940dd5dc8a4b5fa23ea6d5183e00431dd48df.tar.xz |
Filling in the blanks: The "meat" of the REST console
Diffstat (limited to 'OpenSim/Framework/Console/CommandConsole.cs')
-rw-r--r-- | OpenSim/Framework/Console/CommandConsole.cs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index 8b63d01..7af8204 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Xml; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Diagnostics; | 31 | using System.Diagnostics; |
31 | using System.Reflection; | 32 | using System.Reflection; |
@@ -369,6 +370,65 @@ namespace OpenSim.Framework.Console | |||
369 | 370 | ||
370 | return new string[0]; | 371 | return new string[0]; |
371 | } | 372 | } |
373 | |||
374 | public XmlElement GetXml(XmlDocument doc) | ||
375 | { | ||
376 | XmlElement root = doc.CreateElement("", "HelpTree", ""); | ||
377 | |||
378 | ProcessTreeLevel(tree, root, doc); | ||
379 | |||
380 | return root; | ||
381 | } | ||
382 | |||
383 | private void ProcessTreeLevel(Dictionary<string, object> level, XmlElement xml, XmlDocument doc) | ||
384 | { | ||
385 | foreach (KeyValuePair<string, object> kvp in level) | ||
386 | { | ||
387 | if (kvp.Value is Dictionary<string, Object>) | ||
388 | { | ||
389 | XmlElement next = doc.CreateElement("", "Level", ""); | ||
390 | next.SetAttribute("Name", kvp.Key); | ||
391 | |||
392 | xml.AppendChild(next); | ||
393 | |||
394 | ProcessTreeLevel((Dictionary<string, object>)kvp.Value, next, doc); | ||
395 | } | ||
396 | else | ||
397 | { | ||
398 | CommandInfo c = (CommandInfo)kvp.Value; | ||
399 | |||
400 | XmlElement cmd = doc.CreateElement("", "Command", ""); | ||
401 | |||
402 | XmlElement e; | ||
403 | |||
404 | e = doc.CreateElement("", "Module", ""); | ||
405 | cmd.AppendChild(e); | ||
406 | e.AppendChild(doc.CreateTextNode(c.module)); | ||
407 | |||
408 | e = doc.CreateElement("", "Shared", ""); | ||
409 | cmd.AppendChild(e); | ||
410 | e.AppendChild(doc.CreateTextNode(c.shared.ToString())); | ||
411 | |||
412 | e = doc.CreateElement("", "HelpText", ""); | ||
413 | cmd.AppendChild(e); | ||
414 | e.AppendChild(doc.CreateTextNode(c.help_text)); | ||
415 | |||
416 | e = doc.CreateElement("", "LongHelp", ""); | ||
417 | cmd.AppendChild(e); | ||
418 | e.AppendChild(doc.CreateTextNode(c.long_help)); | ||
419 | |||
420 | e = doc.CreateElement("", "Description", ""); | ||
421 | cmd.AppendChild(e); | ||
422 | e.AppendChild(doc.CreateTextNode(c.descriptive_help)); | ||
423 | |||
424 | xml.AppendChild(cmd); | ||
425 | } | ||
426 | } | ||
427 | } | ||
428 | |||
429 | public void FromXml(XmlElement root) | ||
430 | { | ||
431 | } | ||
372 | } | 432 | } |
373 | 433 | ||
374 | public class Parser | 434 | public class Parser |