OpenSim.cs 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321
  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 OpenSimulator 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.Reflection;
  32. using System.Timers;
  33. using log4net;
  34. using Nini.Config;
  35. using OpenMetaverse;
  36. using OpenSim.Framework;
  37. using OpenSim.Framework.Console;
  38. using OpenSim.Framework.Statistics;
  39. using OpenSim.Region.Framework.Interfaces;
  40. using OpenSim.Region.Framework.Scenes;
  41. namespace OpenSim
  42. {
  43. /// <summary>
  44. /// Interactive OpenSim region server
  45. /// </summary>
  46. public class OpenSim : OpenSimBase
  47. {
  48. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  49. protected string m_startupCommandsFile;
  50. protected string m_shutdownCommandsFile;
  51. protected bool m_gui = false;
  52. protected string m_consoleType = "local";
  53. private string m_timedScript = "disabled";
  54. private Timer m_scriptTimer;
  55. public OpenSim(IConfigSource configSource) : base(configSource)
  56. {
  57. }
  58. protected override void ReadExtraConfigSettings()
  59. {
  60. base.ReadExtraConfigSettings();
  61. IConfig startupConfig = m_config.Source.Configs["Startup"];
  62. Util.SetMaxThreads(startupConfig.GetInt("MaxPoolThreads", 15));
  63. if (startupConfig != null)
  64. {
  65. m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", "startup_commands.txt");
  66. m_shutdownCommandsFile = startupConfig.GetString("shutdown_console_commands_file", "shutdown_commands.txt");
  67. if (startupConfig.GetString("console", String.Empty) == String.Empty)
  68. m_gui = startupConfig.GetBoolean("gui", false);
  69. else
  70. m_consoleType= startupConfig.GetString("console", String.Empty);
  71. m_timedScript = startupConfig.GetString("timer_Script", "disabled");
  72. if (m_logFileAppender != null)
  73. {
  74. if (m_logFileAppender is log4net.Appender.FileAppender)
  75. {
  76. log4net.Appender.FileAppender appender =
  77. (log4net.Appender.FileAppender)m_logFileAppender;
  78. string fileName = startupConfig.GetString("LogFile", String.Empty);
  79. if (fileName != String.Empty)
  80. {
  81. appender.File = fileName;
  82. appender.ActivateOptions();
  83. }
  84. m_log.InfoFormat("[LOGGING]: Logging started to file {0}", appender.File);
  85. }
  86. }
  87. string asyncCallMethodStr = startupConfig.GetString("async_call_method", String.Empty);
  88. FireAndForgetMethod asyncCallMethod;
  89. if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod))
  90. Util.FireAndForgetMethod = asyncCallMethod;
  91. }
  92. m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod);
  93. }
  94. /// <summary>
  95. /// Performs initialisation of the scene, such as loading configuration from disk.
  96. /// </summary>
  97. protected override void StartupSpecific()
  98. {
  99. m_log.Info("====================================================================");
  100. m_log.Info("========================= STARTING OPENSIM =========================");
  101. m_log.Info("====================================================================");
  102. m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode",
  103. (ConfigurationSettings.Standalone ? "sandbox" : "grid"));
  104. //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
  105. // http://msdn.microsoft.com/en-us/library/bb384202.aspx
  106. //GCSettings.LatencyMode = GCLatencyMode.Batch;
  107. //m_log.InfoFormat("[OPENSIM MAIN]: GC Latency Mode: {0}", GCSettings.LatencyMode.ToString());
  108. if (m_gui) // Driven by external GUI
  109. m_console = new CommandConsole("Region");
  110. else
  111. {
  112. switch (m_consoleType)
  113. {
  114. case "basic":
  115. m_console = new CommandConsole("Region");
  116. break;
  117. case "rest":
  118. m_console = new RemoteConsole("Region");
  119. ((RemoteConsole)m_console).ReadConfig(m_config.Source);
  120. break;
  121. default:
  122. m_console = new LocalConsole("Region");
  123. break;
  124. }
  125. }
  126. MainConsole.Instance = m_console;
  127. RegisterConsoleCommands();
  128. base.StartupSpecific();
  129. if (m_console is RemoteConsole)
  130. ((RemoteConsole)m_console).SetServer(m_httpServer);
  131. //Run Startup Commands
  132. if (String.IsNullOrEmpty(m_startupCommandsFile))
  133. {
  134. m_log.Info("[STARTUP]: No startup command script specified. Moving on...");
  135. }
  136. else
  137. {
  138. RunCommandScript(m_startupCommandsFile);
  139. }
  140. // Start timer script (run a script every xx seconds)
  141. if (m_timedScript != "disabled")
  142. {
  143. m_scriptTimer = new Timer();
  144. m_scriptTimer.Enabled = true;
  145. m_scriptTimer.Interval = 1200*1000;
  146. m_scriptTimer.Elapsed += RunAutoTimerScript;
  147. }
  148. PrintFileToConsole("startuplogo.txt");
  149. // For now, start at the 'root' level by default
  150. if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
  151. ChangeSelectedRegion("region",
  152. new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName});
  153. else
  154. ChangeSelectedRegion("region", new string[] {"change", "region", "root"});
  155. }
  156. /// <summary>
  157. /// Register standard set of region console commands
  158. /// </summary>
  159. private void RegisterConsoleCommands()
  160. {
  161. m_console.Commands.AddCommand("region", false, "clear assets",
  162. "clear assets",
  163. "Clear the asset cache", HandleClearAssets);
  164. m_console.Commands.AddCommand("region", false, "force update",
  165. "force update",
  166. "Force the update of all objects on clients",
  167. HandleForceUpdate);
  168. m_console.Commands.AddCommand("region", false, "debug packet",
  169. "debug packet <level>",
  170. "Turn on packet debugging", Debug);
  171. m_console.Commands.AddCommand("region", false, "debug scene",
  172. "debug scene <cripting> <collisions> <physics>",
  173. "Turn on scene debugging", Debug);
  174. m_console.Commands.AddCommand("region", false, "change region",
  175. "change region <region name>",
  176. "Change current console region", ChangeSelectedRegion);
  177. m_console.Commands.AddCommand("region", false, "save xml",
  178. "save xml",
  179. "Save a region's data in XML format", SaveXml);
  180. m_console.Commands.AddCommand("region", false, "save xml2",
  181. "save xml2",
  182. "Save a region's data in XML2 format", SaveXml2);
  183. m_console.Commands.AddCommand("region", false, "load xml",
  184. "load xml [-newIDs [<x> <y> <z>]]",
  185. "Load a region's data from XML format", LoadXml);
  186. m_console.Commands.AddCommand("region", false, "load xml2",
  187. "load xml2",
  188. "Load a region's data from XML2 format", LoadXml2);
  189. m_console.Commands.AddCommand("region", false, "save prims xml2",
  190. "save prims xml2 [<prim name> <file name>]",
  191. "Save named prim to XML2", SavePrimsXml2);
  192. m_console.Commands.AddCommand("region", false, "load oar",
  193. "load oar <oar name>",
  194. "Load a region's data from OAR archive", LoadOar);
  195. m_console.Commands.AddCommand("region", false, "save oar",
  196. "save oar <oar name>",
  197. "Save a region's data to an OAR archive",
  198. "More information on forthcoming options here soon", SaveOar);
  199. m_console.Commands.AddCommand("region", false, "edit scale",
  200. "edit scale <name> <x> <y> <z>",
  201. "Change the scale of a named prim", HandleEditScale);
  202. m_console.Commands.AddCommand("region", false, "kick user",
  203. "kick user <first> <last> [message]",
  204. "Kick a user off the simulator", KickUserCommand);
  205. m_console.Commands.AddCommand("region", false, "show assets",
  206. "show assets",
  207. "Show asset data", HandleShow);
  208. m_console.Commands.AddCommand("region", false, "show users",
  209. "show users [full]",
  210. "Show user data", HandleShow);
  211. m_console.Commands.AddCommand("region", false, "show connections",
  212. "show connections",
  213. "Show connection data", HandleShow);
  214. m_console.Commands.AddCommand("region", false, "show users full",
  215. "show users full",
  216. String.Empty, HandleShow);
  217. m_console.Commands.AddCommand("region", false, "show modules",
  218. "show modules",
  219. "Show module data", HandleShow);
  220. m_console.Commands.AddCommand("region", false, "show regions",
  221. "show regions",
  222. "Show region data", HandleShow);
  223. m_console.Commands.AddCommand("region", false, "show queues",
  224. "show queues",
  225. "Show queue data", HandleShow);
  226. m_console.Commands.AddCommand("region", false, "show ratings",
  227. "show ratings",
  228. "Show rating data", HandleShow);
  229. m_console.Commands.AddCommand("region", false, "backup",
  230. "backup",
  231. "Persist objects to the database now", RunCommand);
  232. m_console.Commands.AddCommand("region", false, "create region",
  233. "create region",
  234. "Create a new region", HandleCreateRegion);
  235. m_console.Commands.AddCommand("region", false, "login enable",
  236. "login enable",
  237. "Enable logins to the simulator", HandleLoginEnable);
  238. m_console.Commands.AddCommand("region", false, "login disable",
  239. "login disable",
  240. "Disable logins to the simulator", HandleLoginDisable);
  241. m_console.Commands.AddCommand("region", false, "login status",
  242. "login status",
  243. "Display status of logins", HandleLoginStatus);
  244. m_console.Commands.AddCommand("region", false, "restart",
  245. "restart",
  246. "Restart all sims in this instance", RunCommand);
  247. m_console.Commands.AddCommand("region", false, "config set",
  248. "config set <section> <field> <value>",
  249. "Set a config option", HandleConfig);
  250. m_console.Commands.AddCommand("region", false, "config get",
  251. "config get <section> <field>",
  252. "Read a config option", HandleConfig);
  253. m_console.Commands.AddCommand("region", false, "config save",
  254. "config save",
  255. "Save current configuration", HandleConfig);
  256. m_console.Commands.AddCommand("region", false, "command-script",
  257. "command-script <script>",
  258. "Run a command script from file", RunCommand);
  259. m_console.Commands.AddCommand("region", false, "remove-region",
  260. "remove-region <name>",
  261. "Remove a region from this simulator", RunCommand);
  262. m_console.Commands.AddCommand("region", false, "delete-region",
  263. "delete-region <name>",
  264. "Delete a region from disk", RunCommand);
  265. m_console.Commands.AddCommand("region", false, "modules list",
  266. "modules list",
  267. "List modules", HandleModules);
  268. m_console.Commands.AddCommand("region", false, "modules load",
  269. "modules load <name>",
  270. "Load a module", HandleModules);
  271. m_console.Commands.AddCommand("region", false, "modules unload",
  272. "modules unload <name>",
  273. "Unload a module", HandleModules);
  274. m_console.Commands.AddCommand("region", false, "Add-InventoryHost",
  275. "Add-InventoryHost <host>",
  276. String.Empty, RunCommand);
  277. if (ConfigurationSettings.Standalone)
  278. {
  279. m_console.Commands.AddCommand("region", false, "create user",
  280. "create user [<first> [<last> [<pass> [<x> <y> [<email>]]]]]",
  281. "Create a new user", HandleCreateUser);
  282. m_console.Commands.AddCommand("region", false, "reset user password",
  283. "reset user password [<first> [<last> [<password>]]]",
  284. "Reset a user password", HandleResetUserPassword);
  285. }
  286. m_console.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
  287. "Set local coordinate to map HG regions to", RunCommand);
  288. m_console.Commands.AddCommand("hypergrid", false, "link-region",
  289. "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
  290. "Link a hypergrid region", RunCommand);
  291. m_console.Commands.AddCommand("hypergrid", false, "unlink-region",
  292. "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
  293. "Unlink a hypergrid region", RunCommand);
  294. }
  295. public override void ShutdownSpecific()
  296. {
  297. if (m_shutdownCommandsFile != String.Empty)
  298. {
  299. RunCommandScript(m_shutdownCommandsFile);
  300. }
  301. base.ShutdownSpecific();
  302. }
  303. /// <summary>
  304. /// Timer to run a specific text file as console commands. Configured in in the main ini file
  305. /// </summary>
  306. /// <param name="sender"></param>
  307. /// <param name="e"></param>
  308. private void RunAutoTimerScript(object sender, EventArgs e)
  309. {
  310. if (m_timedScript != "disabled")
  311. {
  312. RunCommandScript(m_timedScript);
  313. }
  314. }
  315. #region Console Commands
  316. /// <summary>
  317. /// Kicks users off the region
  318. /// </summary>
  319. /// <param name="module"></param>
  320. /// <param name="cmdparams">name of avatar to kick</param>
  321. private void KickUserCommand(string module, string[] cmdparams)
  322. {
  323. if (cmdparams.Length < 4)
  324. return;
  325. string alert = null;
  326. if (cmdparams.Length > 4)
  327. alert = String.Format("\n{0}\n", String.Join(" ", cmdparams, 4, cmdparams.Length - 4));
  328. IList agents = m_sceneManager.GetCurrentSceneAvatars();
  329. foreach (ScenePresence presence in agents)
  330. {
  331. RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle);
  332. if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) &&
  333. presence.Lastname.ToLower().Contains(cmdparams[3].ToLower()))
  334. {
  335. m_log.Info(
  336. String.Format(
  337. "Kicking user: {0,-16}{1,-16}{2,-37} in region: {3,-16}",
  338. presence.Firstname, presence.Lastname, presence.UUID, regionInfo.RegionName));
  339. // kick client...
  340. if (alert != null)
  341. presence.ControllingClient.Kick(alert);
  342. else
  343. presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n");
  344. // ...and close on our side
  345. presence.Scene.IncomingCloseAgent(presence.UUID);
  346. }
  347. }
  348. m_log.Info("");
  349. }
  350. /// <summary>
  351. /// Run an optional startup list of commands
  352. /// </summary>
  353. /// <param name="fileName"></param>
  354. private void RunCommandScript(string fileName)
  355. {
  356. if (File.Exists(fileName))
  357. {
  358. m_log.Info("[COMMANDFILE]: Running " + fileName);
  359. using (StreamReader readFile = File.OpenText(fileName))
  360. {
  361. string currentCommand;
  362. while ((currentCommand = readFile.ReadLine()) != null)
  363. {
  364. if (currentCommand != String.Empty)
  365. {
  366. m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'");
  367. m_console.RunCommand(currentCommand);
  368. }
  369. }
  370. }
  371. }
  372. }
  373. /// <summary>
  374. /// Opens a file and uses it as input to the console command parser.
  375. /// </summary>
  376. /// <param name="fileName">name of file to use as input to the console</param>
  377. private static void PrintFileToConsole(string fileName)
  378. {
  379. if (File.Exists(fileName))
  380. {
  381. StreamReader readFile = File.OpenText(fileName);
  382. string currentLine;
  383. while ((currentLine = readFile.ReadLine()) != null)
  384. {
  385. m_log.Info("[!]" + currentLine);
  386. }
  387. }
  388. }
  389. private void HandleClearAssets(string module, string[] args)
  390. {
  391. m_log.Info("Not implemented.");
  392. }
  393. /// <summary>
  394. /// Force resending of all updates to all clients in active region(s)
  395. /// </summary>
  396. /// <param name="module"></param>
  397. /// <param name="args"></param>
  398. private void HandleForceUpdate(string module, string[] args)
  399. {
  400. m_log.Info("Updating all clients");
  401. m_sceneManager.ForceCurrentSceneClientUpdate();
  402. }
  403. /// <summary>
  404. /// Edits the scale of a primative with the name specified
  405. /// </summary>
  406. /// <param name="module"></param>
  407. /// <param name="args">0,1, name, x, y, z</param>
  408. private void HandleEditScale(string module, string[] args)
  409. {
  410. if (args.Length == 6)
  411. {
  412. m_sceneManager.HandleEditCommandOnCurrentScene(args);
  413. }
  414. else
  415. {
  416. m_log.Info("Argument error: edit scale <prim name> <x> <y> <z>");
  417. }
  418. }
  419. /// <summary>
  420. /// Creates a new region based on the parameters specified. This will ask the user questions on the console
  421. /// </summary>
  422. /// <param name="module"></param>
  423. /// <param name="cmd">0,1,region name, region XML file</param>
  424. private void HandleCreateRegion(string module, string[] cmd)
  425. {
  426. if (cmd.Length < 4)
  427. {
  428. m_log.Error("Usage: create region <region name> <region_file.ini>");
  429. return;
  430. }
  431. if (cmd[3].EndsWith(".xml"))
  432. {
  433. string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim();
  434. string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]);
  435. // Allow absolute and relative specifiers
  436. if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith(".."))
  437. regionFile = cmd[3];
  438. IScene scene;
  439. CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source), true, out scene);
  440. }
  441. else if (cmd[3].EndsWith(".ini"))
  442. {
  443. string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim();
  444. string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]);
  445. // Allow absolute and relative specifiers
  446. if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith(".."))
  447. regionFile = cmd[3];
  448. IScene scene;
  449. CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]), true, out scene);
  450. }
  451. else
  452. {
  453. m_log.Error("Usage: create region <region name> <region_file.ini>");
  454. return;
  455. }
  456. }
  457. /// <summary>
  458. /// Enable logins
  459. /// </summary>
  460. /// <param name="module"></param>
  461. /// <param name="cmd"></param>
  462. private void HandleLoginEnable(string module, string[] cmd)
  463. {
  464. ProcessLogin(true);
  465. }
  466. /// <summary>
  467. /// Disable logins
  468. /// </summary>
  469. /// <param name="module"></param>
  470. /// <param name="cmd"></param>
  471. private void HandleLoginDisable(string module, string[] cmd)
  472. {
  473. ProcessLogin(false);
  474. }
  475. /// <summary>
  476. /// Log login status to the console
  477. /// </summary>
  478. /// <param name="module"></param>
  479. /// <param name="cmd"></param>
  480. private void HandleLoginStatus(string module, string[] cmd)
  481. {
  482. if (m_sceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled == false)
  483. m_log.Info("[ Login ] Login are disabled ");
  484. else
  485. m_log.Info("[ Login ] Login are enabled");
  486. }
  487. /// <summary>
  488. /// Change and load configuration file data.
  489. /// </summary>
  490. /// <param name="module"></param>
  491. /// <param name="cmd"></param>
  492. private void HandleConfig(string module, string[] cmd)
  493. {
  494. List<string> args = new List<string>(cmd);
  495. args.RemoveAt(0);
  496. string[] cmdparams = args.ToArray();
  497. string n = "CONFIG";
  498. if (cmdparams.Length > 0)
  499. {
  500. switch (cmdparams[0].ToLower())
  501. {
  502. case "set":
  503. if (cmdparams.Length < 4)
  504. {
  505. m_log.Error("SYNTAX: " + n + " SET SECTION KEY VALUE");
  506. m_log.Error("EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5");
  507. }
  508. else
  509. {
  510. IConfig c;
  511. IConfigSource source = new IniConfigSource();
  512. c = source.AddConfig(cmdparams[1]);
  513. if (c != null)
  514. {
  515. string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3);
  516. c.Set(cmdparams[2], _value);
  517. m_config.Source.Merge(source);
  518. m_log.Error(n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " +
  519. _value);
  520. }
  521. }
  522. break;
  523. case "get":
  524. if (cmdparams.Length < 3)
  525. {
  526. m_log.Error("SYNTAX: " + n + " GET SECTION KEY");
  527. m_log.Error("EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads");
  528. }
  529. else
  530. {
  531. IConfig c = m_config.Source.Configs[cmdparams[1]];
  532. if (c == null)
  533. {
  534. m_log.Info("Section \"" + cmdparams[1] + "\" does not exist.");
  535. break;
  536. }
  537. else
  538. {
  539. m_log.Info(n + " GET " + cmdparams[1] + " " + cmdparams[2] + ": " +
  540. c.GetString(cmdparams[2]));
  541. }
  542. }
  543. break;
  544. case "save":
  545. if (cmdparams.Length < 2)
  546. {
  547. m_log.Error("SYNTAX: " + n + " SAVE FILE");
  548. return;
  549. }
  550. if (Application.iniFilePath == cmdparams[1])
  551. {
  552. m_log.Error("FILE can not be "+Application.iniFilePath);
  553. return;
  554. }
  555. m_log.Info("Saving configuration file: " + cmdparams[1]);
  556. m_config.Save(cmdparams[1]);
  557. break;
  558. }
  559. }
  560. }
  561. /// <summary>
  562. /// Load, Unload, and list Region modules in use
  563. /// </summary>
  564. /// <param name="module"></param>
  565. /// <param name="cmd"></param>
  566. private void HandleModules(string module, string[] cmd)
  567. {
  568. List<string> args = new List<string>(cmd);
  569. args.RemoveAt(0);
  570. string[] cmdparams = args.ToArray();
  571. if (cmdparams.Length > 0)
  572. {
  573. switch (cmdparams[0].ToLower())
  574. {
  575. case "list":
  576. foreach (IRegionModule irm in m_moduleLoader.GetLoadedSharedModules)
  577. {
  578. m_log.Info("Shared region module: " + irm.Name);
  579. }
  580. break;
  581. case "unload":
  582. if (cmdparams.Length > 1)
  583. {
  584. foreach (IRegionModule rm in new ArrayList(m_moduleLoader.GetLoadedSharedModules))
  585. {
  586. if (rm.Name.ToLower() == cmdparams[1].ToLower())
  587. {
  588. m_log.Info("Unloading module: " + rm.Name);
  589. m_moduleLoader.UnloadModule(rm);
  590. }
  591. }
  592. }
  593. break;
  594. case "load":
  595. if (cmdparams.Length > 1)
  596. {
  597. foreach (Scene s in new ArrayList(m_sceneManager.Scenes))
  598. {
  599. m_log.Info("Loading module: " + cmdparams[1]);
  600. m_moduleLoader.LoadRegionModules(cmdparams[1], s);
  601. }
  602. }
  603. break;
  604. }
  605. }
  606. }
  607. /// <summary>
  608. /// Runs commands issued by the server console from the operator
  609. /// </summary>
  610. /// <param name="command">The first argument of the parameter (the command)</param>
  611. /// <param name="cmdparams">Additional arguments passed to the command</param>
  612. public void RunCommand(string module, string[] cmdparams)
  613. {
  614. List<string> args = new List<string>(cmdparams);
  615. if (args.Count < 1)
  616. return;
  617. string command = args[0];
  618. args.RemoveAt(0);
  619. cmdparams = args.ToArray();
  620. switch (command)
  621. {
  622. case "command-script":
  623. if (cmdparams.Length > 0)
  624. {
  625. RunCommandScript(cmdparams[0]);
  626. }
  627. break;
  628. case "backup":
  629. m_sceneManager.BackupCurrentScene();
  630. break;
  631. case "remove-region":
  632. string regRemoveName = CombineParams(cmdparams, 0);
  633. Scene removeScene;
  634. if (m_sceneManager.TryGetScene(regRemoveName, out removeScene))
  635. RemoveRegion(removeScene, false);
  636. else
  637. m_log.Error("no region with that name");
  638. break;
  639. case "delete-region":
  640. string regDeleteName = CombineParams(cmdparams, 0);
  641. Scene killScene;
  642. if (m_sceneManager.TryGetScene(regDeleteName, out killScene))
  643. RemoveRegion(killScene, true);
  644. else
  645. m_log.Error("no region with that name");
  646. break;
  647. case "restart":
  648. m_sceneManager.RestartCurrentScene();
  649. break;
  650. case "Add-InventoryHost":
  651. if (cmdparams.Length > 0)
  652. {
  653. m_log.Info("Not implemented.");
  654. }
  655. break;
  656. }
  657. }
  658. /// <summary>
  659. /// Change the currently selected region. The selected region is that operated upon by single region commands.
  660. /// </summary>
  661. /// <param name="cmdParams"></param>
  662. protected void ChangeSelectedRegion(string module, string[] cmdparams)
  663. {
  664. if (cmdparams.Length > 2)
  665. {
  666. string newRegionName = CombineParams(cmdparams, 2);
  667. if (!m_sceneManager.TrySetCurrentScene(newRegionName))
  668. m_log.Error("Couldn't select region " + newRegionName);
  669. }
  670. else
  671. {
  672. m_log.Error("Usage: change region <region name>");
  673. }
  674. string regionName = (m_sceneManager.CurrentScene == null ? "root" : m_sceneManager.CurrentScene.RegionInfo.RegionName);
  675. m_log.Info(String.Format("Currently selected region is {0}", regionName));
  676. m_console.DefaultPrompt = String.Format("Region ({0}) ", regionName);
  677. m_console.ConsoleScene = m_sceneManager.CurrentScene;
  678. }
  679. /// <summary>
  680. /// Execute switch for some of the create commands
  681. /// </summary>
  682. /// <param name="args"></param>
  683. private void HandleCreateUser(string module, string[] cmd)
  684. {
  685. if (ConfigurationSettings.Standalone)
  686. {
  687. CreateUser(cmd);
  688. }
  689. else
  690. {
  691. m_log.Info("Create user is not available in grid mode, use the user server.");
  692. }
  693. }
  694. /// <summary>
  695. /// Execute switch for some of the reset commands
  696. /// </summary>
  697. /// <param name="args"></param>
  698. protected void HandleResetUserPassword(string module, string[] cmd)
  699. {
  700. if (ConfigurationSettings.Standalone)
  701. {
  702. ResetUserPassword(cmd);
  703. }
  704. else
  705. {
  706. m_log.Info("Reset user password is not available in grid mode, use the user-server.");
  707. }
  708. }
  709. /// <summary>
  710. /// Turn on some debugging values for OpenSim.
  711. /// </summary>
  712. /// <param name="args"></param>
  713. protected void Debug(string module, string[] args)
  714. {
  715. if (args.Length == 1)
  716. return;
  717. switch (args[1])
  718. {
  719. case "packet":
  720. if (args.Length > 2)
  721. {
  722. int newDebug;
  723. if (int.TryParse(args[2], out newDebug))
  724. {
  725. m_sceneManager.SetDebugPacketLevelOnCurrentScene(newDebug);
  726. }
  727. else
  728. {
  729. m_log.Error("packet debug should be 0..255");
  730. }
  731. m_log.Info("New packet debug: " + newDebug.ToString());
  732. }
  733. break;
  734. case "scene":
  735. if (args.Length == 5)
  736. {
  737. if (m_sceneManager.CurrentScene == null)
  738. {
  739. m_log.Info("Please use 'change region <regioname>' first");
  740. }
  741. else
  742. {
  743. bool scriptingOn = !Convert.ToBoolean(args[2]);
  744. bool collisionsOn = !Convert.ToBoolean(args[3]);
  745. bool physicsOn = !Convert.ToBoolean(args[4]);
  746. m_sceneManager.CurrentScene.SetSceneCoreDebug(scriptingOn, collisionsOn, physicsOn);
  747. m_log.Info(
  748. String.Format(
  749. "Set debug scene scripting = {0}, collisions = {1}, physics = {2}",
  750. !scriptingOn, !collisionsOn, !physicsOn));
  751. }
  752. }
  753. else
  754. {
  755. m_log.Error("debug scene <scripting> <collisions> <physics> (where inside <> is true/false)");
  756. }
  757. break;
  758. default:
  759. m_log.Error("Unknown debug");
  760. break;
  761. }
  762. }
  763. // see BaseOpenSimServer
  764. /// <summary>
  765. /// Many commands list objects for debugging. Some of the types are listed here
  766. /// </summary>
  767. /// <param name="mod"></param>
  768. /// <param name="cmd"></param>
  769. public override void HandleShow(string mod, string[] cmd)
  770. {
  771. base.HandleShow(mod, cmd);
  772. List<string> args = new List<string>(cmd);
  773. args.RemoveAt(0);
  774. string[] showParams = args.ToArray();
  775. switch (showParams[0])
  776. {
  777. case "assets":
  778. m_log.Info("Not implemented.");
  779. break;
  780. case "users":
  781. IList agents;
  782. if (showParams.Length > 1 && showParams[1] == "full")
  783. {
  784. agents = m_sceneManager.GetCurrentScenePresences();
  785. }
  786. else
  787. {
  788. agents = m_sceneManager.GetCurrentSceneAvatars();
  789. }
  790. m_log.Info(String.Format("\nAgents connected: {0}\n", agents.Count));
  791. m_log.Info(
  792. String.Format("{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}", "Firstname", "Lastname",
  793. "Agent ID", "Root/Child", "Region"));
  794. foreach (ScenePresence presence in agents)
  795. {
  796. RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle);
  797. string regionName;
  798. if (regionInfo == null)
  799. {
  800. regionName = "Unresolvable";
  801. }
  802. else
  803. {
  804. regionName = regionInfo.RegionName;
  805. }
  806. m_log.Info(
  807. String.Format(
  808. "{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}",
  809. presence.Firstname,
  810. presence.Lastname,
  811. presence.UUID,
  812. presence.IsChildAgent ? "Child" : "Root",
  813. regionName));
  814. }
  815. m_log.Info(String.Empty);
  816. break;
  817. case "connections":
  818. System.Text.StringBuilder connections = new System.Text.StringBuilder("Connections:\n");
  819. m_sceneManager.ForEachScene(
  820. delegate(Scene scene)
  821. {
  822. scene.ClientManager.ForEachSync(
  823. delegate(IClientAPI client)
  824. {
  825. connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n",
  826. scene.RegionInfo.RegionName, client.Name, client.AgentId, client.RemoteEndPoint, client.CircuitCode);
  827. }
  828. );
  829. }
  830. );
  831. m_log.Info(connections.ToString());
  832. break;
  833. case "modules":
  834. m_log.Info("The currently loaded shared modules are:");
  835. foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
  836. {
  837. m_log.Info("Shared Module: " + module.Name);
  838. }
  839. break;
  840. case "regions":
  841. m_sceneManager.ForEachScene(
  842. delegate(Scene scene)
  843. {
  844. m_log.Info("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " +
  845. scene.RegionInfo.RegionLocX + " , Region YLoc: " +
  846. scene.RegionInfo.RegionLocY + " , Region Port: " +
  847. scene.RegionInfo.InternalEndPoint.Port.ToString());
  848. });
  849. break;
  850. case "queues":
  851. Notice(GetQueuesReport());
  852. break;
  853. case "ratings":
  854. m_sceneManager.ForEachScene(
  855. delegate(Scene scene)
  856. {
  857. string rating = "";
  858. if (scene.RegionInfo.RegionSettings.Maturity == 1)
  859. {
  860. rating = "MATURE";
  861. }
  862. else if (scene.RegionInfo.RegionSettings.Maturity == 2)
  863. {
  864. rating = "ADULT";
  865. }
  866. else
  867. {
  868. rating = "PG";
  869. }
  870. m_log.Info("Region Name: " + scene.RegionInfo.RegionName + " , Region Rating: " +
  871. rating);
  872. });
  873. break;
  874. }
  875. }
  876. /// <summary>
  877. /// print UDP Queue data for each client
  878. /// </summary>
  879. /// <returns></returns>
  880. private string GetQueuesReport()
  881. {
  882. string report = String.Empty;
  883. m_sceneManager.ForEachScene(delegate(Scene scene)
  884. {
  885. scene.ForEachClient(delegate(IClientAPI client)
  886. {
  887. if (client is IStatsCollector)
  888. {
  889. report = report + client.FirstName +
  890. " " + client.LastName + "\n";
  891. IStatsCollector stats =
  892. (IStatsCollector) client;
  893. 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",
  894. "Send",
  895. "In",
  896. "Out",
  897. "Resend",
  898. "Land",
  899. "Wind",
  900. "Cloud",
  901. "Task",
  902. "Texture",
  903. "Asset");
  904. report = report + stats.Report() +
  905. "\n\n";
  906. }
  907. });
  908. });
  909. return report;
  910. }
  911. /// <summary>
  912. /// Create a new user
  913. /// </summary>
  914. /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
  915. protected void CreateUser(string[] cmdparams)
  916. {
  917. string firstName;
  918. string lastName;
  919. string password;
  920. string email;
  921. uint regX = 1000;
  922. uint regY = 1000;
  923. IConfig standalone;
  924. if ((standalone = m_config.Source.Configs["StandAlone"]) != null)
  925. {
  926. regX = (uint)standalone.GetInt("default_location_x", (int)regX);
  927. regY = (uint)standalone.GetInt("default_location_y", (int)regY);
  928. }
  929. if (cmdparams.Length < 3)
  930. firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
  931. else firstName = cmdparams[2];
  932. if (cmdparams.Length < 4)
  933. lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
  934. else lastName = cmdparams[3];
  935. if (cmdparams.Length < 5)
  936. password = MainConsole.Instance.PasswdPrompt("Password");
  937. else password = cmdparams[4];
  938. if (cmdparams.Length < 6)
  939. regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
  940. else regX = Convert.ToUInt32(cmdparams[5]);
  941. if (cmdparams.Length < 7)
  942. regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
  943. else regY = Convert.ToUInt32(cmdparams[6]);
  944. if (cmdparams.Length < 8)
  945. email = MainConsole.Instance.CmdPrompt("Email", "");
  946. else email = cmdparams[7];
  947. if (null == m_commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName))
  948. {
  949. m_commsManager.UserAdminService.AddUser(firstName, lastName, password, email, regX, regY);
  950. }
  951. else
  952. {
  953. m_log.ErrorFormat("[CONSOLE]: A user with the name {0} {1} already exists!", firstName, lastName);
  954. }
  955. }
  956. /// <summary>
  957. /// Reset a user password.
  958. /// </summary>
  959. /// <param name="cmdparams"></param>
  960. private void ResetUserPassword(string[] cmdparams)
  961. {
  962. string firstName;
  963. string lastName;
  964. string newPassword;
  965. if (cmdparams.Length < 4)
  966. firstName = MainConsole.Instance.CmdPrompt("First name");
  967. else firstName = cmdparams[3];
  968. if (cmdparams.Length < 5)
  969. lastName = MainConsole.Instance.CmdPrompt("Last name");
  970. else lastName = cmdparams[4];
  971. if (cmdparams.Length < 6)
  972. newPassword = MainConsole.Instance.PasswdPrompt("New password");
  973. else newPassword = cmdparams[5];
  974. m_commsManager.UserAdminService.ResetUserPassword(firstName, lastName, newPassword);
  975. }
  976. /// <summary>
  977. /// Use XML2 format to serialize data to a file
  978. /// </summary>
  979. /// <param name="module"></param>
  980. /// <param name="cmdparams"></param>
  981. protected void SavePrimsXml2(string module, string[] cmdparams)
  982. {
  983. if (cmdparams.Length > 5)
  984. {
  985. m_sceneManager.SaveNamedPrimsToXml2(cmdparams[3], cmdparams[4]);
  986. }
  987. else
  988. {
  989. m_sceneManager.SaveNamedPrimsToXml2("Primitive", DEFAULT_PRIM_BACKUP_FILENAME);
  990. }
  991. }
  992. /// <summary>
  993. /// Use XML format to serialize data to a file
  994. /// </summary>
  995. /// <param name="module"></param>
  996. /// <param name="cmdparams"></param>
  997. protected void SaveXml(string module, string[] cmdparams)
  998. {
  999. 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.");
  1000. if (cmdparams.Length > 0)
  1001. {
  1002. m_sceneManager.SaveCurrentSceneToXml(cmdparams[2]);
  1003. }
  1004. else
  1005. {
  1006. m_sceneManager.SaveCurrentSceneToXml(DEFAULT_PRIM_BACKUP_FILENAME);
  1007. }
  1008. }
  1009. /// <summary>
  1010. /// Loads data and region objects from XML format.
  1011. /// </summary>
  1012. /// <param name="module"></param>
  1013. /// <param name="cmdparams"></param>
  1014. protected void LoadXml(string module, string[] cmdparams)
  1015. {
  1016. 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.");
  1017. Vector3 loadOffset = new Vector3(0, 0, 0);
  1018. if (cmdparams.Length > 2)
  1019. {
  1020. bool generateNewIDS = false;
  1021. if (cmdparams.Length > 3)
  1022. {
  1023. if (cmdparams[3] == "-newUID")
  1024. {
  1025. generateNewIDS = true;
  1026. }
  1027. if (cmdparams.Length > 4)
  1028. {
  1029. loadOffset.X = (float) Convert.ToDecimal(cmdparams[4]);
  1030. if (cmdparams.Length > 5)
  1031. {
  1032. loadOffset.Y = (float) Convert.ToDecimal(cmdparams[5]);
  1033. }
  1034. if (cmdparams.Length > 6)
  1035. {
  1036. loadOffset.Z = (float) Convert.ToDecimal(cmdparams[6]);
  1037. }
  1038. m_log.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," +
  1039. loadOffset.Z + ">");
  1040. }
  1041. }
  1042. m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset);
  1043. }
  1044. else
  1045. {
  1046. try
  1047. {
  1048. m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false, loadOffset);
  1049. }
  1050. catch (FileNotFoundException)
  1051. {
  1052. m_log.Error("Default xml not found. Usage: load-xml <filename>");
  1053. }
  1054. }
  1055. }
  1056. /// <summary>
  1057. /// Serialize region data to XML2Format
  1058. /// </summary>
  1059. /// <param name="module"></param>
  1060. /// <param name="cmdparams"></param>
  1061. protected void SaveXml2(string module, string[] cmdparams)
  1062. {
  1063. if (cmdparams.Length > 2)
  1064. {
  1065. m_sceneManager.SaveCurrentSceneToXml2(cmdparams[2]);
  1066. }
  1067. else
  1068. {
  1069. m_sceneManager.SaveCurrentSceneToXml2(DEFAULT_PRIM_BACKUP_FILENAME);
  1070. }
  1071. }
  1072. /// <summary>
  1073. /// Load region data from Xml2Format
  1074. /// </summary>
  1075. /// <param name="module"></param>
  1076. /// <param name="cmdparams"></param>
  1077. protected void LoadXml2(string module, string[] cmdparams)
  1078. {
  1079. if (cmdparams.Length > 2)
  1080. {
  1081. try
  1082. {
  1083. m_sceneManager.LoadCurrentSceneFromXml2(cmdparams[2]);
  1084. }
  1085. catch (FileNotFoundException)
  1086. {
  1087. m_log.Error("Specified xml not found. Usage: load xml2 <filename>");
  1088. }
  1089. }
  1090. else
  1091. {
  1092. try
  1093. {
  1094. m_sceneManager.LoadCurrentSceneFromXml2(DEFAULT_PRIM_BACKUP_FILENAME);
  1095. }
  1096. catch (FileNotFoundException)
  1097. {
  1098. m_log.Error("Default xml not found. Usage: load xml2 <filename>");
  1099. }
  1100. }
  1101. }
  1102. /// <summary>
  1103. /// Load a whole region from an opensimulator archive.
  1104. /// </summary>
  1105. /// <param name="cmdparams"></param>
  1106. protected void LoadOar(string module, string[] cmdparams)
  1107. {
  1108. try
  1109. {
  1110. if (cmdparams.Length > 2)
  1111. {
  1112. m_sceneManager.LoadArchiveToCurrentScene(cmdparams[2]);
  1113. }
  1114. else
  1115. {
  1116. m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME);
  1117. }
  1118. }
  1119. catch (Exception e)
  1120. {
  1121. m_log.Error(e.Message);
  1122. }
  1123. }
  1124. /// <summary>
  1125. /// Save a region to a file, including all the assets needed to restore it.
  1126. /// </summary>
  1127. /// <param name="cmdparams"></param>
  1128. protected void SaveOar(string module, string[] cmdparams)
  1129. {
  1130. if (cmdparams.Length > 2)
  1131. {
  1132. m_sceneManager.SaveCurrentSceneToArchive(cmdparams[2]);
  1133. }
  1134. else
  1135. {
  1136. m_sceneManager.SaveCurrentSceneToArchive(DEFAULT_OAR_BACKUP_FILENAME);
  1137. }
  1138. }
  1139. private static string CombineParams(string[] commandParams, int pos)
  1140. {
  1141. string result = String.Empty;
  1142. for (int i = pos; i < commandParams.Length; i++)
  1143. {
  1144. result += commandParams[i] + " ";
  1145. }
  1146. result = result.TrimEnd(' ');
  1147. return result;
  1148. }
  1149. #endregion
  1150. }
  1151. }