diff options
Diffstat (limited to 'OpenSim/Region/Application/OpenSim.cs')
-rw-r--r--[-rwxr-xr-x] | OpenSim/Region/Application/OpenSim.cs | 554 |
1 files changed, 283 insertions, 271 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 05e283e..df4dbee 100755..100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -30,12 +30,15 @@ using System.Collections; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Text; | ||
34 | using System.Text.RegularExpressions; | ||
33 | using System.Timers; | 35 | using System.Timers; |
34 | using log4net; | 36 | using log4net; |
35 | using Nini.Config; | 37 | using Nini.Config; |
36 | using OpenMetaverse; | 38 | using OpenMetaverse; |
37 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Console; | 40 | using OpenSim.Framework.Console; |
41 | using OpenSim.Framework.Servers; | ||
39 | using OpenSim.Framework.Statistics; | 42 | using OpenSim.Framework.Statistics; |
40 | using OpenSim.Region.Framework.Interfaces; | 43 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
@@ -55,6 +58,16 @@ namespace OpenSim | |||
55 | protected string m_consoleType = "local"; | 58 | protected string m_consoleType = "local"; |
56 | protected uint m_consolePort = 0; | 59 | protected uint m_consolePort = 0; |
57 | 60 | ||
61 | /// <summary> | ||
62 | /// Prompt to use for simulator command line. | ||
63 | /// </summary> | ||
64 | private string m_consolePrompt; | ||
65 | |||
66 | /// <summary> | ||
67 | /// Regex for parsing out special characters in the prompt. | ||
68 | /// </summary> | ||
69 | private Regex m_consolePromptRegex = new Regex(@"([^\\])\\(\w)", RegexOptions.Compiled); | ||
70 | |||
58 | private string m_timedScript = "disabled"; | 71 | private string m_timedScript = "disabled"; |
59 | private Timer m_scriptTimer; | 72 | private Timer m_scriptTimer; |
60 | 73 | ||
@@ -83,7 +96,9 @@ namespace OpenSim | |||
83 | 96 | ||
84 | if (networkConfig != null) | 97 | if (networkConfig != null) |
85 | m_consolePort = (uint)networkConfig.GetInt("console_port", 0); | 98 | m_consolePort = (uint)networkConfig.GetInt("console_port", 0); |
99 | |||
86 | m_timedScript = startupConfig.GetString("timer_Script", "disabled"); | 100 | m_timedScript = startupConfig.GetString("timer_Script", "disabled"); |
101 | |||
87 | if (m_logFileAppender != null) | 102 | if (m_logFileAppender != null) |
88 | { | 103 | { |
89 | if (m_logFileAppender is log4net.Appender.FileAppender) | 104 | if (m_logFileAppender is log4net.Appender.FileAppender) |
@@ -106,6 +121,7 @@ namespace OpenSim | |||
106 | Util.FireAndForgetMethod = asyncCallMethod; | 121 | Util.FireAndForgetMethod = asyncCallMethod; |
107 | 122 | ||
108 | stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15); | 123 | stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15); |
124 | m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) "); | ||
109 | } | 125 | } |
110 | 126 | ||
111 | if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) | 127 | if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) |
@@ -122,15 +138,16 @@ namespace OpenSim | |||
122 | m_log.Info("===================================================================="); | 138 | m_log.Info("===================================================================="); |
123 | m_log.Info("========================= STARTING OPENSIM ========================="); | 139 | m_log.Info("========================= STARTING OPENSIM ========================="); |
124 | m_log.Info("===================================================================="); | 140 | m_log.Info("===================================================================="); |
125 | m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode", | 141 | |
126 | (ConfigurationSettings.Standalone ? "sandbox" : "grid")); | ||
127 | //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString()); | 142 | //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString()); |
128 | // http://msdn.microsoft.com/en-us/library/bb384202.aspx | 143 | // http://msdn.microsoft.com/en-us/library/bb384202.aspx |
129 | //GCSettings.LatencyMode = GCLatencyMode.Batch; | 144 | //GCSettings.LatencyMode = GCLatencyMode.Batch; |
130 | //m_log.InfoFormat("[OPENSIM MAIN]: GC Latency Mode: {0}", GCSettings.LatencyMode.ToString()); | 145 | //m_log.InfoFormat("[OPENSIM MAIN]: GC Latency Mode: {0}", GCSettings.LatencyMode.ToString()); |
131 | 146 | ||
132 | if (m_gui) // Driven by external GUI | 147 | if (m_gui) // Driven by external GUI |
148 | { | ||
133 | m_console = new CommandConsole("Region"); | 149 | m_console = new CommandConsole("Region"); |
150 | } | ||
134 | else | 151 | else |
135 | { | 152 | { |
136 | switch (m_consoleType) | 153 | switch (m_consoleType) |
@@ -154,6 +171,11 @@ namespace OpenSim | |||
154 | 171 | ||
155 | base.StartupSpecific(); | 172 | base.StartupSpecific(); |
156 | 173 | ||
174 | MainServer.Instance.AddStreamHandler(new OpenSim.SimStatusHandler()); | ||
175 | MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this)); | ||
176 | if (userStatsURI != String.Empty) | ||
177 | MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this)); | ||
178 | |||
157 | if (m_console is RemoteConsole) | 179 | if (m_console is RemoteConsole) |
158 | { | 180 | { |
159 | if (m_consolePort == 0) | 181 | if (m_consolePort == 0) |
@@ -190,8 +212,6 @@ namespace OpenSim | |||
190 | 212 | ||
191 | PrintFileToConsole("startuplogo.txt"); | 213 | PrintFileToConsole("startuplogo.txt"); |
192 | 214 | ||
193 | m_log.InfoFormat("[NETWORK]: Using {0} as SYSTEMIP", Util.GetLocalHost().ToString()); | ||
194 | |||
195 | // For now, start at the 'root' level by default | 215 | // For now, start at the 'root' level by default |
196 | if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it | 216 | if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it |
197 | ChangeSelectedRegion("region", | 217 | ChangeSelectedRegion("region", |
@@ -205,18 +225,30 @@ namespace OpenSim | |||
205 | /// </summary> | 225 | /// </summary> |
206 | private void RegisterConsoleCommands() | 226 | private void RegisterConsoleCommands() |
207 | { | 227 | { |
208 | m_console.Commands.AddCommand("region", false, "clear assets", | ||
209 | "clear assets", | ||
210 | "Clear the asset cache", HandleClearAssets); | ||
211 | |||
212 | m_console.Commands.AddCommand("region", false, "force update", | 228 | m_console.Commands.AddCommand("region", false, "force update", |
213 | "force update", | 229 | "force update", |
214 | "Force the update of all objects on clients", | 230 | "Force the update of all objects on clients", |
215 | HandleForceUpdate); | 231 | HandleForceUpdate); |
216 | 232 | ||
217 | m_console.Commands.AddCommand("region", false, "debug packet", | 233 | m_console.Commands.AddCommand("region", false, "debug packet", |
218 | "debug packet <level>", | 234 | "debug packet <level> [<avatar-first-name> <avatar-last-name>]", |
219 | "Turn on packet debugging", Debug); | 235 | "Turn on packet debugging", |
236 | "If level > 255 then all incoming and outgoing packets are logged.\n" | ||
237 | + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" | ||
238 | + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" | ||
239 | + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" | ||
240 | + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n" | ||
241 | + "If level <= 0 then no packets are logged.\n" | ||
242 | + "If an avatar name is given then only packets from that avatar are logged", | ||
243 | Debug); | ||
244 | |||
245 | m_console.Commands.AddCommand("region", false, "debug http", | ||
246 | "debug http <level>", | ||
247 | "Turn on inbound http request debugging for everything except the event queue (see debug eq).", | ||
248 | "If level >= 2 then the handler used to service the request is logged.\n" | ||
249 | + "If level >= 1 then incoming HTTP requests are logged.\n" | ||
250 | + "If level <= 0 then no extra http logging is done.\n", | ||
251 | Debug); | ||
220 | 252 | ||
221 | m_console.Commands.AddCommand("region", false, "debug scene", | 253 | m_console.Commands.AddCommand("region", false, "debug scene", |
222 | "debug scene <cripting> <collisions> <physics>", | 254 | "debug scene <cripting> <collisions> <physics>", |
@@ -247,13 +279,26 @@ namespace OpenSim | |||
247 | "Save named prim to XML2", SavePrimsXml2); | 279 | "Save named prim to XML2", SavePrimsXml2); |
248 | 280 | ||
249 | m_console.Commands.AddCommand("region", false, "load oar", | 281 | m_console.Commands.AddCommand("region", false, "load oar", |
250 | "load oar [--merge] <oar name>", | 282 | "load oar [--merge] [--skip-assets] [<OAR path>]", |
251 | "Load a region's data from OAR archive", LoadOar); | 283 | "Load a region's data from an OAR archive.", |
284 | "--merge will merge the OAR with the existing scene." + Environment.NewLine | ||
285 | + "--skip-assets will load the OAR but ignore the assets it contains." + Environment.NewLine | ||
286 | + "The path can be either a filesystem location or a URI." | ||
287 | + " If this is not given then the command looks for an OAR named region.oar in the current directory.", | ||
288 | LoadOar); | ||
252 | 289 | ||
253 | m_console.Commands.AddCommand("region", false, "save oar", | 290 | m_console.Commands.AddCommand("region", false, "save oar", |
254 | "save oar <oar name>", | 291 | //"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]", |
255 | "Save a region's data to an OAR archive", | 292 | "save oar [-p|--profile=<url>] [--noassets] [--perm=<permissions>] [<OAR path>]", |
256 | "More information on forthcoming options here soon", SaveOar); | 293 | "Save a region's data to an OAR archive.", |
294 | // "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine | ||
295 | "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine | ||
296 | + "--noassets stops assets being saved to the OAR." + Environment.NewLine | ||
297 | + "--perm stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine | ||
298 | + " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine | ||
299 | + "The OAR path must be a filesystem path." | ||
300 | + " If this is not given then the oar is saved to region.oar in the current directory.", | ||
301 | SaveOar); | ||
257 | 302 | ||
258 | m_console.Commands.AddCommand("region", false, "edit scale", | 303 | m_console.Commands.AddCommand("region", false, "edit scale", |
259 | "edit scale <name> <x> <y> <z>", | 304 | "edit scale <name> <x> <y> <z>", |
@@ -263,21 +308,28 @@ namespace OpenSim | |||
263 | "kick user <first> <last> [message]", | 308 | "kick user <first> <last> [message]", |
264 | "Kick a user off the simulator", KickUserCommand); | 309 | "Kick a user off the simulator", KickUserCommand); |
265 | 310 | ||
266 | m_console.Commands.AddCommand("region", false, "show assets", | ||
267 | "show assets", | ||
268 | "Show asset data", HandleShow); | ||
269 | |||
270 | m_console.Commands.AddCommand("region", false, "show users", | 311 | m_console.Commands.AddCommand("region", false, "show users", |
271 | "show users [full]", | 312 | "show users [full]", |
272 | "Show user data", HandleShow); | 313 | "Show user data for users currently on the region", |
314 | "Without the 'full' option, only users actually on the region are shown." | ||
315 | + " With the 'full' option child agents of users in neighbouring regions are also shown.", | ||
316 | HandleShow); | ||
273 | 317 | ||
274 | m_console.Commands.AddCommand("region", false, "show connections", | 318 | m_console.Commands.AddCommand("region", false, "show connections", |
275 | "show connections", | 319 | "show connections", |
276 | "Show connection data", HandleShow); | 320 | "Show connection data", HandleShow); |
277 | 321 | ||
278 | m_console.Commands.AddCommand("region", false, "show users full", | 322 | m_console.Commands.AddCommand("region", false, "show circuits", |
279 | "show users full", | 323 | "show circuits", |
280 | String.Empty, HandleShow); | 324 | "Show agent circuit data", HandleShow); |
325 | |||
326 | m_console.Commands.AddCommand("region", false, "show http-handlers", | ||
327 | "show http-handlers", | ||
328 | "Show all registered http handlers", HandleShow); | ||
329 | |||
330 | m_console.Commands.AddCommand("region", false, "show pending-objects", | ||
331 | "show pending-objects", | ||
332 | "Show # of objects on the pending queues of all scene viewers", HandleShow); | ||
281 | 333 | ||
282 | m_console.Commands.AddCommand("region", false, "show modules", | 334 | m_console.Commands.AddCommand("region", false, "show modules", |
283 | "show modules", | 335 | "show modules", |
@@ -286,37 +338,47 @@ namespace OpenSim | |||
286 | m_console.Commands.AddCommand("region", false, "show regions", | 338 | m_console.Commands.AddCommand("region", false, "show regions", |
287 | "show regions", | 339 | "show regions", |
288 | "Show region data", HandleShow); | 340 | "Show region data", HandleShow); |
289 | 341 | ||
290 | m_console.Commands.AddCommand("region", false, "show queues", | ||
291 | "show queues", | ||
292 | "Show queue data", HandleShow); | ||
293 | m_console.Commands.AddCommand("region", false, "show ratings", | 342 | m_console.Commands.AddCommand("region", false, "show ratings", |
294 | "show ratings", | 343 | "show ratings", |
295 | "Show rating data", HandleShow); | 344 | "Show rating data", HandleShow); |
296 | 345 | ||
297 | m_console.Commands.AddCommand("region", false, "backup", | 346 | m_console.Commands.AddCommand("region", false, "backup", |
298 | "backup", | 347 | "backup", |
299 | "Persist objects to the database now", RunCommand); | 348 | "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand); |
300 | 349 | ||
301 | m_console.Commands.AddCommand("region", false, "create region", | 350 | m_console.Commands.AddCommand("region", false, "create region", |
302 | "create region", | 351 | "create region [\"region name\"] <region_file.ini>", |
303 | "Create a new region", HandleCreateRegion); | 352 | "Create a new region.", |
353 | "The settings for \"region name\" are read from <region_file.ini>. Paths specified with <region_file.ini> are relative to your Regions directory, unless an absolute path is given." | ||
354 | + " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine | ||
355 | + "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine | ||
356 | + "If <region_file.ini> does not exist, it will be created.", | ||
357 | HandleCreateRegion); | ||
304 | 358 | ||
305 | m_console.Commands.AddCommand("region", false, "restart", | 359 | m_console.Commands.AddCommand("region", false, "restart", |
306 | "restart", | 360 | "restart", |
307 | "Restart all sims in this instance", RunCommand); | 361 | "Restart all sims in this instance", RunCommand); |
308 | 362 | ||
309 | m_console.Commands.AddCommand("region", false, "config set", | 363 | m_console.Commands.AddCommand("region", false, "config set", |
310 | "config set <section> <field> <value>", | 364 | "config set <section> <key> <value>", |
311 | "Set a config option", HandleConfig); | 365 | "Set a config option. In most cases this is not useful since changed parameters are not dynamically reloaded. Neither do changed parameters persist - you will have to change a config file manually and restart.", HandleConfig); |
312 | 366 | ||
313 | m_console.Commands.AddCommand("region", false, "config get", | 367 | m_console.Commands.AddCommand("region", false, "config get", |
314 | "config get <section> <field>", | 368 | "config get [<section>] [<key>]", |
315 | "Read a config option", HandleConfig); | 369 | "Synonym for config show", |
370 | HandleConfig); | ||
371 | |||
372 | m_console.Commands.AddCommand("region", false, "config show", | ||
373 | "config show [<section>] [<key>]", | ||
374 | "Show config information", | ||
375 | "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine | ||
376 | + "If a section is given but not a field, then all fields in that section are printed.", | ||
377 | HandleConfig); | ||
316 | 378 | ||
317 | m_console.Commands.AddCommand("region", false, "config save", | 379 | m_console.Commands.AddCommand("region", false, "config save", |
318 | "config save", | 380 | "config save <path>", |
319 | "Save current configuration", HandleConfig); | 381 | "Save current configuration to a file at the given path", HandleConfig); |
320 | 382 | ||
321 | m_console.Commands.AddCommand("region", false, "command-script", | 383 | m_console.Commands.AddCommand("region", false, "command-script", |
322 | "command-script <script>", | 384 | "command-script <script>", |
@@ -350,25 +412,6 @@ namespace OpenSim | |||
350 | "kill uuid <UUID>", | 412 | "kill uuid <UUID>", |
351 | "Kill an object by UUID", KillUUID); | 413 | "Kill an object by UUID", KillUUID); |
352 | 414 | ||
353 | if (ConfigurationSettings.Standalone) | ||
354 | { | ||
355 | m_console.Commands.AddCommand("region", false, "create user", | ||
356 | "create user [<first> [<last> [<pass> [<x> <y> [<email>]]]]]", | ||
357 | "Create a new user", HandleCreateUser); | ||
358 | |||
359 | m_console.Commands.AddCommand("region", false, "reset user password", | ||
360 | "reset user password [<first> [<last> [<password>]]]", | ||
361 | "Reset a user password", HandleResetUserPassword); | ||
362 | } | ||
363 | |||
364 | m_console.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", | ||
365 | "Set local coordinate to map HG regions to", RunCommand); | ||
366 | m_console.Commands.AddCommand("hypergrid", false, "link-region", | ||
367 | "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", | ||
368 | "Link a hypergrid region", RunCommand); | ||
369 | m_console.Commands.AddCommand("hypergrid", false, "unlink-region", | ||
370 | "unlink-region <local name> or <HostName>:<HttpPort> <cr>", | ||
371 | "Unlink a hypergrid region", RunCommand); | ||
372 | } | 415 | } |
373 | 416 | ||
374 | public override void ShutdownSpecific() | 417 | public override void ShutdownSpecific() |
@@ -421,21 +464,21 @@ namespace OpenSim | |||
421 | 464 | ||
422 | foreach (ScenePresence presence in agents) | 465 | foreach (ScenePresence presence in agents) |
423 | { | 466 | { |
424 | RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle); | 467 | RegionInfo regionInfo = presence.Scene.RegionInfo; |
425 | 468 | ||
426 | if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) && | 469 | if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) && |
427 | presence.Lastname.ToLower().Contains(cmdparams[3].ToLower())) | 470 | presence.Lastname.ToLower().Contains(cmdparams[3].ToLower())) |
428 | { | 471 | { |
429 | MainConsole.Instance.Output( | 472 | MainConsole.Instance.Output( |
430 | String.Format( | 473 | String.Format( |
431 | "Kicking user: {0,-16}{1,-16}{2,-37} in region: {3,-16}", | 474 | "Kicking user: {0,-16} {1,-16} {2,-37} in region: {3,-16}", |
432 | presence.Firstname, presence.Lastname, presence.UUID, regionInfo.RegionName)); | 475 | presence.Firstname, presence.Lastname, presence.UUID, regionInfo.RegionName)); |
433 | 476 | ||
434 | // kick client... | 477 | // kick client... |
435 | if (alert != null) | 478 | if (alert != null) |
436 | presence.ControllingClient.Kick(alert); | 479 | presence.ControllingClient.Kick(alert); |
437 | else | 480 | else |
438 | presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n"); | 481 | presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n"); |
439 | 482 | ||
440 | // ...and close on our side | 483 | // ...and close on our side |
441 | presence.Scene.IncomingCloseAgent(presence.UUID); | 484 | presence.Scene.IncomingCloseAgent(presence.UUID); |
@@ -486,11 +529,6 @@ namespace OpenSim | |||
486 | } | 529 | } |
487 | } | 530 | } |
488 | 531 | ||
489 | private void HandleClearAssets(string module, string[] args) | ||
490 | { | ||
491 | MainConsole.Instance.Output("Not implemented."); | ||
492 | } | ||
493 | |||
494 | /// <summary> | 532 | /// <summary> |
495 | /// Force resending of all updates to all clients in active region(s) | 533 | /// Force resending of all updates to all clients in active region(s) |
496 | /// </summary> | 534 | /// </summary> |
@@ -523,41 +561,62 @@ namespace OpenSim | |||
523 | /// Creates a new region based on the parameters specified. This will ask the user questions on the console | 561 | /// Creates a new region based on the parameters specified. This will ask the user questions on the console |
524 | /// </summary> | 562 | /// </summary> |
525 | /// <param name="module"></param> | 563 | /// <param name="module"></param> |
526 | /// <param name="cmd">0,1,region name, region XML file</param> | 564 | /// <param name="cmd">0,1,region name, region ini or XML file</param> |
527 | private void HandleCreateRegion(string module, string[] cmd) | 565 | private void HandleCreateRegion(string module, string[] cmd) |
528 | { | 566 | { |
529 | if (cmd.Length < 4) | 567 | string regionName = string.Empty; |
568 | string regionFile = string.Empty; | ||
569 | |||
570 | if (cmd.Length == 3) | ||
530 | { | 571 | { |
531 | MainConsole.Instance.Output("Usage: create region <region name> <region_file.ini>"); | 572 | regionFile = cmd[2]; |
532 | return; | ||
533 | } | 573 | } |
534 | if (cmd[3].EndsWith(".xml")) | 574 | else if (cmd.Length > 3) |
535 | { | 575 | { |
536 | string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); | 576 | regionName = cmd[2]; |
537 | string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]); | 577 | regionFile = cmd[3]; |
538 | // Allow absolute and relative specifiers | 578 | } |
539 | if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith("..")) | 579 | |
540 | regionFile = cmd[3]; | 580 | string extension = Path.GetExtension(regionFile).ToLower(); |
581 | bool isXml = extension.Equals(".xml"); | ||
582 | bool isIni = extension.Equals(".ini"); | ||
541 | 583 | ||
542 | IScene scene; | 584 | if (!isXml && !isIni) |
543 | CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source), true, out scene); | 585 | { |
586 | MainConsole.Instance.Output("Usage: create region [\"region name\"] <region_file.ini>"); | ||
587 | return; | ||
544 | } | 588 | } |
545 | else if (cmd[3].EndsWith(".ini")) | 589 | |
590 | if (!Path.IsPathRooted(regionFile)) | ||
546 | { | 591 | { |
547 | string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); | 592 | string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); |
548 | string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]); | 593 | regionFile = Path.Combine(regionsDir, regionFile); |
549 | // Allow absolute and relative specifiers | 594 | } |
550 | if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith("..")) | ||
551 | regionFile = cmd[3]; | ||
552 | 595 | ||
553 | IScene scene; | 596 | RegionInfo regInfo; |
554 | CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]), true, out scene); | 597 | if (isXml) |
598 | { | ||
599 | regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source); | ||
555 | } | 600 | } |
556 | else | 601 | else |
557 | { | 602 | { |
558 | MainConsole.Instance.Output("Usage: create region <region name> <region_file.ini>"); | 603 | regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); |
604 | } | ||
605 | |||
606 | Scene existingScene; | ||
607 | if (SceneManager.TryGetScene(regInfo.RegionID, out existingScene)) | ||
608 | { | ||
609 | MainConsole.Instance.OutputFormat( | ||
610 | "ERROR: Cannot create region {0} with ID {1}, this ID is already assigned to region {2}", | ||
611 | regInfo.RegionName, regInfo.RegionID, existingScene.RegionInfo.RegionName); | ||
612 | |||
559 | return; | 613 | return; |
560 | } | 614 | } |
615 | |||
616 | PopulateRegionEstateInfo(regInfo); | ||
617 | IScene scene; | ||
618 | CreateRegion(regInfo, true, out scene); | ||
619 | regInfo.EstateSettings.Save(); | ||
561 | } | 620 | } |
562 | 621 | ||
563 | /// <summary> | 622 | /// <summary> |
@@ -570,17 +629,18 @@ namespace OpenSim | |||
570 | List<string> args = new List<string>(cmd); | 629 | List<string> args = new List<string>(cmd); |
571 | args.RemoveAt(0); | 630 | args.RemoveAt(0); |
572 | string[] cmdparams = args.ToArray(); | 631 | string[] cmdparams = args.ToArray(); |
573 | string n = "CONFIG"; | ||
574 | 632 | ||
575 | if (cmdparams.Length > 0) | 633 | if (cmdparams.Length > 0) |
576 | { | 634 | { |
577 | switch (cmdparams[0].ToLower()) | 635 | string firstParam = cmdparams[0].ToLower(); |
636 | |||
637 | switch (firstParam) | ||
578 | { | 638 | { |
579 | case "set": | 639 | case "set": |
580 | if (cmdparams.Length < 4) | 640 | if (cmdparams.Length < 4) |
581 | { | 641 | { |
582 | MainConsole.Instance.Output(String.Format("SYNTAX: {0} SET SECTION KEY VALUE",n)); | 642 | Notice("Syntax: config set <section> <key> <value>"); |
583 | MainConsole.Instance.Output(String.Format("EXAMPLE: {0} SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5",n)); | 643 | Notice("Example: config set ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); |
584 | } | 644 | } |
585 | else | 645 | else |
586 | { | 646 | { |
@@ -593,48 +653,69 @@ namespace OpenSim | |||
593 | c.Set(cmdparams[2], _value); | 653 | c.Set(cmdparams[2], _value); |
594 | m_config.Source.Merge(source); | 654 | m_config.Source.Merge(source); |
595 | 655 | ||
596 | MainConsole.Instance.Output(String.Format("{0} {0} {1} {2} {3}",n,cmdparams[1],cmdparams[2],_value)); | 656 | Notice("In section [{0}], set {1} = {2}", c.Name, cmdparams[2], _value); |
597 | } | 657 | } |
598 | } | 658 | } |
599 | break; | 659 | break; |
600 | 660 | ||
601 | case "get": | 661 | case "get": |
602 | if (cmdparams.Length < 3) | 662 | case "show": |
663 | if (cmdparams.Length == 1) | ||
603 | { | 664 | { |
604 | MainConsole.Instance.Output(String.Format("SYNTAX: {0} GET SECTION KEY",n)); | 665 | foreach (IConfig config in m_config.Source.Configs) |
605 | MainConsole.Instance.Output(String.Format("EXAMPLE: {0} GET ScriptEngine.DotNetEngine NumberOfScriptThreads",n)); | 666 | { |
667 | Notice("[{0}]", config.Name); | ||
668 | string[] keys = config.GetKeys(); | ||
669 | foreach (string key in keys) | ||
670 | Notice(" {0} = {1}", key, config.GetString(key)); | ||
671 | } | ||
606 | } | 672 | } |
607 | else | 673 | else if (cmdparams.Length == 2 || cmdparams.Length == 3) |
608 | { | 674 | { |
609 | IConfig c = m_config.Source.Configs[cmdparams[1]]; | 675 | IConfig config = m_config.Source.Configs[cmdparams[1]]; |
610 | if (c == null) | 676 | if (config == null) |
611 | { | 677 | { |
612 | MainConsole.Instance.Output(String.Format("Section \"{0}\" does not exist.",cmdparams[1])); | 678 | Notice("Section \"{0}\" does not exist.",cmdparams[1]); |
613 | break; | 679 | break; |
614 | } | 680 | } |
615 | else | 681 | else |
616 | { | 682 | { |
617 | MainConsole.Instance.Output(String.Format("{0} GET {1} {2} : {3}",n,cmdparams[1],cmdparams[2], | 683 | if (cmdparams.Length == 2) |
618 | c.GetString(cmdparams[2]))); | 684 | { |
685 | Notice("[{0}]", config.Name); | ||
686 | foreach (string key in config.GetKeys()) | ||
687 | Notice(" {0} = {1}", key, config.GetString(key)); | ||
688 | } | ||
689 | else | ||
690 | { | ||
691 | Notice( | ||
692 | "config get {0} {1} : {2}", | ||
693 | cmdparams[1], cmdparams[2], config.GetString(cmdparams[2])); | ||
694 | } | ||
619 | } | 695 | } |
620 | } | 696 | } |
697 | else | ||
698 | { | ||
699 | Notice("Syntax: config {0} [<section>] [<key>]", firstParam); | ||
700 | Notice("Example: config {0} ScriptEngine.DotNetEngine NumberOfScriptThreads", firstParam); | ||
701 | } | ||
621 | 702 | ||
622 | break; | 703 | break; |
623 | 704 | ||
624 | case "save": | 705 | case "save": |
625 | if (cmdparams.Length < 2) | 706 | if (cmdparams.Length < 2) |
626 | { | 707 | { |
627 | MainConsole.Instance.Output("SYNTAX: " + n + " SAVE FILE"); | 708 | Notice("Syntax: config save <path>"); |
628 | return; | 709 | return; |
629 | } | 710 | } |
630 | 711 | ||
631 | if (Application.iniFilePath == cmdparams[1]) | 712 | if (Application.iniFilePath == cmdparams[1]) |
632 | { | 713 | { |
633 | MainConsole.Instance.Output("FILE can not be " + Application.iniFilePath); | 714 | Notice("Path can not be " + Application.iniFilePath); |
634 | return; | 715 | return; |
635 | } | 716 | } |
636 | 717 | ||
637 | MainConsole.Instance.Output("Saving configuration file: " + cmdparams[1]); | 718 | Notice("Saving configuration file: " + cmdparams[1]); |
638 | m_config.Save(cmdparams[1]); | 719 | m_config.Save(cmdparams[1]); |
639 | break; | 720 | break; |
640 | } | 721 | } |
@@ -772,40 +853,23 @@ namespace OpenSim | |||
772 | 853 | ||
773 | string regionName = (m_sceneManager.CurrentScene == null ? "root" : m_sceneManager.CurrentScene.RegionInfo.RegionName); | 854 | string regionName = (m_sceneManager.CurrentScene == null ? "root" : m_sceneManager.CurrentScene.RegionInfo.RegionName); |
774 | MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName)); | 855 | MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName)); |
775 | m_console.DefaultPrompt = String.Format("Region ({0}) ", regionName); | ||
776 | m_console.ConsoleScene = m_sceneManager.CurrentScene; | ||
777 | } | ||
778 | 856 | ||
779 | /// <summary> | 857 | // m_log.DebugFormat("Original prompt is {0}", m_consolePrompt); |
780 | /// Execute switch for some of the create commands | 858 | string prompt = m_consolePrompt; |
781 | /// </summary> | ||
782 | /// <param name="args"></param> | ||
783 | private void HandleCreateUser(string module, string[] cmd) | ||
784 | { | ||
785 | if (ConfigurationSettings.Standalone) | ||
786 | { | ||
787 | CreateUser(cmd); | ||
788 | } | ||
789 | else | ||
790 | { | ||
791 | MainConsole.Instance.Output("Create user is not available in grid mode, use the user server."); | ||
792 | } | ||
793 | } | ||
794 | 859 | ||
795 | /// <summary> | 860 | // Replace "\R" with the region name |
796 | /// Execute switch for some of the reset commands | 861 | // Replace "\\" with "\" |
797 | /// </summary> | 862 | prompt = m_consolePromptRegex.Replace(prompt, m => |
798 | /// <param name="args"></param> | ||
799 | protected void HandleResetUserPassword(string module, string[] cmd) | ||
800 | { | ||
801 | if (ConfigurationSettings.Standalone) | ||
802 | { | 863 | { |
803 | ResetUserPassword(cmd); | 864 | // m_log.DebugFormat("Matched {0}", m.Groups[2].Value); |
804 | } | 865 | if (m.Groups[2].Value == "R") |
805 | else | 866 | return m.Groups[1].Value + regionName; |
806 | { | 867 | else |
807 | MainConsole.Instance.Output("Reset user password is not available in grid mode, use the user-server."); | 868 | return m.Groups[0].Value; |
808 | } | 869 | }); |
870 | |||
871 | m_console.DefaultPrompt = prompt; | ||
872 | m_console.ConsoleScene = m_sceneManager.CurrentScene; | ||
809 | } | 873 | } |
810 | 874 | ||
811 | /// <summary> | 875 | /// <summary> |
@@ -820,22 +884,42 @@ namespace OpenSim | |||
820 | switch (args[1]) | 884 | switch (args[1]) |
821 | { | 885 | { |
822 | case "packet": | 886 | case "packet": |
887 | string name = null; | ||
888 | if (args.Length == 5) | ||
889 | name = string.Format("{0} {1}", args[3], args[4]); | ||
890 | |||
823 | if (args.Length > 2) | 891 | if (args.Length > 2) |
824 | { | 892 | { |
825 | int newDebug; | 893 | int newDebug; |
826 | if (int.TryParse(args[2], out newDebug)) | 894 | if (int.TryParse(args[2], out newDebug)) |
827 | { | 895 | { |
828 | m_sceneManager.SetDebugPacketLevelOnCurrentScene(newDebug); | 896 | m_sceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name); |
897 | // We provide user information elsewhere if any clients had their debug level set. | ||
898 | // MainConsole.Instance.OutputFormat("Debug packet level set to {0}", newDebug); | ||
829 | } | 899 | } |
830 | else | 900 | else |
831 | { | 901 | { |
832 | MainConsole.Instance.Output("packet debug should be 0..255"); | 902 | MainConsole.Instance.Output("Usage: debug packet 0..255"); |
833 | } | 903 | } |
834 | MainConsole.Instance.Output(String.Format("New packet debug: {0}", newDebug)); | ||
835 | } | 904 | } |
836 | 905 | ||
837 | break; | 906 | break; |
838 | 907 | ||
908 | case "http": | ||
909 | if (args.Length == 3) | ||
910 | { | ||
911 | int newDebug; | ||
912 | if (int.TryParse(args[2], out newDebug)) | ||
913 | { | ||
914 | MainServer.Instance.DebugLevel = newDebug; | ||
915 | MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug); | ||
916 | break; | ||
917 | } | ||
918 | } | ||
919 | |||
920 | MainConsole.Instance.Output("Usage: debug http 0..2"); | ||
921 | break; | ||
922 | |||
839 | case "scene": | 923 | case "scene": |
840 | if (args.Length == 5) | 924 | if (args.Length == 5) |
841 | { | 925 | { |
@@ -858,13 +942,13 @@ namespace OpenSim | |||
858 | } | 942 | } |
859 | else | 943 | else |
860 | { | 944 | { |
861 | MainConsole.Instance.Output("debug scene <scripting> <collisions> <physics> (where inside <> is true/false)"); | 945 | MainConsole.Instance.Output("Usage: debug scene <scripting> <collisions> <physics> (where inside <> is true/false)"); |
862 | } | 946 | } |
863 | 947 | ||
864 | break; | 948 | break; |
865 | 949 | ||
866 | default: | 950 | default: |
867 | MainConsole.Instance.Output("Unknown debug"); | 951 | MainConsole.Instance.Output("Unknown debug command"); |
868 | break; | 952 | break; |
869 | } | 953 | } |
870 | } | 954 | } |
@@ -885,10 +969,6 @@ namespace OpenSim | |||
885 | 969 | ||
886 | switch (showParams[0]) | 970 | switch (showParams[0]) |
887 | { | 971 | { |
888 | case "assets": | ||
889 | MainConsole.Instance.Output("Not implemented."); | ||
890 | break; | ||
891 | |||
892 | case "users": | 972 | case "users": |
893 | IList agents; | 973 | IList agents; |
894 | if (showParams.Length > 1 && showParams[1] == "full") | 974 | if (showParams.Length > 1 && showParams[1] == "full") |
@@ -899,16 +979,16 @@ namespace OpenSim | |||
899 | { | 979 | { |
900 | agents = m_sceneManager.GetCurrentSceneAvatars(); | 980 | agents = m_sceneManager.GetCurrentSceneAvatars(); |
901 | } | 981 | } |
902 | 982 | ||
903 | MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count)); | 983 | MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count)); |
904 | 984 | ||
905 | MainConsole.Instance.Output( | 985 | MainConsole.Instance.Output( |
906 | String.Format("{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}{5,-30}", "Firstname", "Lastname", | 986 | String.Format("{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}", "Firstname", "Lastname", |
907 | "Agent ID", "Root/Child", "Region", "Position")); | 987 | "Agent ID", "Root/Child", "Region", "Position")); |
908 | 988 | ||
909 | foreach (ScenePresence presence in agents) | 989 | foreach (ScenePresence presence in agents) |
910 | { | 990 | { |
911 | RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle); | 991 | RegionInfo regionInfo = presence.Scene.RegionInfo; |
912 | string regionName; | 992 | string regionName; |
913 | 993 | ||
914 | if (regionInfo == null) | 994 | if (regionInfo == null) |
@@ -922,7 +1002,7 @@ namespace OpenSim | |||
922 | 1002 | ||
923 | MainConsole.Instance.Output( | 1003 | MainConsole.Instance.Output( |
924 | String.Format( | 1004 | String.Format( |
925 | "{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}{5,-30}", | 1005 | "{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}", |
926 | presence.Firstname, | 1006 | presence.Firstname, |
927 | presence.Lastname, | 1007 | presence.Lastname, |
928 | presence.UUID, | 1008 | presence.UUID, |
@@ -944,7 +1024,7 @@ namespace OpenSim | |||
944 | { | 1024 | { |
945 | connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n", | 1025 | connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n", |
946 | scene.RegionInfo.RegionName, client.Name, client.AgentId, client.RemoteEndPoint, client.CircuitCode); | 1026 | scene.RegionInfo.RegionName, client.Name, client.AgentId, client.RemoteEndPoint, client.CircuitCode); |
947 | }, false | 1027 | } |
948 | ); | 1028 | ); |
949 | } | 1029 | } |
950 | ); | 1030 | ); |
@@ -952,6 +1032,48 @@ namespace OpenSim | |||
952 | MainConsole.Instance.Output(connections.ToString()); | 1032 | MainConsole.Instance.Output(connections.ToString()); |
953 | break; | 1033 | break; |
954 | 1034 | ||
1035 | case "circuits": | ||
1036 | System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n"); | ||
1037 | m_sceneManager.ForEachScene( | ||
1038 | delegate(Scene scene) | ||
1039 | { | ||
1040 | //this.HttpServer. | ||
1041 | acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName); | ||
1042 | foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.GetAgentCircuits().Values) | ||
1043 | acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root")); | ||
1044 | } | ||
1045 | ); | ||
1046 | |||
1047 | MainConsole.Instance.Output(acd.ToString()); | ||
1048 | break; | ||
1049 | |||
1050 | case "http-handlers": | ||
1051 | System.Text.StringBuilder handlers = new System.Text.StringBuilder("Registered HTTP Handlers:\n"); | ||
1052 | |||
1053 | handlers.AppendFormat("* XMLRPC:\n"); | ||
1054 | foreach (String s in HttpServer.GetXmlRpcHandlerKeys()) | ||
1055 | handlers.AppendFormat("\t{0}\n", s); | ||
1056 | |||
1057 | handlers.AppendFormat("* HTTP:\n"); | ||
1058 | List<String> poll = HttpServer.GetPollServiceHandlerKeys(); | ||
1059 | foreach (String s in HttpServer.GetHTTPHandlerKeys()) | ||
1060 | handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); | ||
1061 | |||
1062 | handlers.AppendFormat("* Agent:\n"); | ||
1063 | foreach (String s in HttpServer.GetAgentHandlerKeys()) | ||
1064 | handlers.AppendFormat("\t{0}\n", s); | ||
1065 | |||
1066 | handlers.AppendFormat("* LLSD:\n"); | ||
1067 | foreach (String s in HttpServer.GetLLSDHandlerKeys()) | ||
1068 | handlers.AppendFormat("\t{0}\n", s); | ||
1069 | |||
1070 | handlers.AppendFormat("* StreamHandlers ({0}):\n", HttpServer.GetStreamHandlerKeys().Count); | ||
1071 | foreach (String s in HttpServer.GetStreamHandlerKeys()) | ||
1072 | handlers.AppendFormat("\t{0}\n", s); | ||
1073 | |||
1074 | MainConsole.Instance.Output(handlers.ToString()); | ||
1075 | break; | ||
1076 | |||
955 | case "modules": | 1077 | case "modules": |
956 | MainConsole.Instance.Output("The currently loaded shared modules are:"); | 1078 | MainConsole.Instance.Output("The currently loaded shared modules are:"); |
957 | foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) | 1079 | foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) |
@@ -959,6 +1081,19 @@ namespace OpenSim | |||
959 | MainConsole.Instance.Output("Shared Module: " + module.Name); | 1081 | MainConsole.Instance.Output("Shared Module: " + module.Name); |
960 | } | 1082 | } |
961 | 1083 | ||
1084 | m_sceneManager.ForEachScene( | ||
1085 | delegate(Scene scene) | ||
1086 | { | ||
1087 | m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:"); | ||
1088 | foreach (IRegionModule module in scene.Modules.Values) | ||
1089 | { | ||
1090 | if (!module.IsSharedModule) | ||
1091 | { | ||
1092 | m_log.Error("Region Module: " + module.Name); | ||
1093 | } | ||
1094 | } | ||
1095 | }); | ||
1096 | |||
962 | MainConsole.Instance.Output(""); | 1097 | MainConsole.Instance.Output(""); |
963 | break; | 1098 | break; |
964 | 1099 | ||
@@ -967,18 +1102,15 @@ namespace OpenSim | |||
967 | delegate(Scene scene) | 1102 | delegate(Scene scene) |
968 | { | 1103 | { |
969 | MainConsole.Instance.Output(String.Format( | 1104 | MainConsole.Instance.Output(String.Format( |
970 | "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}", | 1105 | "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}, Estate Name: {4}", |
971 | scene.RegionInfo.RegionName, | 1106 | scene.RegionInfo.RegionName, |
972 | scene.RegionInfo.RegionLocX, | 1107 | scene.RegionInfo.RegionLocX, |
973 | scene.RegionInfo.RegionLocY, | 1108 | scene.RegionInfo.RegionLocY, |
974 | scene.RegionInfo.InternalEndPoint.Port)); | 1109 | scene.RegionInfo.InternalEndPoint.Port, |
1110 | scene.RegionInfo.EstateSettings.EstateName)); | ||
975 | }); | 1111 | }); |
976 | break; | 1112 | break; |
977 | 1113 | ||
978 | case "queues": | ||
979 | Notice(GetQueuesReport()); | ||
980 | break; | ||
981 | |||
982 | case "ratings": | 1114 | case "ratings": |
983 | m_sceneManager.ForEachScene( | 1115 | m_sceneManager.ForEachScene( |
984 | delegate(Scene scene) | 1116 | delegate(Scene scene) |
@@ -1006,126 +1138,6 @@ namespace OpenSim | |||
1006 | } | 1138 | } |
1007 | 1139 | ||
1008 | /// <summary> | 1140 | /// <summary> |
1009 | /// print UDP Queue data for each client | ||
1010 | /// </summary> | ||
1011 | /// <returns></returns> | ||
1012 | private string GetQueuesReport() | ||
1013 | { | ||
1014 | string report = String.Empty; | ||
1015 | |||
1016 | m_sceneManager.ForEachScene(delegate(Scene scene) | ||
1017 | { | ||
1018 | scene.ForEachClient(delegate(IClientAPI client) | ||
1019 | { | ||
1020 | if (client is IStatsCollector) | ||
1021 | { | ||
1022 | report = report + client.FirstName + | ||
1023 | " " + client.LastName; | ||
1024 | |||
1025 | IStatsCollector stats = | ||
1026 | (IStatsCollector) client; | ||
1027 | |||
1028 | report = report + string.Format("{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}\n", | ||
1029 | "Send", | ||
1030 | "In", | ||
1031 | "Out", | ||
1032 | "Resend", | ||
1033 | "Land", | ||
1034 | "Wind", | ||
1035 | "Cloud", | ||
1036 | "Task", | ||
1037 | "Texture", | ||
1038 | "Asset"); | ||
1039 | report = report + stats.Report() + | ||
1040 | "\n"; | ||
1041 | } | ||
1042 | }); | ||
1043 | }); | ||
1044 | |||
1045 | return report; | ||
1046 | } | ||
1047 | |||
1048 | /// <summary> | ||
1049 | /// Create a new user | ||
1050 | /// </summary> | ||
1051 | /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param> | ||
1052 | protected void CreateUser(string[] cmdparams) | ||
1053 | { | ||
1054 | string firstName; | ||
1055 | string lastName; | ||
1056 | string password; | ||
1057 | string email; | ||
1058 | uint regX = 1000; | ||
1059 | uint regY = 1000; | ||
1060 | |||
1061 | IConfig standalone; | ||
1062 | if ((standalone = m_config.Source.Configs["StandAlone"]) != null) | ||
1063 | { | ||
1064 | regX = (uint)standalone.GetInt("default_location_x", (int)regX); | ||
1065 | regY = (uint)standalone.GetInt("default_location_y", (int)regY); | ||
1066 | } | ||
1067 | |||
1068 | |||
1069 | if (cmdparams.Length < 3) | ||
1070 | firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); | ||
1071 | else firstName = cmdparams[2]; | ||
1072 | |||
1073 | if (cmdparams.Length < 4) | ||
1074 | lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); | ||
1075 | else lastName = cmdparams[3]; | ||
1076 | |||
1077 | if (cmdparams.Length < 5) | ||
1078 | password = MainConsole.Instance.PasswdPrompt("Password"); | ||
1079 | else password = cmdparams[4]; | ||
1080 | |||
1081 | if (cmdparams.Length < 6) | ||
1082 | regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString())); | ||
1083 | else regX = Convert.ToUInt32(cmdparams[5]); | ||
1084 | |||
1085 | if (cmdparams.Length < 7) | ||
1086 | regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString())); | ||
1087 | else regY = Convert.ToUInt32(cmdparams[6]); | ||
1088 | |||
1089 | if (cmdparams.Length < 8) | ||
1090 | email = MainConsole.Instance.CmdPrompt("Email", ""); | ||
1091 | else email = cmdparams[7]; | ||
1092 | |||
1093 | if (null == m_commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName)) | ||
1094 | { | ||
1095 | m_commsManager.UserAdminService.AddUser(firstName, lastName, password, email, regX, regY); | ||
1096 | } | ||
1097 | else | ||
1098 | { | ||
1099 | MainConsole.Instance.Output(string.Format("A user with the name {0} {1} already exists!", firstName, lastName)); | ||
1100 | } | ||
1101 | } | ||
1102 | |||
1103 | /// <summary> | ||
1104 | /// Reset a user password. | ||
1105 | /// </summary> | ||
1106 | /// <param name="cmdparams"></param> | ||
1107 | private void ResetUserPassword(string[] cmdparams) | ||
1108 | { | ||
1109 | string firstName; | ||
1110 | string lastName; | ||
1111 | string newPassword; | ||
1112 | |||
1113 | if (cmdparams.Length < 4) | ||
1114 | firstName = MainConsole.Instance.CmdPrompt("First name"); | ||
1115 | else firstName = cmdparams[3]; | ||
1116 | |||
1117 | if (cmdparams.Length < 5) | ||
1118 | lastName = MainConsole.Instance.CmdPrompt("Last name"); | ||
1119 | else lastName = cmdparams[4]; | ||
1120 | |||
1121 | if (cmdparams.Length < 6) | ||
1122 | newPassword = MainConsole.Instance.PasswdPrompt("New password"); | ||
1123 | else newPassword = cmdparams[5]; | ||
1124 | |||
1125 | m_commsManager.UserAdminService.ResetUserPassword(firstName, lastName, newPassword); | ||
1126 | } | ||
1127 | |||
1128 | /// <summary> | ||
1129 | /// Use XML2 format to serialize data to a file | 1141 | /// Use XML2 format to serialize data to a file |
1130 | /// </summary> | 1142 | /// </summary> |
1131 | /// <param name="module"></param> | 1143 | /// <param name="module"></param> |