aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Framework
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-05 19:54:22 +0000
committerJustin Clarke Casey2009-02-05 19:54:22 +0000
commit9a666bda021503591e390facddda617f8b7ead3c (patch)
tree34cf79eb6f7a71003af347a4cbde17f8bad3a118 /OpenSim/Region/Environment/Modules/Framework
parent* refactor: Split out module Command class into a separate file (diff)
downloadopensim-SC-9a666bda021503591e390facddda617f8b7ead3c.zip
opensim-SC-9a666bda021503591e390facddda617f8b7ead3c.tar.gz
opensim-SC-9a666bda021503591e390facddda617f8b7ead3c.tar.bz2
opensim-SC-9a666bda021503591e390facddda617f8b7ead3c.tar.xz
* Use the commander name to register module commanders instead of providing the information twice
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Framework')
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs22
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs2
2 files changed, 21 insertions, 3 deletions
diff --git a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs
index 8b19043..caaa808 100644
--- a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs
@@ -41,18 +41,36 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
41 public class Commander : ICommander 41 public class Commander : ICommander
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 private Dictionary<string, ICommand> m_commands = new Dictionary<string, ICommand>(); 44
45 /// <value>
46 /// Used in runtime class generation
47 /// </summary>
48 private string m_generatedApiClassName;
49
50 public string Name
51 {
52 get { return m_name; }
53 }
45 private string m_name; 54 private string m_name;
46 55
56 /// <summary>
57 /// Constructor
58 /// </summary>
59 /// <param name="name"></param>
47 public Commander(string name) 60 public Commander(string name)
48 { 61 {
49 m_name = name; 62 m_name = name;
63 m_generatedApiClassName = m_name;
50 } 64 }
51 65
66 /// <value>
67 /// Commands that this commander knows about
68 /// </value>
52 public Dictionary<string, ICommand> Commands 69 public Dictionary<string, ICommand> Commands
53 { 70 {
54 get { return m_commands; } 71 get { return m_commands; }
55 } 72 }
73 private Dictionary<string, ICommand> m_commands = new Dictionary<string, ICommand>();
56 74
57 #region ICommander Members 75 #region ICommander Members
58 76
@@ -67,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
67 /// <returns>Returns C# source code to create a binding</returns> 85 /// <returns>Returns C# source code to create a binding</returns>
68 public string GenerateRuntimeAPI() 86 public string GenerateRuntimeAPI()
69 { 87 {
70 string classSrc = "\n\tpublic class " + m_name + " {\n"; 88 string classSrc = "\n\tpublic class " + m_generatedApiClassName + " {\n";
71 foreach (ICommand com in m_commands.Values) 89 foreach (ICommand com in m_commands.Values)
72 { 90 {
73 classSrc += "\tpublic void " + EscapeRuntimeAPICommand(com.Name) + "( "; 91 classSrc += "\tpublic void " + EscapeRuntimeAPICommand(com.Name) + "( ";
diff --git a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs
index c569240..f4b56b7 100644
--- a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
62 m_commander.RegisterCommand("hello", testCommand); 62 m_commander.RegisterCommand("hello", testCommand);
63 63
64 // Register me 64 // Register me
65 m_scene.RegisterModuleCommander("commandertest", m_commander); 65 m_scene.RegisterModuleCommander(m_commander);
66 } 66 }
67 67
68 public void Close() 68 public void Close()