OpenSimMainConsole.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSim Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  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
  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
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections;
  29. using System.Collections.Generic;
  30. using System.IO;
  31. using System.Net;
  32. using System.Reflection;
  33. using System.Threading;
  34. using libsecondlife;
  35. using log4net;
  36. using Nini.Config;
  37. using OpenSim.Framework;
  38. using OpenSim.Framework.Console;
  39. using OpenSim.Framework.Statistics;
  40. using OpenSim.Region.Environment.Interfaces;
  41. using OpenSim.Region.Environment.Scenes;
  42. using Timer=System.Timers.Timer;
  43. namespace OpenSim
  44. {
  45. public delegate void ConsoleCommand(string[] comParams);
  46. public class OpenSimMainConsole : OpenSimMain, conscmd_callback
  47. {
  48. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  49. protected string m_startupCommandsFile;
  50. protected string m_shutdownCommandsFile;
  51. private string m_timedScript = "disabled";
  52. private Timer m_scriptTimer;
  53. public OpenSimMainConsole(IConfigSource configSource)
  54. : base(configSource)
  55. {
  56. }
  57. protected override void ReadConfigSettings()
  58. {
  59. IConfig startupConfig = m_config.Configs["Startup"];
  60. if (startupConfig != null)
  61. {
  62. m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", String.Empty);
  63. m_shutdownCommandsFile = startupConfig.GetString("shutdown_console_commands_file", String.Empty);
  64. m_timedScript = startupConfig.GetString("timer_Script", "disabled");
  65. }
  66. base.ReadConfigSettings();
  67. }
  68. /// <summary>
  69. /// Performs initialisation of the scene, such as loading configuration from disk.
  70. /// </summary>
  71. public override void StartUp()
  72. {
  73. //
  74. // Called from app startup (OpenSim.Application)
  75. //
  76. m_log.Info("====================================================================");
  77. m_log.Info("========================= STARTING OPENSIM =========================");
  78. m_log.Info("====================================================================");
  79. m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode", (m_sandbox ? "sandbox" : "grid"));
  80. m_console = CreateConsole();
  81. MainConsole.Instance = m_console;
  82. InternalStartUp();
  83. //Run Startup Commands
  84. if (m_startupCommandsFile != String.Empty)
  85. {
  86. RunCommandScript(m_startupCommandsFile);
  87. }
  88. else
  89. {
  90. m_log.Info("[STARTUP]: No startup command script specified. Moving on...");
  91. }
  92. // Start timer script (run a script every xx seconds)
  93. if (m_timedScript != "disabled")
  94. {
  95. m_scriptTimer = new Timer();
  96. m_scriptTimer.Enabled = true;
  97. m_scriptTimer.Interval = 1200 * 1000;
  98. m_scriptTimer.Elapsed += RunAutoTimerScript;
  99. }
  100. PrintFileToConsole("startuplogo.txt");
  101. }
  102. protected ConsoleBase CreateConsole()
  103. {
  104. return new ConsoleBase("Region", this);
  105. }
  106. private void RunAutoTimerScript(object sender, EventArgs e)
  107. {
  108. if (m_timedScript != "disabled")
  109. {
  110. RunCommandScript(m_timedScript);
  111. }
  112. }
  113. #region Console Commands
  114. /// <summary>
  115. ///
  116. /// </summary>
  117. /// <param name="fileName"></param>
  118. private void RunCommandScript(string fileName)
  119. {
  120. m_log.Info("[COMMANDFILE]: Running " + fileName);
  121. if (File.Exists(fileName))
  122. {
  123. StreamReader readFile = File.OpenText(fileName);
  124. string currentCommand;
  125. while ((currentCommand = readFile.ReadLine()) != null)
  126. {
  127. if (currentCommand != String.Empty)
  128. {
  129. m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'");
  130. m_console.RunCommand(currentCommand);
  131. }
  132. }
  133. }
  134. else
  135. {
  136. m_log.Error("[COMMANDFILE]: Command script missing. Can not run commands");
  137. }
  138. }
  139. private static void PrintFileToConsole(string fileName)
  140. {
  141. if (File.Exists(fileName))
  142. {
  143. StreamReader readFile = File.OpenText(fileName);
  144. string currentLine;
  145. while ((currentLine = readFile.ReadLine()) != null)
  146. {
  147. m_log.Info("[!]" + currentLine);
  148. }
  149. }
  150. }
  151. /// <summary>
  152. /// Runs commands issued by the server console from the operator
  153. /// </summary>
  154. /// <param name="command">The first argument of the parameter (the command)</param>
  155. /// <param name="cmdparams">Additional arguments passed to the command</param>
  156. public override void RunCmd(string command, string[] cmdparams)
  157. {
  158. base.RunCmd(command, cmdparams);
  159. switch (command)
  160. {
  161. case "clear-assets":
  162. m_assetCache.Clear();
  163. break;
  164. case "set-time":
  165. m_sceneManager.SetCurrentSceneTimePhase(Convert.ToInt32(cmdparams[0]));
  166. break;
  167. case "force-update":
  168. m_console.Notice("Updating all clients");
  169. m_sceneManager.ForceCurrentSceneClientUpdate();
  170. break;
  171. case "edit-scale":
  172. if (cmdparams.Length == 4)
  173. {
  174. m_sceneManager.HandleEditCommandOnCurrentScene(cmdparams);
  175. }
  176. break;
  177. case "debug":
  178. if (cmdparams.Length > 0)
  179. {
  180. Debug(cmdparams);
  181. }
  182. break;
  183. case "scene-debug":
  184. if (cmdparams.Length == 3)
  185. {
  186. if (m_sceneManager.CurrentScene == null)
  187. {
  188. m_console.Error("CONSOLE", "Please use 'change-region <regioname>' first");
  189. }
  190. else
  191. {
  192. m_sceneManager.CurrentScene.SetSceneCoreDebug(!Convert.ToBoolean(cmdparams[0]), !Convert.ToBoolean(cmdparams[1]), !Convert.ToBoolean(cmdparams[2]));
  193. }
  194. }
  195. else
  196. {
  197. m_console.Error("scene-debug <scripting> <collisions> <physics> (where inside <> is true/false)");
  198. }
  199. break;
  200. case "help":
  201. m_console.Notice("alert - send alert to a designated user or all users.");
  202. m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive.");
  203. m_console.Notice(" alert general [Message] - send an alert to all users.");
  204. m_console.Notice("backup - trigger a simulator backup");
  205. m_console.Notice("clear-assets - clear asset cache");
  206. m_console.Notice("create-region <name> <regionfile.xml> - creates a new region");
  207. m_console.Notice("create user - adds a new user.");
  208. m_console.Notice("change-region [name] - sets the region that many of these commands affect.");
  209. m_console.Notice("command-script [filename] - Execute command in a file.");
  210. m_console.Notice("debug - debugging commands");
  211. m_console.Notice(" packet 0..255 - print incoming/outgoing packets (0=off)");
  212. m_console.Notice("scene-debug [scripting] [collision] [physics] - Enable/Disable debug stuff, each can be True/False");
  213. m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim");
  214. m_console.Notice("export-map [filename] - save image of world map");
  215. m_console.Notice("force-update - force an update of prims in the scene");
  216. m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)");
  217. m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format");
  218. m_console.Notice("restart - disconnects all clients and restarts the sims in the instance.");
  219. m_console.Notice("remove-region [name] - remove a region");
  220. m_console.Notice("save-xml [filename] - save prims to XML (DEPRECATED)");
  221. m_console.Notice("save-xml2 [filename] - save prims to XML using version 2 format");
  222. m_console.Notice("script - manually trigger scripts? or script commands?");
  223. m_console.Notice("set-time [x] - set the current scene time phase");
  224. m_console.Notice("show assets - show state of asset cache.");
  225. m_console.Notice("show users - show info about connected users.");
  226. m_console.Notice("show modules - shows info about loaded modules.");
  227. m_console.Notice("show version - show the running build version.");
  228. m_console.Notice("show regions - show running region information.");
  229. m_console.Notice("threads - list threads");
  230. m_console.Notice("config set section field value - set a config value");
  231. m_console.Notice("config get section field - get a config value");
  232. m_console.Notice("config save - save OpenSim.ini");
  233. m_console.Notice("terrain help - show help for terrain commands.");
  234. break;
  235. case "threads":
  236. // m_console.Notice("THREAD", Process.GetCurrentProcess().Threads.Count + " threads running:");
  237. // int _tc = 0;
  238. // foreach (ProcessThread pt in Process.GetCurrentProcess().Threads)
  239. // {
  240. // _tc++;
  241. // m_console.Notice("THREAD", _tc + ": ID: " + pt.Id + ", Started: " + pt.StartTime.ToString() + ", CPU time: " + pt.TotalProcessorTime + ", Pri: " + pt.BasePriority.ToString() + ", State: " + pt.ThreadState.ToString());
  242. // }
  243. List<Thread> threads = ThreadTracker.GetThreads();
  244. if (threads == null)
  245. {
  246. m_console.Notice("THREAD", "Thread tracking is only enabled in DEBUG mode.");
  247. }
  248. else
  249. {
  250. int _tc = 0;
  251. m_console.Notice("THREAD", threads.Count + " threads are being tracked:");
  252. foreach (Thread t in threads)
  253. {
  254. _tc++;
  255. m_console.Notice("THREAD", _tc + ": ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString());
  256. }
  257. }
  258. break;
  259. case "save-xml":
  260. m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason.");
  261. if (cmdparams.Length > 0)
  262. {
  263. m_sceneManager.SaveCurrentSceneToXml(cmdparams[0]);
  264. }
  265. else
  266. {
  267. m_sceneManager.SaveCurrentSceneToXml(DEFAULT_PRIM_BACKUP_FILENAME);
  268. }
  269. break;
  270. case "load-xml":
  271. m_log.Error("[CONSOLE]: PLEASE NOTE, load-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use load-xml2, please file a mantis detailing the reason.");
  272. LLVector3 loadOffset = new LLVector3(0, 0, 0);
  273. if (cmdparams.Length > 0)
  274. {
  275. bool generateNewIDS = false;
  276. if (cmdparams.Length > 1)
  277. {
  278. if (cmdparams[1] == "-newUID")
  279. {
  280. generateNewIDS = true;
  281. }
  282. if (cmdparams.Length > 2)
  283. {
  284. loadOffset.X = (float) Convert.ToDecimal(cmdparams[2]);
  285. if (cmdparams.Length > 3)
  286. {
  287. loadOffset.Y = (float) Convert.ToDecimal(cmdparams[3]);
  288. }
  289. if (cmdparams.Length > 4)
  290. {
  291. loadOffset.Z = (float) Convert.ToDecimal(cmdparams[4]);
  292. }
  293. m_console.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," +
  294. loadOffset.Z + ">");
  295. }
  296. }
  297. m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset);
  298. }
  299. else
  300. {
  301. m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false, loadOffset);
  302. }
  303. break;
  304. case "save-xml2":
  305. if (cmdparams.Length > 0)
  306. {
  307. m_sceneManager.SaveCurrentSceneToXml2(cmdparams[0]);
  308. }
  309. else
  310. {
  311. m_sceneManager.SaveCurrentSceneToXml2(DEFAULT_PRIM_BACKUP_FILENAME);
  312. }
  313. break;
  314. case "load-xml2":
  315. if (cmdparams.Length > 0)
  316. {
  317. m_sceneManager.LoadCurrentSceneFromXml2(cmdparams[0]);
  318. }
  319. else
  320. {
  321. m_sceneManager.LoadCurrentSceneFromXml2(DEFAULT_PRIM_BACKUP_FILENAME);
  322. }
  323. break;
  324. case "load-oar":
  325. m_log.Error("[CONSOLE]: Don't use me - I haven't yet been sufficiently implemented!");
  326. if (cmdparams.Length > 0)
  327. {
  328. m_sceneManager.LoadArchiveToCurrentScene(cmdparams[0]);
  329. }
  330. else
  331. {
  332. m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME);
  333. }
  334. break;
  335. case "save-oar":
  336. m_log.Error("[CONSOLE]: Don't use me - I haven't yet been sufficiently implemented!");
  337. if (cmdparams.Length > 0)
  338. {
  339. m_sceneManager.SaveCurrentSceneToArchive(cmdparams[0]);
  340. }
  341. else
  342. {
  343. m_sceneManager.SaveCurrentSceneToArchive(DEFAULT_OAR_BACKUP_FILENAME);
  344. }
  345. break;
  346. case "plugin":
  347. m_sceneManager.SendCommandToPluginModules(cmdparams);
  348. break;
  349. case "command-script":
  350. if (cmdparams.Length > 0)
  351. {
  352. RunCommandScript(cmdparams[0]);
  353. }
  354. break;
  355. case "backup":
  356. m_sceneManager.BackupCurrentScene();
  357. break;
  358. case "alert":
  359. m_sceneManager.HandleAlertCommandOnCurrentScene(cmdparams);
  360. break;
  361. case "create":
  362. CreateAccount(cmdparams);
  363. break;
  364. case "create-region":
  365. CreateRegion(new RegionInfo(cmdparams[0], "Regions/" + cmdparams[1],false), true);
  366. break;
  367. case "remove-region":
  368. string regName = CombineParams(cmdparams, 0);
  369. Scene killScene;
  370. if (m_sceneManager.TryGetScene(regName, out killScene))
  371. {
  372. // only need to check this if we are not at the
  373. // root level
  374. if ((m_sceneManager.CurrentScene != null) &&
  375. (m_sceneManager.CurrentScene.RegionInfo.RegionID == killScene.RegionInfo.RegionID))
  376. {
  377. m_sceneManager.TrySetCurrentScene("..");
  378. }
  379. m_regionData.Remove(killScene.RegionInfo);
  380. m_sceneManager.CloseScene(killScene);
  381. }
  382. break;
  383. case "restart":
  384. m_sceneManager.RestartCurrentScene();
  385. break;
  386. case "change-region":
  387. if (cmdparams.Length > 0)
  388. {
  389. string regionName = CombineParams(cmdparams, 0);
  390. if (!m_sceneManager.TrySetCurrentScene(regionName))
  391. {
  392. m_console.Error("Couldn't set current region to: " + regionName);
  393. }
  394. }
  395. if (m_sceneManager.CurrentScene == null)
  396. {
  397. m_console.Error("CONSOLE", "Currently at Root level. To change region please use 'change-region <regioname>'");
  398. }
  399. else
  400. {
  401. m_console.Error("CONSOLE", "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName +
  402. ". To change region please use 'change-region <regioname>'");
  403. }
  404. break;
  405. case "export-map":
  406. if (cmdparams.Length > 0)
  407. {
  408. m_sceneManager.CurrentOrFirstScene.ExportWorldMap(cmdparams[0]);
  409. }
  410. else
  411. {
  412. m_sceneManager.CurrentOrFirstScene.ExportWorldMap("exportmap.jpg");
  413. }
  414. break;
  415. case "config":
  416. string n = command.ToUpper();
  417. if (cmdparams.Length > 0)
  418. {
  419. switch (cmdparams[0].ToLower())
  420. {
  421. case "set":
  422. if (cmdparams.Length < 4)
  423. {
  424. m_console.Error(n, "SYNTAX: " + n + " SET SECTION KEY VALUE");
  425. m_console.Error(n, "EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5");
  426. }
  427. else
  428. {
  429. IConfig c = DefaultConfig().Configs[cmdparams[1]];
  430. if (c == null)
  431. c = DefaultConfig().AddConfig(cmdparams[1]);
  432. string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3);
  433. c.Set(cmdparams[2], _value);
  434. m_config.Merge(c.ConfigSource);
  435. m_console.Error(n, n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " +
  436. _value);
  437. }
  438. break;
  439. case "get":
  440. if (cmdparams.Length < 3)
  441. {
  442. m_console.Error(n, "SYNTAX: " + n + " GET SECTION KEY");
  443. m_console.Error(n, "EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads");
  444. }
  445. else
  446. {
  447. IConfig c = DefaultConfig().Configs[cmdparams[1]];
  448. if (c == null)
  449. {
  450. m_console.Notice(n, "Section \"" + cmdparams[1] + "\" does not exist.");
  451. break;
  452. }
  453. else
  454. {
  455. m_console.Notice(n + " GET " + cmdparams[1] + " " + cmdparams[2] + ": " +
  456. c.GetString(cmdparams[2]));
  457. }
  458. }
  459. break;
  460. case "save":
  461. m_console.Notice("Saving configuration file: " + Application.iniFilePath);
  462. m_config.Save(Application.iniFilePath);
  463. break;
  464. }
  465. }
  466. break;
  467. case "modules":
  468. if (cmdparams.Length > 0)
  469. {
  470. switch (cmdparams[0].ToLower())
  471. {
  472. case "list":
  473. foreach (IRegionModule irm in m_moduleLoader.GetLoadedSharedModules)
  474. {
  475. m_console.Notice("Shared region module: " + irm.Name);
  476. }
  477. break;
  478. case "unload":
  479. if (cmdparams.Length > 1)
  480. {
  481. foreach (IRegionModule rm in new ArrayList(m_moduleLoader.GetLoadedSharedModules))
  482. {
  483. if (rm.Name.ToLower() == cmdparams[1].ToLower())
  484. {
  485. m_console.Notice("Unloading module: " + rm.Name);
  486. m_moduleLoader.UnloadModule(rm);
  487. }
  488. }
  489. }
  490. break;
  491. case "load":
  492. if (cmdparams.Length > 1)
  493. {
  494. foreach (Scene s in new ArrayList(m_sceneManager.Scenes))
  495. {
  496. m_console.Notice("Loading module: " + cmdparams[1]);
  497. m_moduleLoader.LoadRegionModules(cmdparams[1], s);
  498. }
  499. }
  500. break;
  501. }
  502. }
  503. break;
  504. default:
  505. string[] tmpPluginArgs = new string[cmdparams.Length + 1];
  506. cmdparams.CopyTo(tmpPluginArgs, 1);
  507. tmpPluginArgs[0] = command;
  508. m_sceneManager.SendCommandToPluginModules(tmpPluginArgs);
  509. break;
  510. }
  511. }
  512. public void Debug(string[] args)
  513. {
  514. switch (args[0])
  515. {
  516. case "packet":
  517. if (args.Length > 1)
  518. {
  519. int newDebug;
  520. if (int.TryParse(args[1], out newDebug))
  521. {
  522. m_sceneManager.SetDebugPacketOnCurrentScene(newDebug);
  523. }
  524. else
  525. {
  526. m_console.Error("packet debug should be 0..2");
  527. }
  528. m_console.Notice("New packet debug: " + newDebug.ToString());
  529. }
  530. break;
  531. default:
  532. m_console.Error("Unknown debug");
  533. break;
  534. }
  535. }
  536. // see BaseOpenSimServer
  537. public override void Show(string ShowWhat)
  538. {
  539. base.Show(ShowWhat);
  540. switch (ShowWhat)
  541. {
  542. case "assets":
  543. m_assetCache.ShowState();
  544. break;
  545. case "users":
  546. IList agents = m_sceneManager.GetCurrentSceneAvatars();
  547. m_console.Notice(String.Format("\nAgents connected: {0}\n", agents.Count));
  548. m_console.Notice(
  549. String.Format("{0,-16}{1,-16}{2,-37}{3,-16}", "Firstname", "Lastname",
  550. "Agent ID","Region"));
  551. foreach (ScenePresence presence in agents)
  552. {
  553. RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle);
  554. string regionName;
  555. System.Net.EndPoint ep = null;
  556. if (regionInfo == null)
  557. {
  558. regionName = "Unresolvable";
  559. }
  560. else
  561. {
  562. regionName = regionInfo.RegionName;
  563. }
  564. m_console.Notice(
  565. String.Format(
  566. "{0,-16}{1,-16}{2,-37}{3,-16}",
  567. presence.Firstname,
  568. presence.Lastname,
  569. presence.UUID,
  570. regionName));
  571. }
  572. m_console.Notice("");
  573. break;
  574. case "modules":
  575. m_console.Notice("The currently loaded shared modules are:");
  576. foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
  577. {
  578. m_console.Notice("Shared Module: " + module.Name);
  579. }
  580. break;
  581. case "regions":
  582. m_sceneManager.ForEachScene(
  583. delegate(Scene scene)
  584. {
  585. m_console.Notice("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " +
  586. scene.RegionInfo.RegionLocX + " , Region YLoc: " +
  587. scene.RegionInfo.RegionLocY);
  588. });
  589. break;
  590. case "version":
  591. if (!string.IsNullOrEmpty(buildVersion))
  592. {
  593. m_console.Notice("The build version is: r" + buildVersion);
  594. }
  595. else
  596. {
  597. m_console.Notice("The build version is not available");
  598. }
  599. break;
  600. }
  601. }
  602. private static string CombineParams(string[] commandParams, int pos)
  603. {
  604. string result = String.Empty;
  605. for (int i = pos; i < commandParams.Length; i++)
  606. {
  607. result += commandParams[i] + " ";
  608. }
  609. result = result.TrimEnd(' ');
  610. return result;
  611. }
  612. #endregion
  613. }
  614. }