aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-05 21:35:59 +0000
committerJustin Clarke Casey2009-02-05 21:35:59 +0000
commit732cd838b1ce2bc5d2c312f510818fd63db76be4 (patch)
tree66617238b33626990d7eb2d9f5da041f3e57eaa6 /OpenSim/Region/Environment
parent* Use the commander name to register module commanders instead of providing t... (diff)
downloadopensim-SC_OLD-732cd838b1ce2bc5d2c312f510818fd63db76be4.zip
opensim-SC_OLD-732cd838b1ce2bc5d2c312f510818fd63db76be4.tar.gz
opensim-SC_OLD-732cd838b1ce2bc5d2c312f510818fd63db76be4.tar.bz2
opensim-SC_OLD-732cd838b1ce2bc5d2c312f510818fd63db76be4.tar.xz
* Make existing module commanders register as help topics
* Typing help will now give a list of these topics at the top (as well as the rest of the current help stuff) * Typing help <topic> will give information about commands specific to that topic
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Interfaces/ICommander.cs9
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs34
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs10
7 files changed, 43 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/ICommander.cs b/OpenSim/Region/Environment/Interfaces/ICommander.cs
index a267115..a61ce490 100644
--- a/OpenSim/Region/Environment/Interfaces/ICommander.cs
+++ b/OpenSim/Region/Environment/Interfaces/ICommander.cs
@@ -29,10 +29,15 @@ namespace OpenSim.Region.Environment.Interfaces
29{ 29{
30 public interface ICommander 30 public interface ICommander
31 { 31 {
32 /// <summary> 32 /// <value>
33 /// The name of this commander 33 /// The name of this commander
34 /// </summary> 34 /// </value>
35 string Name { get; } 35 string Name { get; }
36
37 /// <value>
38 /// Provide general help information about this commander.
39 /// </value>
40 string Help { get; }
36 41
37 void ProcessConsoleCommand(string function, string[] args); 42 void ProcessConsoleCommand(string function, string[] args);
38 void RegisterCommand(string commandName, ICommand command); 43 void RegisterCommand(string commandName, ICommand command);
diff --git a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs
index caaa808..d5f4c80 100644
--- a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs
@@ -52,6 +52,23 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
52 get { return m_name; } 52 get { return m_name; }
53 } 53 }
54 private string m_name; 54 private string m_name;
55
56 public string Help
57 {
58 get
59 {
60 StringBuilder sb = new StringBuilder();
61
62 sb.AppendLine("===" + m_name + "===");
63
64 foreach (ICommand com in m_commands.Values)
65 {
66 sb.AppendLine("* " + com.Name + " - " + com.Help);
67 }
68
69 return sb.ToString();
70 }
71 }
55 72
56 /// <summary> 73 /// <summary>
57 /// Constructor 74 /// Constructor
@@ -60,7 +77,10 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
60 public Commander(string name) 77 public Commander(string name)
61 { 78 {
62 m_name = name; 79 m_name = name;
63 m_generatedApiClassName = m_name; 80 m_generatedApiClassName = m_name[0].ToString().ToUpper();
81
82 if (m_name.Length > 1)
83 m_generatedApiClassName += m_name.Substring(1);
64 } 84 }
65 85
66 /// <value> 86 /// <value>
@@ -145,22 +165,14 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
145 { 165 {
146 if (function != "help") 166 if (function != "help")
147 Console.WriteLine("ERROR: Invalid command - No such command exists"); 167 Console.WriteLine("ERROR: Invalid command - No such command exists");
148 ShowConsoleHelp(); 168
169 Console.Write(Help);
149 } 170 }
150 } 171 }
151 } 172 }
152 173
153 #endregion 174 #endregion
154 175
155 private void ShowConsoleHelp()
156 {
157 Console.WriteLine("===" + m_name + "===");
158 foreach (ICommand com in m_commands.Values)
159 {
160 Console.WriteLine("* " + com.Name + " - " + com.Help);
161 }
162 }
163
164 private string EscapeRuntimeAPICommand(string command) 176 private string EscapeRuntimeAPICommand(string command)
165 { 177 {
166 command = command.Replace('-', '_'); 178 command = command.Replace('-', '_');
diff --git a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs
index f4b56b7..e368f51 100644
--- a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
35{ 35{
36 public class CommanderTestModule : IRegionModule, ICommandableModule 36 public class CommanderTestModule : IRegionModule, ICommandableModule
37 { 37 {
38 private readonly Commander m_commander = new Commander("CommanderTest"); 38 private readonly Commander m_commander = new Commander("commandertest");
39 private Scene m_scene; 39 private Scene m_scene;
40 40
41 #region ICommandableModule Members 41 #region ICommandableModule Members
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index 0fac278..f086396 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 protected Scene m_scene; 48 protected Scene m_scene;
49 private readonly Commander m_commander = new Commander("Permissions"); 49 private readonly Commander m_commander = new Commander("permissions");
50 50
51 #region Constants 51 #region Constants
52 // These are here for testing. They will be taken out 52 // These are here for testing. They will be taken out
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
index 885dbae..f939adf 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
38{ 38{
39 public class SerialiserModule : IRegionModule, IRegionSerialiserModule 39 public class SerialiserModule : IRegionModule, IRegionSerialiserModule
40 { 40 {
41 private Commander m_commander = new Commander("Export"); 41 private Commander m_commander = new Commander("export");
42 private List<Scene> m_regions = new List<Scene>(); 42 private List<Scene> m_regions = new List<Scene>();
43 private string m_savedir = "exports" + "/"; 43 private string m_savedir = "exports" + "/";
44 private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>(); 44 private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
index cc9b4d2..3c27872 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
68 68
69 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 69 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
70 70
71 private readonly Commander m_commander = new Commander("Terrain"); 71 private readonly Commander m_commander = new Commander("terrain");
72 72
73 private readonly Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects = 73 private readonly Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects =
74 new Dictionary<StandardTerrainEffects, ITerrainFloodEffect>(); 74 new Dictionary<StandardTerrainEffects, ITerrainFloodEffect>();
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 5e7eae5..5b78617 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -286,12 +286,20 @@ namespace OpenSim.Region.Environment.Scenes
286 } 286 }
287 } 287 }
288 288
289 /// <summary>
290 /// Get a module commander
291 /// </summary>
292 /// <param name="name"></param>
293 /// <returns>The module commander, null if no module commander with that name was found</returns>
289 public ICommander GetCommander(string name) 294 public ICommander GetCommander(string name)
290 { 295 {
291 lock (m_moduleCommanders) 296 lock (m_moduleCommanders)
292 { 297 {
293 return m_moduleCommanders[name]; 298 if (m_moduleCommanders.ContainsKey(name))
299 return m_moduleCommanders[name];
294 } 300 }
301
302 return null;
295 } 303 }
296 304
297 public Dictionary<string, ICommander> GetCommanders() 305 public Dictionary<string, ICommander> GetCommanders()