diff options
author | Adam Frisby | 2008-05-04 19:21:14 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-04 19:21:14 +0000 |
commit | 07098978b9a3f738a266fd4e6e978839e302def8 (patch) | |
tree | d6546dc21f764c5f1faa84b811efef1356131db4 | |
parent | *Fixed a mistake in the EstateManagementModule that messed up the trunk. (diff) | |
download | opensim-SC-07098978b9a3f738a266fd4e6e978839e302def8.zip opensim-SC-07098978b9a3f738a266fd4e6e978839e302def8.tar.gz opensim-SC-07098978b9a3f738a266fd4e6e978839e302def8.tar.bz2 opensim-SC-07098978b9a3f738a266fd4e6e978839e302def8.tar.xz |
* Updating some file locations.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs (renamed from OpenSim/Region/Environment/Modules/Framework/Commander.cs) | 619 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs (renamed from OpenSim/Region/Environment/Modules/Framework/CommanderTestModule.cs) | 175 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs | 2 |
4 files changed, 402 insertions, 396 deletions
diff --git a/OpenSim/Region/Environment/Modules/Framework/Commander.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs index 4430c10..f9896bd 100644 --- a/OpenSim/Region/Environment/Modules/Framework/Commander.cs +++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs | |||
@@ -1,308 +1,313 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Text; | 31 | using System.Text; |
32 | using log4net; | 32 | using log4net; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
35 | 35 | ||
36 | namespace OpenSim.Region.Environment.Modules.Framework | 36 | namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander |
37 | { | 37 | { |
38 | /// <summary> | 38 | /// <summary> |
39 | /// A single function call encapsulated in a class which enforces arguments when passing around as Object[]'s. | 39 | /// A single function call encapsulated in a class which enforces arguments when passing around as Object[]'s. |
40 | /// Used for console commands and script API generation | 40 | /// Used for console commands and script API generation |
41 | /// </summary> | 41 | /// </summary> |
42 | public class Command : ICommand | 42 | public class Command : ICommand |
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | private List<CommandArgument> m_args = new List<CommandArgument>(); | 45 | private List<CommandArgument> m_args = new List<CommandArgument>(); |
46 | 46 | ||
47 | private Action<object[]> m_command; | 47 | private Action<object[]> m_command; |
48 | private string m_help; | 48 | private string m_help; |
49 | private string m_name; | 49 | private string m_name; |
50 | 50 | ||
51 | public Command(string name, Action<Object[]> command, string help) | 51 | public Command(string name, Action<Object[]> command, string help) |
52 | { | 52 | { |
53 | m_name = name; | 53 | m_name = name; |
54 | m_command = command; | 54 | m_command = command; |
55 | m_help = help; | 55 | m_help = help; |
56 | } | 56 | } |
57 | 57 | ||
58 | #region ICommand Members | 58 | #region ICommand Members |
59 | 59 | ||
60 | public void AddArgument(string name, string helptext, string type) | 60 | public void AddArgument(string name, string helptext, string type) |
61 | { | 61 | { |
62 | m_args.Add(new CommandArgument(name, helptext, type)); | 62 | m_args.Add(new CommandArgument(name, helptext, type)); |
63 | } | 63 | } |
64 | 64 | ||
65 | public string Name | 65 | public string Name |
66 | { | 66 | { |
67 | get { return m_name; } | 67 | get { return m_name; } |
68 | } | 68 | } |
69 | 69 | ||
70 | public string Help | 70 | public string Help |
71 | { | 71 | { |
72 | get { return m_help; } | 72 | get { return m_help; } |
73 | } | 73 | } |
74 | 74 | ||
75 | public Dictionary<string, string> Arguments | 75 | public Dictionary<string, string> Arguments |
76 | { | 76 | { |
77 | get | 77 | get |
78 | { | 78 | { |
79 | Dictionary<string, string> tmp = new Dictionary<string, string>(); | 79 | Dictionary<string, string> tmp = new Dictionary<string, string>(); |
80 | foreach (CommandArgument arg in m_args) | 80 | foreach (CommandArgument arg in m_args) |
81 | { | 81 | { |
82 | tmp.Add(arg.Name, arg.ArgumentType); | 82 | tmp.Add(arg.Name, arg.ArgumentType); |
83 | } | 83 | } |
84 | return tmp; | 84 | return tmp; |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | public void ShowConsoleHelp() | 88 | public void ShowConsoleHelp() |
89 | { | 89 | { |
90 | m_log.Info("== " + Name + " =="); | 90 | m_log.Info("== " + Name + " =="); |
91 | m_log.Info(m_help); | 91 | m_log.Info(m_help); |
92 | m_log.Info("= Parameters ="); | 92 | m_log.Info("= Parameters ="); |
93 | foreach (CommandArgument arg in m_args) | 93 | foreach (CommandArgument arg in m_args) |
94 | { | 94 | { |
95 | m_log.Info("* " + arg.Name + " (" + arg.ArgumentType + ")"); | 95 | m_log.Info("* " + arg.Name + " (" + arg.ArgumentType + ")"); |
96 | m_log.Info("\t" + arg.HelpText); | 96 | m_log.Info("\t" + arg.HelpText); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | public void Run(Object[] args) | 100 | public void Run(Object[] args) |
101 | { | 101 | { |
102 | Object[] cleanArgs = new Object[m_args.Count]; | 102 | Object[] cleanArgs = new Object[m_args.Count]; |
103 | 103 | ||
104 | if (args.Length < cleanArgs.Length) | 104 | if (args.Length < cleanArgs.Length) |
105 | { | 105 | { |
106 | m_log.Error("Missing " + (cleanArgs.Length - args.Length) + " argument(s)"); | 106 | m_log.Error("Missing " + (cleanArgs.Length - args.Length) + " argument(s)"); |
107 | ShowConsoleHelp(); | 107 | ShowConsoleHelp(); |
108 | return; | 108 | return; |
109 | } | 109 | } |
110 | if (args.Length > cleanArgs.Length) | 110 | if (args.Length > cleanArgs.Length) |
111 | { | 111 | { |
112 | m_log.Error("Too many arguments for this command. Type '<module> <command> help' for help."); | 112 | m_log.Error("Too many arguments for this command. Type '<module> <command> help' for help."); |
113 | return; | 113 | return; |
114 | } | 114 | } |
115 | 115 | ||
116 | int i = 0; | 116 | int i = 0; |
117 | foreach (Object arg in args) | 117 | foreach (Object arg in args) |
118 | { | 118 | { |
119 | if (string.IsNullOrEmpty(arg.ToString())) | 119 | if (string.IsNullOrEmpty(arg.ToString())) |
120 | { | 120 | { |
121 | m_log.Error("Empty arguments are not allowed"); | 121 | m_log.Error("Empty arguments are not allowed"); |
122 | return; | 122 | return; |
123 | } | 123 | } |
124 | try | 124 | try |
125 | { | 125 | { |
126 | switch (m_args[i].ArgumentType) | 126 | switch (m_args[i].ArgumentType) |
127 | { | 127 | { |
128 | case "String": | 128 | case "String": |
129 | m_args[i].ArgumentValue = arg.ToString(); | 129 | m_args[i].ArgumentValue = arg.ToString(); |
130 | break; | 130 | break; |
131 | case "Integer": | 131 | case "Integer": |
132 | m_args[i].ArgumentValue = Int32.Parse(arg.ToString()); | 132 | m_args[i].ArgumentValue = Int32.Parse(arg.ToString()); |
133 | break; | 133 | break; |
134 | case "Double": | 134 | case "Double": |
135 | m_args[i].ArgumentValue = Double.Parse(arg.ToString()); | 135 | m_args[i].ArgumentValue = Double.Parse(arg.ToString()); |
136 | break; | 136 | break; |
137 | case "Boolean": | 137 | case "Boolean": |
138 | m_args[i].ArgumentValue = Boolean.Parse(arg.ToString()); | 138 | m_args[i].ArgumentValue = Boolean.Parse(arg.ToString()); |
139 | break; | 139 | break; |
140 | default: | 140 | default: |
141 | m_log.Error("Unknown desired type for argument " + m_args[i].Name + " on command " + m_name); | 141 | m_log.Error("Unknown desired type for argument " + m_args[i].Name + " on command " + m_name); |
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | catch (FormatException) | 145 | catch (FormatException) |
146 | { | 146 | { |
147 | m_log.Error("Argument number " + (i + 1) + | 147 | m_log.Error("Argument number " + (i + 1) + |
148 | " (" + m_args[i].Name + ") must be a valid " + | 148 | " (" + m_args[i].Name + ") must be a valid " + |
149 | m_args[i].ArgumentType.ToLower() + "."); | 149 | m_args[i].ArgumentType.ToLower() + "."); |
150 | } | 150 | } |
151 | cleanArgs[i] = m_args[i].ArgumentValue; | 151 | cleanArgs[i] = m_args[i].ArgumentValue; |
152 | 152 | ||
153 | i++; | 153 | i++; |
154 | } | 154 | } |
155 | 155 | ||
156 | m_command.Invoke(cleanArgs); | 156 | m_command.Invoke(cleanArgs); |
157 | } | 157 | } |
158 | 158 | ||
159 | #endregion | 159 | #endregion |
160 | } | 160 | } |
161 | 161 | ||
162 | /// <summary> | 162 | /// <summary> |
163 | /// A single command argument, contains name, type and at runtime, value. | 163 | /// A single command argument, contains name, type and at runtime, value. |
164 | /// </summary> | 164 | /// </summary> |
165 | public class CommandArgument | 165 | public class CommandArgument |
166 | { | 166 | { |
167 | private string m_help; | 167 | private string m_help; |
168 | private string m_name; | 168 | private string m_name; |
169 | private string m_type; | 169 | private string m_type; |
170 | private Object m_val; | 170 | private Object m_val; |
171 | 171 | ||
172 | public CommandArgument(string name, string help, string type) | 172 | public CommandArgument(string name, string help, string type) |
173 | { | 173 | { |
174 | m_name = name; | 174 | m_name = name; |
175 | m_help = help; | 175 | m_help = help; |
176 | m_type = type; | 176 | m_type = type; |
177 | } | 177 | } |
178 | 178 | ||
179 | public string Name | 179 | public string Name |
180 | { | 180 | { |
181 | get { return m_name; } | 181 | get { return m_name; } |
182 | } | 182 | } |
183 | 183 | ||
184 | public string HelpText | 184 | public string HelpText |
185 | { | 185 | { |
186 | get { return m_help; } | 186 | get { return m_help; } |
187 | } | 187 | } |
188 | 188 | ||
189 | public string ArgumentType | 189 | public string ArgumentType |
190 | { | 190 | { |
191 | get { return m_type; } | 191 | get { return m_type; } |
192 | } | 192 | } |
193 | 193 | ||
194 | public Object ArgumentValue | 194 | public Object ArgumentValue |
195 | { | 195 | { |
196 | get { return m_val; } | 196 | get { return m_val; } |
197 | set { m_val = value; } | 197 | set { m_val = value; } |
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | /// <summary> | 201 | /// <summary> |
202 | /// A class to enable modules to register console and script commands, which enforces typing and valid input. | 202 | /// A class to enable modules to register console and script commands, which enforces typing and valid input. |
203 | /// </summary> | 203 | /// </summary> |
204 | public class Commander : ICommander | 204 | public class Commander : ICommander |
205 | { | 205 | { |
206 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 206 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
207 | private Dictionary<string, ICommand> m_commands = new Dictionary<string, ICommand>(); | 207 | private Dictionary<string, ICommand> m_commands = new Dictionary<string, ICommand>(); |
208 | private string m_name; | 208 | private string m_name; |
209 | 209 | ||
210 | public Commander(string name) | 210 | public Commander(string name) |
211 | { | 211 | { |
212 | m_name = name; | 212 | m_name = name; |
213 | } | 213 | } |
214 | 214 | ||
215 | #region ICommander Members | 215 | public Dictionary<string, ICommand> Commands |
216 | 216 | { | |
217 | public void RegisterCommand(string commandName, ICommand command) | 217 | get { return m_commands; } |
218 | { | 218 | } |
219 | m_commands[commandName] = command; | 219 | |
220 | } | 220 | #region ICommander Members |
221 | 221 | ||
222 | /// <summary> | 222 | public void RegisterCommand(string commandName, ICommand command) |
223 | /// Generates a runtime C# class which can be compiled and inserted via reflection to enable modules to register new script commands | 223 | { |
224 | /// </summary> | 224 | m_commands[commandName] = command; |
225 | /// <returns>Returns C# source code to create a binding</returns> | 225 | } |
226 | public string GenerateRuntimeAPI() | 226 | |
227 | { | 227 | /// <summary> |
228 | string classSrc = "\n\tpublic class " + m_name + " {\n"; | 228 | /// Generates a runtime C# class which can be compiled and inserted via reflection to enable modules to register new script commands |
229 | foreach (ICommand com in m_commands.Values) | 229 | /// </summary> |
230 | { | 230 | /// <returns>Returns C# source code to create a binding</returns> |
231 | classSrc += "\tpublic void " + EscapeRuntimeAPICommand(com.Name) + "( "; | 231 | public string GenerateRuntimeAPI() |
232 | foreach (KeyValuePair<string, string> arg in com.Arguments) | 232 | { |
233 | { | 233 | string classSrc = "\n\tpublic class " + m_name + " {\n"; |
234 | classSrc += arg.Value + " " + Util.Md5Hash(arg.Key) + ","; | 234 | foreach (ICommand com in m_commands.Values) |
235 | } | 235 | { |
236 | classSrc = classSrc.Remove(classSrc.Length - 1); // Delete the last comma | 236 | classSrc += "\tpublic void " + EscapeRuntimeAPICommand(com.Name) + "( "; |
237 | classSrc += " )\n\t{\n"; | 237 | foreach (KeyValuePair<string, string> arg in com.Arguments) |
238 | classSrc += "\t\tObject[] args = new Object[" + com.Arguments.Count.ToString() + "];\n"; | 238 | { |
239 | int i = 0; | 239 | classSrc += arg.Value + " " + Util.Md5Hash(arg.Key) + ","; |
240 | foreach (KeyValuePair<string, string> arg in com.Arguments) | 240 | } |
241 | { | 241 | classSrc = classSrc.Remove(classSrc.Length - 1); // Delete the last comma |
242 | classSrc += "\t\targs[" + i.ToString() + "] = " + Util.Md5Hash(arg.Key) + " " + ";\n"; | 242 | classSrc += " )\n\t{\n"; |
243 | i++; | 243 | classSrc += "\t\tObject[] args = new Object[" + com.Arguments.Count.ToString() + "];\n"; |
244 | } | 244 | int i = 0; |
245 | classSrc += "\t\tGetCommander(\"" + m_name + "\").Run(\"" + com.Name + "\", args);\n"; | 245 | foreach (KeyValuePair<string, string> arg in com.Arguments) |
246 | classSrc += "\t}\n"; | 246 | { |
247 | } | 247 | classSrc += "\t\targs[" + i.ToString() + "] = " + Util.Md5Hash(arg.Key) + " " + ";\n"; |
248 | classSrc += "}\n"; | 248 | i++; |
249 | 249 | } | |
250 | return classSrc; | 250 | classSrc += "\t\tGetCommander(\"" + m_name + "\").Run(\"" + com.Name + "\", args);\n"; |
251 | } | 251 | classSrc += "\t}\n"; |
252 | 252 | } | |
253 | /// <summary> | 253 | classSrc += "}\n"; |
254 | /// Runs a specified function with attached arguments | 254 | |
255 | /// *** <b>DO NOT CALL DIRECTLY.</b> *** | 255 | return classSrc; |
256 | /// Call ProcessConsoleCommand instead if handling human input. | 256 | } |
257 | /// </summary> | 257 | |
258 | /// <param name="function">The function name to call</param> | 258 | /// <summary> |
259 | /// <param name="args">The function parameters</param> | 259 | /// Runs a specified function with attached arguments |
260 | public void Run(string function, object[] args) | 260 | /// *** <b>DO NOT CALL DIRECTLY.</b> *** |
261 | { | 261 | /// Call ProcessConsoleCommand instead if handling human input. |
262 | m_commands[function].Run(args); | 262 | /// </summary> |
263 | } | 263 | /// <param name="function">The function name to call</param> |
264 | 264 | /// <param name="args">The function parameters</param> | |
265 | public void ProcessConsoleCommand(string function, string[] args) | 265 | public void Run(string function, object[] args) |
266 | { | 266 | { |
267 | if (m_commands.ContainsKey(function)) | 267 | m_commands[function].Run(args); |
268 | { | 268 | } |
269 | if (args.Length > 0 && args[0] == "help") | 269 | |
270 | { | 270 | public void ProcessConsoleCommand(string function, string[] args) |
271 | m_commands[function].ShowConsoleHelp(); | 271 | { |
272 | } | 272 | if (m_commands.ContainsKey(function)) |
273 | else | 273 | { |
274 | { | 274 | if (args.Length > 0 && args[0] == "help") |
275 | m_commands[function].Run(args); | 275 | { |
276 | } | 276 | m_commands[function].ShowConsoleHelp(); |
277 | } | 277 | } |
278 | else | 278 | else |
279 | { | 279 | { |
280 | if (function != "help") | 280 | m_commands[function].Run(args); |
281 | m_log.Error("Invalid command - No such command exists"); | 281 | } |
282 | if (function == "api") | 282 | } |
283 | m_log.Info(GenerateRuntimeAPI()); | 283 | else |
284 | ShowConsoleHelp(); | 284 | { |
285 | } | 285 | if (function != "help") |
286 | } | 286 | m_log.Error("Invalid command - No such command exists"); |
287 | 287 | if (function == "api") | |
288 | #endregion | 288 | m_log.Info(GenerateRuntimeAPI()); |
289 | 289 | ShowConsoleHelp(); | |
290 | private void ShowConsoleHelp() | 290 | } |
291 | { | 291 | } |
292 | m_log.Info("===" + m_name + "==="); | 292 | |
293 | foreach (ICommand com in m_commands.Values) | 293 | #endregion |
294 | { | 294 | |
295 | m_log.Info("* " + com.Name + " - " + com.Help); | 295 | private void ShowConsoleHelp() |
296 | } | 296 | { |
297 | } | 297 | m_log.Info("===" + m_name + "==="); |
298 | 298 | foreach (ICommand com in m_commands.Values) | |
299 | private string EscapeRuntimeAPICommand(string command) | 299 | { |
300 | { | 300 | m_log.Info("* " + com.Name + " - " + com.Help); |
301 | command = command.Replace('-', '_'); | 301 | } |
302 | StringBuilder tmp = new StringBuilder(command); | 302 | } |
303 | tmp[0] = tmp[0].ToString().ToUpper().ToCharArray()[0]; | 303 | |
304 | 304 | private string EscapeRuntimeAPICommand(string command) | |
305 | return tmp.ToString(); | 305 | { |
306 | } | 306 | command = command.Replace('-', '_'); |
307 | } | 307 | StringBuilder tmp = new StringBuilder(command); |
308 | tmp[0] = tmp[0].ToString().ToUpper().ToCharArray()[0]; | ||
309 | |||
310 | return tmp.ToString(); | ||
311 | } | ||
312 | } | ||
308 | } \ No newline at end of file | 313 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/Framework/CommanderTestModule.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs index 7b5c981..fffb19e 100644 --- a/OpenSim/Region/Environment/Modules/Framework/CommanderTestModule.cs +++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs | |||
@@ -1,88 +1,89 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Region.Environment.Interfaces; | 30 | using OpenSim.Region.Environment.Interfaces; |
31 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Modules.Framework.InterfaceCommander; |
32 | 32 | using OpenSim.Region.Environment.Scenes; | |
33 | namespace OpenSim.Region.Environment.Modules.Framework | 33 | |
34 | { | 34 | namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander |
35 | public class CommanderTestModule : IRegionModule, ICommandableModule | 35 | { |
36 | { | 36 | public class CommanderTestModule : IRegionModule, ICommandableModule |
37 | private Commander m_commander = new Commander("CommanderTest"); | 37 | { |
38 | private Scene m_scene; | 38 | private readonly Commander m_commander = new Commander("CommanderTest"); |
39 | 39 | private Scene m_scene; | |
40 | #region ICommandableModule Members | 40 | |
41 | 41 | #region ICommandableModule Members | |
42 | public ICommander CommandInterface | 42 | |
43 | { | 43 | public ICommander CommandInterface |
44 | get { throw new NotImplementedException(); } | 44 | { |
45 | } | 45 | get { throw new NotImplementedException(); } |
46 | 46 | } | |
47 | #endregion | 47 | |
48 | 48 | #endregion | |
49 | #region IRegionModule Members | 49 | |
50 | 50 | #region IRegionModule Members | |
51 | public void Initialise(Scene scene, IConfigSource source) | 51 | |
52 | { | 52 | public void Initialise(Scene scene, IConfigSource source) |
53 | m_scene = scene; | 53 | { |
54 | } | 54 | m_scene = scene; |
55 | 55 | } | |
56 | public void PostInitialise() | 56 | |
57 | { | 57 | public void PostInitialise() |
58 | Command testCommand = new Command("hello", InterfaceHelloWorld, "Says a simple debugging test string"); | 58 | { |
59 | testCommand.AddArgument("world", "Write world here", "string"); | 59 | Command testCommand = new Command("hello", InterfaceHelloWorld, "Says a simple debugging test string"); |
60 | 60 | testCommand.AddArgument("world", "Write world here", "string"); | |
61 | m_commander.RegisterCommand("hello", testCommand); | 61 | |
62 | 62 | m_commander.RegisterCommand("hello", testCommand); | |
63 | // Register me | 63 | |
64 | m_scene.RegisterModuleCommander("commandertest", m_commander); | 64 | // Register me |
65 | } | 65 | m_scene.RegisterModuleCommander("commandertest", m_commander); |
66 | 66 | } | |
67 | public void Close() | 67 | |
68 | { | 68 | public void Close() |
69 | } | 69 | { |
70 | 70 | } | |
71 | public string Name | 71 | |
72 | { | 72 | public string Name |
73 | get { return "CommanderTestModule"; } | 73 | { |
74 | } | 74 | get { return "CommanderTestModule"; } |
75 | 75 | } | |
76 | public bool IsSharedModule | 76 | |
77 | { | 77 | public bool IsSharedModule |
78 | get { return false; } | 78 | { |
79 | } | 79 | get { return false; } |
80 | 80 | } | |
81 | #endregion | 81 | |
82 | 82 | #endregion | |
83 | private void InterfaceHelloWorld(Object[] args) | 83 | |
84 | { | 84 | private void InterfaceHelloWorld(Object[] args) |
85 | Console.WriteLine("Hello World"); | 85 | { |
86 | } | 86 | Console.WriteLine("Hello World"); |
87 | } | 87 | } |
88 | } | ||
88 | } \ No newline at end of file | 89 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs index 4406e17..bd8a0f4 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs | |||
@@ -30,7 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using Nini.Config; | 31 | using Nini.Config; |
32 | using OpenSim.Region.Environment.Interfaces; | 32 | using OpenSim.Region.Environment.Interfaces; |
33 | using OpenSim.Region.Environment.Modules.Framework; | 33 | using OpenSim.Region.Environment.Modules.Framework.InterfaceCommander; |
34 | using OpenSim.Region.Environment.Scenes; | 34 | using OpenSim.Region.Environment.Scenes; |
35 | 35 | ||
36 | namespace OpenSim.Region.Environment.Modules.World.Serialiser | 36 | namespace OpenSim.Region.Environment.Modules.World.Serialiser |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index 3076b52..240ba65 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs | |||
@@ -34,7 +34,7 @@ using log4net; | |||
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Region.Environment.Interfaces; | 36 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Region.Environment.Modules.Framework; | 37 | using OpenSim.Region.Environment.Modules.Framework.InterfaceCommander; |
38 | using OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders; | 38 | using OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders; |
39 | using OpenSim.Region.Environment.Modules.World.Terrain.FloodBrushes; | 39 | using OpenSim.Region.Environment.Modules.World.Terrain.FloodBrushes; |
40 | using OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes; | 40 | using OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes; |