diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 79 |
1 files changed, 53 insertions, 26 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 2ef3308..4440fe1 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -46,7 +46,7 @@ using Timer=System.Timers.Timer; | |||
46 | 46 | ||
47 | namespace OpenSim | 47 | namespace OpenSim |
48 | { | 48 | { |
49 | /// <summary> | 49 | /// <summary> |
50 | /// Interactive OpenSim region server | 50 | /// Interactive OpenSim region server |
51 | /// </summary> | 51 | /// </summary> |
52 | public class OpenSim : OpenSimBase, conscmd_callback | 52 | public class OpenSim : OpenSimBase, conscmd_callback |
@@ -137,7 +137,7 @@ namespace OpenSim | |||
137 | } | 137 | } |
138 | base.ShutdownSpecific(); | 138 | base.ShutdownSpecific(); |
139 | } | 139 | } |
140 | 140 | ||
141 | private void RunAutoTimerScript(object sender, EventArgs e) | 141 | private void RunAutoTimerScript(object sender, EventArgs e) |
142 | { | 142 | { |
143 | if (m_timedScript != "disabled") | 143 | if (m_timedScript != "disabled") |
@@ -188,11 +188,11 @@ namespace OpenSim | |||
188 | /// </summary> | 188 | /// </summary> |
189 | /// <param name="fileName"></param> | 189 | /// <param name="fileName"></param> |
190 | private void RunCommandScript(string fileName) | 190 | private void RunCommandScript(string fileName) |
191 | { | 191 | { |
192 | if (File.Exists(fileName)) | 192 | if (File.Exists(fileName)) |
193 | { | 193 | { |
194 | m_log.Info("[COMMANDFILE]: Running " + fileName); | 194 | m_log.Info("[COMMANDFILE]: Running " + fileName); |
195 | 195 | ||
196 | StreamReader readFile = File.OpenText(fileName); | 196 | StreamReader readFile = File.OpenText(fileName); |
197 | string currentCommand; | 197 | string currentCommand; |
198 | while ((currentCommand = readFile.ReadLine()) != null) | 198 | while ((currentCommand = readFile.ReadLine()) != null) |
@@ -335,6 +335,12 @@ namespace OpenSim | |||
335 | m_log.Info("[ Login ] Login are enabled"); | 335 | m_log.Info("[ Login ] Login are enabled"); |
336 | break; | 336 | break; |
337 | case "create-region": | 337 | case "create-region": |
338 | if (cmdparams.Length < 2) | ||
339 | { | ||
340 | m_console.Error("Usage: create-region <region name> <region_file.xml>"); | ||
341 | break; | ||
342 | } | ||
343 | |||
338 | string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); | 344 | string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); |
339 | string regionFile = String.Format("{0}/{1}", regionsDir, cmdparams[1]); | 345 | string regionFile = String.Format("{0}/{1}", regionsDir, cmdparams[1]); |
340 | // Allow absolute and relative specifiers | 346 | // Allow absolute and relative specifiers |
@@ -422,7 +428,7 @@ namespace OpenSim | |||
422 | } | 428 | } |
423 | else | 429 | else |
424 | { | 430 | { |
425 | IConfig c = m_config.Source.Configs[cmdparams[1]]; // DefaultConfig().Configs[cmdparams[1]]; | 431 | IConfig c = m_config.Source.Configs[cmdparams[1]]; // DefaultConfig().Configs[cmdparams[1]]; |
426 | if (c == null) | 432 | if (c == null) |
427 | { | 433 | { |
428 | m_console.Notice(n, "Section \"" + cmdparams[1] + "\" does not exist."); | 434 | m_console.Notice(n, "Section \"" + cmdparams[1] + "\" does not exist."); |
@@ -490,10 +496,10 @@ namespace OpenSim | |||
490 | m_commsManager.AddInventoryService(cmdparams[0]); | 496 | m_commsManager.AddInventoryService(cmdparams[0]); |
491 | } | 497 | } |
492 | break; | 498 | break; |
493 | 499 | ||
494 | case "reset": | 500 | case "reset": |
495 | Reset(cmdparams); | 501 | Reset(cmdparams); |
496 | break; | 502 | break; |
497 | 503 | ||
498 | default: | 504 | default: |
499 | string[] tmpPluginArgs = new string[cmdparams.Length + 1]; | 505 | string[] tmpPluginArgs = new string[cmdparams.Length + 1]; |
@@ -551,7 +557,7 @@ namespace OpenSim | |||
551 | break; | 557 | break; |
552 | } | 558 | } |
553 | } | 559 | } |
554 | 560 | ||
555 | /// <summary> | 561 | /// <summary> |
556 | /// Execute switch for some of the reset commands | 562 | /// Execute switch for some of the reset commands |
557 | /// </summary> | 563 | /// </summary> |
@@ -564,7 +570,7 @@ namespace OpenSim | |||
564 | switch (args[0]) | 570 | switch (args[0]) |
565 | { | 571 | { |
566 | case "user": | 572 | case "user": |
567 | 573 | ||
568 | switch (args[1]) | 574 | switch (args[1]) |
569 | { | 575 | { |
570 | case "password": | 576 | case "password": |
@@ -578,10 +584,10 @@ namespace OpenSim | |||
578 | } | 584 | } |
579 | break; | 585 | break; |
580 | } | 586 | } |
581 | 587 | ||
582 | break; | 588 | break; |
583 | } | 589 | } |
584 | } | 590 | } |
585 | 591 | ||
586 | /// <summary> | 592 | /// <summary> |
587 | /// Turn on some debugging values for OpenSim. | 593 | /// Turn on some debugging values for OpenSim. |
@@ -708,7 +714,7 @@ namespace OpenSim | |||
708 | case "assets": | 714 | case "assets": |
709 | m_assetCache.ShowState(); | 715 | m_assetCache.ShowState(); |
710 | break; | 716 | break; |
711 | 717 | ||
712 | case "users": | 718 | case "users": |
713 | IList agents; | 719 | IList agents; |
714 | if (showParams.Length > 1 && showParams[1] == "full") | 720 | if (showParams.Length > 1 && showParams[1] == "full") |
@@ -860,7 +866,7 @@ namespace OpenSim | |||
860 | m_log.ErrorFormat("[CONSOLE]: A user with the name {0} {1} already exists!", firstName, lastName); | 866 | m_log.ErrorFormat("[CONSOLE]: A user with the name {0} {1} already exists!", firstName, lastName); |
861 | } | 867 | } |
862 | } | 868 | } |
863 | 869 | ||
864 | /// <summary> | 870 | /// <summary> |
865 | /// Reset a user password. | 871 | /// Reset a user password. |
866 | /// </summary> | 872 | /// </summary> |
@@ -870,7 +876,7 @@ namespace OpenSim | |||
870 | string firstName; | 876 | string firstName; |
871 | string lastName; | 877 | string lastName; |
872 | string newPassword; | 878 | string newPassword; |
873 | 879 | ||
874 | if (cmdparams.Length < 3) | 880 | if (cmdparams.Length < 3) |
875 | firstName = MainConsole.Instance.CmdPrompt("First name"); | 881 | firstName = MainConsole.Instance.CmdPrompt("First name"); |
876 | else firstName = cmdparams[2]; | 882 | else firstName = cmdparams[2]; |
@@ -882,9 +888,9 @@ namespace OpenSim | |||
882 | if ( cmdparams.Length < 5 ) | 888 | if ( cmdparams.Length < 5 ) |
883 | newPassword = MainConsole.Instance.PasswdPrompt("New password"); | 889 | newPassword = MainConsole.Instance.PasswdPrompt("New password"); |
884 | else newPassword = cmdparams[4]; | 890 | else newPassword = cmdparams[4]; |
885 | 891 | ||
886 | m_commsManager.UserAdminService.ResetUserPassword(firstName, lastName, newPassword); | 892 | m_commsManager.UserAdminService.ResetUserPassword(firstName, lastName, newPassword); |
887 | } | 893 | } |
888 | 894 | ||
889 | protected void SaveXml(string[] cmdparams) | 895 | protected void SaveXml(string[] cmdparams) |
890 | { | 896 | { |
@@ -933,7 +939,14 @@ namespace OpenSim | |||
933 | } | 939 | } |
934 | else | 940 | else |
935 | { | 941 | { |
936 | m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false, loadOffset); | 942 | try |
943 | { | ||
944 | m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false, loadOffset); | ||
945 | } | ||
946 | catch | ||
947 | { | ||
948 | m_console.Error("Default xml not found. Usage: load-xml <filename>"); | ||
949 | } | ||
937 | } | 950 | } |
938 | } | 951 | } |
939 | 952 | ||
@@ -957,7 +970,14 @@ namespace OpenSim | |||
957 | } | 970 | } |
958 | else | 971 | else |
959 | { | 972 | { |
960 | m_sceneManager.LoadCurrentSceneFromXml2(DEFAULT_PRIM_BACKUP_FILENAME); | 973 | try |
974 | { | ||
975 | m_sceneManager.LoadCurrentSceneFromXml2(DEFAULT_PRIM_BACKUP_FILENAME); | ||
976 | } | ||
977 | catch | ||
978 | { | ||
979 | m_console.Error("Default xml not found. Usage: load-xml2 <filename>"); | ||
980 | } | ||
961 | } | 981 | } |
962 | } | 982 | } |
963 | 983 | ||
@@ -973,7 +993,14 @@ namespace OpenSim | |||
973 | } | 993 | } |
974 | else | 994 | else |
975 | { | 995 | { |
976 | m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME); | 996 | try |
997 | { | ||
998 | m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME); | ||
999 | } | ||
1000 | catch | ||
1001 | { | ||
1002 | m_console.Error("Default oar not found. Usage: load-oar <filename>"); | ||
1003 | } | ||
977 | } | 1004 | } |
978 | } | 1005 | } |
979 | 1006 | ||
@@ -992,7 +1019,7 @@ namespace OpenSim | |||
992 | m_sceneManager.SaveCurrentSceneToArchive(DEFAULT_OAR_BACKUP_FILENAME); | 1019 | m_sceneManager.SaveCurrentSceneToArchive(DEFAULT_OAR_BACKUP_FILENAME); |
993 | } | 1020 | } |
994 | } | 1021 | } |
995 | 1022 | ||
996 | /// <summary> | 1023 | /// <summary> |
997 | /// Load inventory from an inventory file archive | 1024 | /// Load inventory from an inventory file archive |
998 | /// </summary> | 1025 | /// </summary> |
@@ -1005,16 +1032,16 @@ namespace OpenSim | |||
1005 | m_log.Error("[CONSOLE]: usage is load-inv <first name> <last name> <inventory path> [<load file path>]"); | 1032 | m_log.Error("[CONSOLE]: usage is load-inv <first name> <last name> <inventory path> [<load file path>]"); |
1006 | return; | 1033 | return; |
1007 | } | 1034 | } |
1008 | 1035 | ||
1009 | string firstName = cmdparams[0]; | 1036 | string firstName = cmdparams[0]; |
1010 | string lastName = cmdparams[1]; | 1037 | string lastName = cmdparams[1]; |
1011 | string invPath = cmdparams[2]; | 1038 | string invPath = cmdparams[2]; |
1012 | string loadPath = (cmdparams.Length > 3 ? cmdparams[3] : DEFAULT_INV_BACKUP_FILENAME); | 1039 | string loadPath = (cmdparams.Length > 3 ? cmdparams[3] : DEFAULT_INV_BACKUP_FILENAME); |
1013 | 1040 | ||
1014 | new InventoryArchiveReadRequest( | 1041 | new InventoryArchiveReadRequest( |
1015 | m_sceneManager.CurrentOrFirstScene, m_commsManager).execute( | 1042 | m_sceneManager.CurrentOrFirstScene, m_commsManager).execute( |
1016 | firstName, lastName, invPath, loadPath); | 1043 | firstName, lastName, invPath, loadPath); |
1017 | } | 1044 | } |
1018 | 1045 | ||
1019 | /// <summary> | 1046 | /// <summary> |
1020 | /// Save inventory to a file archive | 1047 | /// Save inventory to a file archive |
@@ -1028,17 +1055,17 @@ namespace OpenSim | |||
1028 | m_log.Error("[CONSOLE]: usage is save-inv <first name> <last name> <inventory path> [<save file path>]"); | 1055 | m_log.Error("[CONSOLE]: usage is save-inv <first name> <last name> <inventory path> [<save file path>]"); |
1029 | return; | 1056 | return; |
1030 | } | 1057 | } |
1031 | 1058 | ||
1032 | string firstName = cmdparams[0]; | 1059 | string firstName = cmdparams[0]; |
1033 | string lastName = cmdparams[1]; | 1060 | string lastName = cmdparams[1]; |
1034 | string invPath = cmdparams[2]; | 1061 | string invPath = cmdparams[2]; |
1035 | string savePath = (cmdparams.Length > 3 ? cmdparams[3] : DEFAULT_INV_BACKUP_FILENAME); | 1062 | string savePath = (cmdparams.Length > 3 ? cmdparams[3] : DEFAULT_INV_BACKUP_FILENAME); |
1036 | 1063 | ||
1037 | new InventoryArchiveWriteRequest( | 1064 | new InventoryArchiveWriteRequest( |
1038 | m_sceneManager.CurrentOrFirstScene,m_commsManager).execute( | 1065 | m_sceneManager.CurrentOrFirstScene,m_commsManager).execute( |
1039 | firstName, lastName, invPath, savePath); | 1066 | firstName, lastName, invPath, savePath); |
1040 | } | 1067 | } |
1041 | 1068 | ||
1042 | private static string CombineParams(string[] commandParams, int pos) | 1069 | private static string CombineParams(string[] commandParams, int pos) |
1043 | { | 1070 | { |
1044 | string result = String.Empty; | 1071 | string result = String.Empty; |