aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSimMain.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Application/OpenSimMain.cs')
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs992
1 files changed, 496 insertions, 496 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 99164f1..08d7619 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -1,496 +1,496 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.IO; 30using System.IO;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Assets; 32using OpenSim.Assets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Data; 36using OpenSim.Framework.Data;
37using OpenSim.Framework.Interfaces; 37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Servers; 38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Types; 39using OpenSim.Framework.Types;
40using OpenSim.GenericConfig; 40using OpenSim.GenericConfig;
41using OpenSim.Physics.Manager; 41using OpenSim.Physics.Manager;
42using OpenSim.Region.Caches; 42using OpenSim.Region.Caches;
43using OpenSim.Region.ClientStack; 43using OpenSim.Region.ClientStack;
44using OpenSim.Region.Communications.Local; 44using OpenSim.Region.Communications.Local;
45using OpenSim.Region.Communications.OGS1; 45using OpenSim.Region.Communications.OGS1;
46using OpenSim.Region.Environment.Scenes; 46using OpenSim.Region.Environment.Scenes;
47using OpenSim.Region.Environment; 47using OpenSim.Region.Environment;
48using System.Text; 48using System.Text;
49 49
50namespace OpenSim 50namespace OpenSim
51{ 51{
52 52
53 public class OpenSimMain : RegionApplicationBase, conscmd_callback 53 public class OpenSimMain : RegionApplicationBase, conscmd_callback
54 { 54 {
55 protected CommunicationsManager commsManager; 55 protected CommunicationsManager commsManager;
56 // private CheckSumServer checkServer; 56 // private CheckSumServer checkServer;
57 57
58 private bool m_silent; 58 private bool m_silent;
59 private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; 59 private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log";
60 60
61 public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) 61 public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile)
62 { 62 {
63 this.configFileSetup = useConfigFile; 63 this.configFileSetup = useConfigFile;
64 m_sandbox = sandBoxMode; 64 m_sandbox = sandBoxMode;
65 m_loginserver = startLoginServer; 65 m_loginserver = startLoginServer;
66 m_physicsEngine = physicsEngine; 66 m_physicsEngine = physicsEngine;
67 m_config = configFile; 67 m_config = configFile;
68 m_silent = silent; 68 m_silent = silent;
69 } 69 }
70 70
71 /// <summary> 71 /// <summary>
72 /// Performs initialisation of the world, such as loading configuration from disk. 72 /// Performs initialisation of the world, such as loading configuration from disk.
73 /// </summary> 73 /// </summary>
74 public override void StartUp() 74 public override void StartUp()
75 { 75 {
76 this.serversData = new NetworkServersInfo(); 76 this.serversData = new NetworkServersInfo();
77 77
78 this.localConfig = new XmlConfig(m_config); 78 this.localConfig = new XmlConfig(m_config);
79 this.localConfig.LoadData(); 79 this.localConfig.LoadData();
80 80
81 if (this.configFileSetup) 81 if (this.configFileSetup)
82 { 82 {
83 this.SetupFromConfigFile(this.localConfig); 83 this.SetupFromConfigFile(this.localConfig);
84 } 84 }
85 85
86 m_log = new LogBase(m_logFilename, "Region", this, m_silent); 86 m_log = new LogBase(m_logFilename, "Region", this, m_silent);
87 MainLog.Instance = m_log; 87 MainLog.Instance = m_log;
88 88
89 m_log.Verbose("Main.cs:Startup() - Loading configuration"); 89 m_log.Verbose("Main.cs:Startup() - Loading configuration");
90 this.serversData.InitConfig(this.m_sandbox, this.localConfig); 90 this.serversData.InitConfig(this.m_sandbox, this.localConfig);
91 this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change 91 this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change
92 92
93 ScenePresence.LoadTextureFile("avatar-texture.dat"); 93 ScenePresence.LoadTextureFile("avatar-texture.dat");
94 94
95 ClientView.TerrainManager = new TerrainManager(new SecondLife()); 95 ClientView.TerrainManager = new TerrainManager(new SecondLife());
96 96
97 this.SetupHttpListener(); 97 this.SetupHttpListener();
98 98
99 if (m_sandbox) 99 if (m_sandbox)
100 { 100 {
101 this.SetupLocalGridServers(); 101 this.SetupLocalGridServers();
102 // this.checkServer = new CheckSumServer(12036); 102 // this.checkServer = new CheckSumServer(12036);
103 // this.checkServer.ServerListener(); 103 // this.checkServer.ServerListener();
104 } 104 }
105 else 105 else
106 { 106 {
107 this.SetupRemoteGridServers(); 107 this.SetupRemoteGridServers();
108 } 108 }
109 109
110 startuptime = DateTime.Now; 110 startuptime = DateTime.Now;
111 111
112 this.physManager = new PhysicsManager(); 112 this.physManager = new PhysicsManager();
113 this.physManager.LoadPlugins(); 113 this.physManager.LoadPlugins();
114 114
115 this.SetupScene(); 115 this.SetupScene();
116 116
117 m_log.Verbose("Main.cs:Startup() - Initialising HTTP server"); 117 m_log.Verbose("Main.cs:Startup() - Initialising HTTP server");
118 118
119 //Start http server 119 //Start http server
120 m_log.Verbose("Main.cs:Startup() - Starting HTTP server"); 120 m_log.Verbose("Main.cs:Startup() - Starting HTTP server");
121 httpServer.Start(); 121 httpServer.Start();
122 122
123 // Start UDP servers 123 // Start UDP servers
124 for (int i = 0; i < m_udpServer.Count; i++) 124 for (int i = 0; i < m_udpServer.Count; i++)
125 { 125 {
126 this.m_udpServer[i].ServerListener(); 126 this.m_udpServer[i].ServerListener();
127 } 127 }
128 128
129 } 129 }
130 130
131 # region Setup methods 131 # region Setup methods
132 protected override void SetupLocalGridServers() 132 protected override void SetupLocalGridServers()
133 { 133 {
134 try 134 try
135 { 135 {
136 AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); 136 AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey);
137 InventoryCache = new InventoryCache(); 137 InventoryCache = new InventoryCache();
138 this.commsManager = new CommunicationsLocal(this.serversData, httpServer); 138 this.commsManager = new CommunicationsLocal(this.serversData, httpServer);
139 } 139 }
140 catch (Exception e) 140 catch (Exception e)
141 { 141 {
142 m_log.Error(e.Message + "\nSorry, could not setup local cache"); 142 m_log.Error(e.Message + "\nSorry, could not setup local cache");
143 Environment.Exit(1); 143 Environment.Exit(1);
144 } 144 }
145 145
146 } 146 }
147 147
148 protected override void SetupRemoteGridServers() 148 protected override void SetupRemoteGridServers()
149 { 149 {
150 try 150 try
151 { 151 {
152 AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); 152 AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey);
153 InventoryCache = new InventoryCache(); 153 InventoryCache = new InventoryCache();
154 this.commsManager = new CommunicationsOGS1(this.serversData, httpServer); 154 this.commsManager = new CommunicationsOGS1(this.serversData, httpServer);
155 } 155 }
156 catch (Exception e) 156 catch (Exception e)
157 { 157 {
158 m_log.Error(e.Message + "\nSorry, could not setup remote cache"); 158 m_log.Error(e.Message + "\nSorry, could not setup remote cache");
159 Environment.Exit(1); 159 Environment.Exit(1);
160 } 160 }
161 } 161 }
162 162
163 protected override void SetupScene() 163 protected override void SetupScene()
164 { 164 {
165 IGenericConfig regionConfig; 165 IGenericConfig regionConfig;
166 Scene scene; 166 Scene scene;
167 UDPServer udpServer; 167 UDPServer udpServer;
168 RegionInfo regionDat = new RegionInfo(); 168 RegionInfo regionDat = new RegionInfo();
169 AuthenticateSessionsBase authenBase; 169 AuthenticateSessionsBase authenBase;
170 170
171 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); 171 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions");
172 string[] configFiles = Directory.GetFiles(path, "*.xml"); 172 string[] configFiles = Directory.GetFiles(path, "*.xml");
173 173
174 if (configFiles.Length == 0) 174 if (configFiles.Length == 0)
175 { 175 {
176 string path2 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); 176 string path2 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions");
177 string path3 = Path.Combine(path2, "default.xml"); 177 string path3 = Path.Combine(path2, "default.xml");
178 Console.WriteLine("Creating default region config file"); 178 Console.WriteLine("Creating default region config file");
179 //TODO create default region 179 //TODO create default region
180 IGenericConfig defaultConfig = new XmlConfig(path3); 180 IGenericConfig defaultConfig = new XmlConfig(path3);
181 defaultConfig.LoadData(); 181 defaultConfig.LoadData();
182 defaultConfig.Commit(); 182 defaultConfig.Commit();
183 defaultConfig.Close(); 183 defaultConfig.Close();
184 defaultConfig = null; 184 defaultConfig = null;
185 configFiles = Directory.GetFiles(path, "*.xml"); 185 configFiles = Directory.GetFiles(path, "*.xml");
186 } 186 }
187 187
188 for (int i = 0; i < configFiles.Length; i++) 188 for (int i = 0; i < configFiles.Length; i++)
189 { 189 {
190 regionDat = new RegionInfo(); 190 regionDat = new RegionInfo();
191 if (m_sandbox) 191 if (m_sandbox)
192 { 192 {
193 AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); // new AuthenticateSessionsLocal(); 193 AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); // new AuthenticateSessionsLocal();
194 this.AuthenticateSessionsHandler.Add(authen); 194 this.AuthenticateSessionsHandler.Add(authen);
195 authenBase = authen; 195 authenBase = authen;
196 } 196 }
197 else 197 else
198 { 198 {
199 AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); //new AuthenticateSessionsRemote(); 199 AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); //new AuthenticateSessionsRemote();
200 this.AuthenticateSessionsHandler.Add(authen); 200 this.AuthenticateSessionsHandler.Add(authen);
201 authenBase = authen; 201 authenBase = authen;
202 } 202 }
203 Console.WriteLine("Loading region config file"); 203 Console.WriteLine("Loading region config file");
204 regionConfig = new XmlConfig(configFiles[i]); 204 regionConfig = new XmlConfig(configFiles[i]);
205 regionConfig.LoadData(); 205 regionConfig.LoadData();
206 regionDat.InitConfig(this.m_sandbox, regionConfig); 206 regionDat.InitConfig(this.m_sandbox, regionConfig);
207 regionConfig.Close(); 207 regionConfig.Close();
208 208
209 udpServer = new UDPServer(regionDat.InternalEndPoint.Port, this.AssetCache, this.InventoryCache, this.m_log, authenBase); 209 udpServer = new UDPServer(regionDat.InternalEndPoint.Port, this.AssetCache, this.InventoryCache, this.m_log, authenBase);
210 210
211 m_udpServer.Add(udpServer); 211 m_udpServer.Add(udpServer);
212 this.regionData.Add(regionDat); 212 this.regionData.Add(regionDat);
213 213
214 StorageManager tmpStoreManager = new StorageManager("OpenSim.DataStore.NullStorage.dll", regionDat.DataStore, regionDat.RegionName); 214 StorageManager tmpStoreManager = new StorageManager("OpenSim.DataStore.NullStorage.dll", regionDat.DataStore, regionDat.RegionName);
215 215
216 scene = new Scene( regionDat, authenBase, commsManager, this.AssetCache, tmpStoreManager, httpServer); 216 scene = new Scene( regionDat, authenBase, commsManager, this.AssetCache, tmpStoreManager, httpServer);
217 this.m_localWorld.Add(scene); 217 this.m_localWorld.Add(scene);
218 218
219 udpServer.LocalWorld = scene; 219 udpServer.LocalWorld = scene;
220 220
221 scene.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. 221 scene.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
222 scene.LoadWorldMap(); 222 scene.LoadWorldMap();
223 223
224 m_log.Verbose("Main.cs:Startup() - Starting up messaging system"); 224 m_log.Verbose("Main.cs:Startup() - Starting up messaging system");
225 scene.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); 225 scene.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine);
226 scene.PhysScene.SetTerrain(scene.Terrain.getHeights1D()); 226 scene.PhysScene.SetTerrain(scene.Terrain.getHeights1D());
227 scene.LoadPrimsFromStorage(); 227 scene.LoadPrimsFromStorage();
228 228
229 //Master Avatar Setup 229 //Master Avatar Setup
230 UserProfileData masterAvatar = commsManager.UserServer.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword); 230 UserProfileData masterAvatar = commsManager.UserServer.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword);
231 if (masterAvatar != null) 231 if (masterAvatar != null)
232 { 232 {
233 m_log.Notice("Parcels - Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]"); 233 m_log.Notice("Parcels - Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]");
234 scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID; 234 scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID;
235 scene.localStorage.LoadParcels((ILocalStorageParcelReceiver)scene.ParcelManager); 235 scene.localStorage.LoadParcels((ILocalStorageParcelReceiver)scene.ParcelManager);
236 } 236 }
237 else 237 else
238 { 238 {
239 m_log.Notice("Parcels - No master avatar found, using null."); 239 m_log.Notice("Parcels - No master avatar found, using null.");
240 scene.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero; 240 scene.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero;
241 scene.localStorage.LoadParcels((ILocalStorageParcelReceiver)scene.ParcelManager); 241 scene.localStorage.LoadParcels((ILocalStorageParcelReceiver)scene.ParcelManager);
242 } 242 }
243 scene.performParcelPrimCountUpdate(); 243 scene.performParcelPrimCountUpdate();
244 scene.StartTimer(); 244 scene.StartTimer();
245 } 245 }
246 } 246 }
247 247
248 private class SimStatusHandler : IStreamHandler 248 private class SimStatusHandler : IStreamHandler
249 { 249 {
250 public byte[] Handle(string path, Stream request) 250 public byte[] Handle(string path, Stream request)
251 { 251 {
252 return Encoding.UTF8.GetBytes("OK"); 252 return Encoding.UTF8.GetBytes("OK");
253 } 253 }
254 254
255 public string ContentType 255 public string ContentType
256 { 256 {
257 get { return "text/plain"; } 257 get { return "text/plain"; }
258 } 258 }
259 259
260 public string HttpMethod 260 public string HttpMethod
261 { 261 {
262 get { return "GET"; } 262 get { return "GET"; }
263 } 263 }
264 264
265 public string Path 265 public string Path
266 { 266 {
267 get { return "/simstatus/"; } 267 get { return "/simstatus/"; }
268 } 268 }
269 } 269 }
270 270
271 protected override void SetupHttpListener() 271 protected override void SetupHttpListener()
272 { 272 {
273 httpServer = new BaseHttpServer(this.serversData.HttpListenerPort); //regionData[0].IPListenPort); 273 httpServer = new BaseHttpServer(this.serversData.HttpListenerPort); //regionData[0].IPListenPort);
274 274
275 if (!this.m_sandbox) 275 if (!this.m_sandbox)
276 { 276 {
277 httpServer.AddStreamHandler( new SimStatusHandler() ); 277 httpServer.AddStreamHandler( new SimStatusHandler() );
278 } 278 }
279 } 279 }
280 280
281 protected override void ConnectToRemoteGridServer() 281 protected override void ConnectToRemoteGridServer()
282 { 282 {
283 283
284 } 284 }
285 285
286 #endregion 286 #endregion
287 287
288 private void SetupFromConfigFile(IGenericConfig configData) 288 private void SetupFromConfigFile(IGenericConfig configData)
289 { 289 {
290 // Log filename 290 // Log filename
291 string attri = ""; 291 string attri = "";
292 attri = configData.GetAttribute("LogFilename"); 292 attri = configData.GetAttribute("LogFilename");
293 if (String.IsNullOrEmpty(attri)) 293 if (String.IsNullOrEmpty(attri))
294 { 294 {
295 } 295 }
296 else 296 else
297 { 297 {
298 m_logFilename = attri; 298 m_logFilename = attri;
299 } 299 }
300 300
301 // SandBoxMode 301 // SandBoxMode
302 attri = ""; 302 attri = "";
303 attri = configData.GetAttribute("SandBox"); 303 attri = configData.GetAttribute("SandBox");
304 if ((attri == "") || ((attri != "false") && (attri != "true"))) 304 if ((attri == "") || ((attri != "false") && (attri != "true")))
305 { 305 {
306 this.m_sandbox = false; 306 this.m_sandbox = false;
307 configData.SetAttribute("SandBox", "false"); 307 configData.SetAttribute("SandBox", "false");
308 } 308 }
309 else 309 else
310 { 310 {
311 this.m_sandbox = Convert.ToBoolean(attri); 311 this.m_sandbox = Convert.ToBoolean(attri);
312 } 312 }
313 313
314 // LoginServer 314 // LoginServer
315 attri = ""; 315 attri = "";
316 attri = configData.GetAttribute("LoginServer"); 316 attri = configData.GetAttribute("LoginServer");
317 if ((attri == "") || ((attri != "false") && (attri != "true"))) 317 if ((attri == "") || ((attri != "false") && (attri != "true")))
318 { 318 {
319 this.m_loginserver = false; 319 this.m_loginserver = false;
320 configData.SetAttribute("LoginServer", "false"); 320 configData.SetAttribute("LoginServer", "false");
321 } 321 }
322 else 322 else
323 { 323 {
324 this.m_loginserver = Convert.ToBoolean(attri); 324 this.m_loginserver = Convert.ToBoolean(attri);
325 } 325 }
326 326
327 // Sandbox User accounts 327 // Sandbox User accounts
328 attri = ""; 328 attri = "";
329 attri = configData.GetAttribute("UserAccount"); 329 attri = configData.GetAttribute("UserAccount");
330 if ((attri == "") || ((attri != "false") && (attri != "true"))) 330 if ((attri == "") || ((attri != "false") && (attri != "true")))
331 { 331 {
332 this.user_accounts = false; 332 this.user_accounts = false;
333 configData.SetAttribute("UserAccounts", "false"); 333 configData.SetAttribute("UserAccounts", "false");
334 } 334 }
335 else if (attri == "true") 335 else if (attri == "true")
336 { 336 {
337 this.user_accounts = Convert.ToBoolean(attri); 337 this.user_accounts = Convert.ToBoolean(attri);
338 } 338 }
339 339
340 // Grid mode hack to use local asset server 340 // Grid mode hack to use local asset server
341 attri = ""; 341 attri = "";
342 attri = configData.GetAttribute("LocalAssets"); 342 attri = configData.GetAttribute("LocalAssets");
343 if ((attri == "") || ((attri != "false") && (attri != "true"))) 343 if ((attri == "") || ((attri != "false") && (attri != "true")))
344 { 344 {
345 this.gridLocalAsset = false; 345 this.gridLocalAsset = false;
346 configData.SetAttribute("LocalAssets", "false"); 346 configData.SetAttribute("LocalAssets", "false");
347 } 347 }
348 else if (attri == "true") 348 else if (attri == "true")
349 { 349 {
350 this.gridLocalAsset = Convert.ToBoolean(attri); 350 this.gridLocalAsset = Convert.ToBoolean(attri);
351 } 351 }
352 352
353 353
354 attri = ""; 354 attri = "";
355 attri = configData.GetAttribute("PhysicsEngine"); 355 attri = configData.GetAttribute("PhysicsEngine");
356 switch (attri) 356 switch (attri)
357 { 357 {
358 default: 358 default:
359 m_log.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); 359 m_log.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating");
360 Environment.Exit(1); 360 Environment.Exit(1);
361 break; 361 break;
362 362
363 case "": 363 case "":
364 this.m_physicsEngine = "basicphysics"; 364 this.m_physicsEngine = "basicphysics";
365 configData.SetAttribute("PhysicsEngine", "basicphysics"); 365 configData.SetAttribute("PhysicsEngine", "basicphysics");
366 ScenePresence.PhysicsEngineFlying = false; 366 ScenePresence.PhysicsEngineFlying = false;
367 break; 367 break;
368 368
369 case "basicphysics": 369 case "basicphysics":
370 this.m_physicsEngine = "basicphysics"; 370 this.m_physicsEngine = "basicphysics";
371 configData.SetAttribute("PhysicsEngine", "basicphysics"); 371 configData.SetAttribute("PhysicsEngine", "basicphysics");
372 ScenePresence.PhysicsEngineFlying = false; 372 ScenePresence.PhysicsEngineFlying = false;
373 break; 373 break;
374 374
375 case "RealPhysX": 375 case "RealPhysX":
376 this.m_physicsEngine = "RealPhysX"; 376 this.m_physicsEngine = "RealPhysX";
377 ScenePresence.PhysicsEngineFlying = true; 377 ScenePresence.PhysicsEngineFlying = true;
378 break; 378 break;
379 379
380 case "OpenDynamicsEngine": 380 case "OpenDynamicsEngine":
381 this.m_physicsEngine = "OpenDynamicsEngine"; 381 this.m_physicsEngine = "OpenDynamicsEngine";
382 ScenePresence.PhysicsEngineFlying = true; 382 ScenePresence.PhysicsEngineFlying = true;
383 break; 383 break;
384 384
385 case "BulletXEngine": 385 case "BulletXEngine":
386 this.m_physicsEngine = "BulletXEngine"; 386 this.m_physicsEngine = "BulletXEngine";
387 ScenePresence.PhysicsEngineFlying = true; 387 ScenePresence.PhysicsEngineFlying = true;
388 break; 388 break;
389 } 389 }
390 390
391 configData.Commit(); 391 configData.Commit();
392 392
393 } 393 }
394 394
395 /// <summary> 395 /// <summary>
396 /// Performs any last-minute sanity checking and shuts down the region server 396 /// Performs any last-minute sanity checking and shuts down the region server
397 /// </summary> 397 /// </summary>
398 public virtual void Shutdown() 398 public virtual void Shutdown()
399 { 399 {
400 m_log.Verbose("Main.cs:Shutdown() - Closing all threads"); 400 m_log.Verbose("Main.cs:Shutdown() - Closing all threads");
401 m_log.Verbose("Main.cs:Shutdown() - Killing listener thread"); 401 m_log.Verbose("Main.cs:Shutdown() - Killing listener thread");
402 m_log.Verbose("Main.cs:Shutdown() - Killing clients"); 402 m_log.Verbose("Main.cs:Shutdown() - Killing clients");
403 // IMPLEMENT THIS 403 // IMPLEMENT THIS
404 m_log.Verbose("Main.cs:Shutdown() - Closing console and terminating"); 404 m_log.Verbose("Main.cs:Shutdown() - Closing console and terminating");
405 for (int i = 0; i < m_localWorld.Count; i++) 405 for (int i = 0; i < m_localWorld.Count; i++)
406 { 406 {
407 ((Scene)m_localWorld[i]).Close(); 407 ((Scene)m_localWorld[i]).Close();
408 } 408 }
409 m_log.Close(); 409 m_log.Close();
410 Environment.Exit(0); 410 Environment.Exit(0);
411 } 411 }
412 412
413 #region Console Commands 413 #region Console Commands
414 /// <summary> 414 /// <summary>
415 /// Runs commands issued by the server console from the operator 415 /// Runs commands issued by the server console from the operator
416 /// </summary> 416 /// </summary>
417 /// <param name="command">The first argument of the parameter (the command)</param> 417 /// <param name="command">The first argument of the parameter (the command)</param>
418 /// <param name="cmdparams">Additional arguments passed to the command</param> 418 /// <param name="cmdparams">Additional arguments passed to the command</param>
419 public void RunCmd(string command, string[] cmdparams) 419 public void RunCmd(string command, string[] cmdparams)
420 { 420 {
421 switch (command) 421 switch (command)
422 { 422 {
423 case "help": 423 case "help":
424 m_log.Error("show users - show info about connected users"); 424 m_log.Error("show users - show info about connected users");
425 m_log.Error("quit - disconnect all clients and shutdown"); 425 m_log.Error("quit - disconnect all clients and shutdown");
426 break; 426 break;
427 427
428 case "show": 428 case "show":
429 if (cmdparams.Length > 0) 429 if (cmdparams.Length > 0)
430 { 430 {
431 Show(cmdparams[0]); 431 Show(cmdparams[0]);
432 } 432 }
433 break; 433 break;
434 434
435 case "terrain": 435 case "terrain":
436 string result = ""; 436 string result = "";
437 for (int i = 0; i < m_localWorld.Count; i++) 437 for (int i = 0; i < m_localWorld.Count; i++)
438 { 438 {
439 if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result, m_localWorld[i].RegionInfo.RegionName)) 439 if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result, m_localWorld[i].RegionInfo.RegionName))
440 { 440 {
441 m_log.Error(result); 441 m_log.Error(result);
442 } 442 }
443 } 443 }
444 break; 444 break;
445 case "script": 445 case "script":
446 for (int i = 0; i < m_localWorld.Count; i++) 446 for (int i = 0; i < m_localWorld.Count; i++)
447 { 447 {
448 ((Scene)m_localWorld[i]).SendCommandToScripts(cmdparams); 448 ((Scene)m_localWorld[i]).SendCommandToScripts(cmdparams);
449 } 449 }
450 break; 450 break;
451 451
452 case "quit": 452 case "quit":
453 case "shutdown": 453 case "shutdown":
454 Shutdown(); 454 Shutdown();
455 break; 455 break;
456 456
457 default: 457 default:
458 m_log.Error("Unknown command"); 458 m_log.Error("Unknown command");
459 break; 459 break;
460 } 460 }
461 } 461 }
462 462
463 /// <summary> 463 /// <summary>
464 /// Outputs to the console information about the region 464 /// Outputs to the console information about the region
465 /// </summary> 465 /// </summary>
466 /// <param name="ShowWhat">What information to display (valid arguments are "uptime", "users")</param> 466 /// <param name="ShowWhat">What information to display (valid arguments are "uptime", "users")</param>
467 public void Show(string ShowWhat) 467 public void Show(string ShowWhat)
468 { 468 {
469 switch (ShowWhat) 469 switch (ShowWhat)
470 { 470 {
471 case "uptime": 471 case "uptime":
472 m_log.Error("OpenSim has been running since " + startuptime.ToString()); 472 m_log.Error("OpenSim has been running since " + startuptime.ToString());
473 m_log.Error("That is " + (DateTime.Now - startuptime).ToString()); 473 m_log.Error("That is " + (DateTime.Now - startuptime).ToString());
474 break; 474 break;
475 case "users": 475 case "users":
476 ScenePresence TempAv; 476 ScenePresence TempAv;
477 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); 477 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World"));
478 for (int i = 0; i < m_localWorld.Count; i++) 478 for (int i = 0; i < m_localWorld.Count; i++)
479 { 479 {
480 foreach (libsecondlife.LLUUID UUID in ((Scene)m_localWorld[i]).Entities.Keys) 480 foreach (libsecondlife.LLUUID UUID in ((Scene)m_localWorld[i]).Entities.Keys)
481 { 481 {
482 if (((Scene)m_localWorld[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar") 482 if (((Scene)m_localWorld[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar")
483 { 483 {
484 TempAv = (ScenePresence)((Scene)m_localWorld[i]).Entities[UUID]; 484 TempAv = (ScenePresence)((Scene)m_localWorld[i]).Entities[UUID];
485 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localWorld[i]).RegionInfo.RegionName); 485 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localWorld[i]).RegionInfo.RegionName);
486 } 486 }
487 } 487 }
488 } 488 }
489 break; 489 break;
490 } 490 }
491 } 491 }
492 #endregion 492 #endregion
493 } 493 }
494 494
495 495
496} 496}