aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionInfo.cs
diff options
context:
space:
mode:
authorlbsa712007-12-27 21:41:48 +0000
committerlbsa712007-12-27 21:41:48 +0000
commitefd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch)
treebf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Framework/RegionInfo.cs
parent* removed always true if (diff)
downloadopensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz
* Optimized usings
* shortened references * Removed redundant 'this' * Normalized EOF
Diffstat (limited to 'OpenSim/Framework/RegionInfo.cs')
-rw-r--r--OpenSim/Framework/RegionInfo.cs205
1 files changed, 102 insertions, 103 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index c4557f8..8c25603 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -26,16 +26,11 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Globalization;
30using System.Net; 29using System.Net;
31using System.Xml;
32using System.Net.Sockets; 30using System.Net.Sockets;
33using Nini.Config; 31using System.Xml;
34using libsecondlife; 32using libsecondlife;
35using OpenSim.Framework.Console; 33using Nini.Config;
36using OpenSim.Framework;
37
38
39 34
40namespace OpenSim.Framework 35namespace OpenSim.Framework
41{ 36{
@@ -64,6 +59,7 @@ namespace OpenSim.Framework
64 59
65 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); 60 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
66 } 61 }
62
67 public SimpleRegionInfo(RegionInfo ConvertFrom) 63 public SimpleRegionInfo(RegionInfo ConvertFrom)
68 { 64 {
69 m_regionLocX = ConvertFrom.RegionLocX; 65 m_regionLocX = ConvertFrom.RegionLocX;
@@ -78,16 +74,11 @@ namespace OpenSim.Framework
78 public LLUUID RegionID = LLUUID.Zero; 74 public LLUUID RegionID = LLUUID.Zero;
79 75
80 public uint m_remotingPort; 76 public uint m_remotingPort;
77
81 public uint RemotingPort 78 public uint RemotingPort
82 { 79 {
83 get 80 get { return m_remotingPort; }
84 { 81 set { m_remotingPort = value; }
85 return m_remotingPort;
86 }
87 set
88 {
89 m_remotingPort = value;
90 }
91 } 82 }
92 83
93 public string RemotingAddress; 84 public string RemotingAddress;
@@ -123,73 +114,47 @@ namespace OpenSim.Framework
123 return new IPEndPoint(ia, m_internalEndPoint.Port); 114 return new IPEndPoint(ia, m_internalEndPoint.Port);
124 } 115 }
125 116
126 set 117 set { m_externalHostName = value.ToString(); }
127 {
128 m_externalHostName = value.ToString();
129 }
130 } 118 }
131 119
132 protected string m_externalHostName; 120 protected string m_externalHostName;
121
133 public string ExternalHostName 122 public string ExternalHostName
134 { 123 {
135 get 124 get { return m_externalHostName; }
136 { 125 set { m_externalHostName = value; }
137 return m_externalHostName;
138 }
139 set
140 {
141 m_externalHostName = value;
142 }
143 } 126 }
144 127
145 protected IPEndPoint m_internalEndPoint; 128 protected IPEndPoint m_internalEndPoint;
129
146 public IPEndPoint InternalEndPoint 130 public IPEndPoint InternalEndPoint
147 { 131 {
148 get 132 get { return m_internalEndPoint; }
149 { 133 set { m_internalEndPoint = value; }
150 return m_internalEndPoint;
151 }
152 set
153 {
154 m_internalEndPoint = value;
155 }
156 } 134 }
157 135
158 protected uint? m_regionLocX; 136 protected uint? m_regionLocX;
137
159 public uint RegionLocX 138 public uint RegionLocX
160 { 139 {
161 get 140 get { return m_regionLocX.Value; }
162 { 141 set { m_regionLocX = value; }
163 return m_regionLocX.Value;
164 }
165 set
166 {
167 m_regionLocX = value;
168 }
169 } 142 }
170 143
171 protected uint? m_regionLocY; 144 protected uint? m_regionLocY;
145
172 public uint RegionLocY 146 public uint RegionLocY
173 { 147 {
174 get 148 get { return m_regionLocY.Value; }
175 { 149 set { m_regionLocY = value; }
176 return m_regionLocY.Value;
177 }
178 set
179 {
180 m_regionLocY = value;
181 }
182 } 150 }
183 151
184 public ulong RegionHandle 152 public ulong RegionHandle
185 { 153 {
186 get 154 get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); }
187 {
188 return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
189 }
190 } 155 }
191 } 156 }
192 157
193 public class RegionInfo : SimpleRegionInfo 158 public class RegionInfo : SimpleRegionInfo
194 { 159 {
195 public string RegionName = ""; 160 public string RegionName = "";
@@ -206,15 +171,16 @@ namespace OpenSim.Framework
206 171
207 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. 172 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
208 private static EstateSettings m_estateSettings; 173 private static EstateSettings m_estateSettings;
174
209 public EstateSettings EstateSettings 175 public EstateSettings EstateSettings
210 { 176 {
211 get 177 get
212 { 178 {
213 if( m_estateSettings == null ) 179 if (m_estateSettings == null)
214 { 180 {
215 m_estateSettings = new EstateSettings(); 181 m_estateSettings = new EstateSettings();
216 } 182 }
217 183
218 return m_estateSettings; 184 return m_estateSettings;
219 } 185 }
220 } 186 }
@@ -223,14 +189,18 @@ namespace OpenSim.Framework
223 189
224 public RegionInfo(string description, string filename) 190 public RegionInfo(string description, string filename)
225 { 191 {
226 configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); 192 configMember =
193 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration);
227 configMember.performConfigurationRetrieve(); 194 configMember.performConfigurationRetrieve();
228 } 195 }
196
229 public RegionInfo(string description, XmlNode xmlNode) 197 public RegionInfo(string description, XmlNode xmlNode)
230 { 198 {
231 configMember = new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration); 199 configMember =
200 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration);
232 configMember.performConfigurationRetrieve(); 201 configMember.performConfigurationRetrieve();
233 } 202 }
203
234 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : 204 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) :
235 base(regionLocX, regionLocY, internalEndPoint, externalUri) 205 base(regionLocX, regionLocY, internalEndPoint, externalUri)
236 { 206 {
@@ -239,6 +209,7 @@ namespace OpenSim.Framework
239 public RegionInfo() 209 public RegionInfo()
240 { 210 {
241 } 211 }
212
242 public RegionInfo(SearializableRegionInfo ConvertFrom) 213 public RegionInfo(SearializableRegionInfo ConvertFrom)
243 { 214 {
244 m_regionLocX = ConvertFrom.RegionLocX; 215 m_regionLocX = ConvertFrom.RegionLocX;
@@ -249,6 +220,7 @@ namespace OpenSim.Framework
249 RemotingAddress = ConvertFrom.RemotingAddress; 220 RemotingAddress = ConvertFrom.RemotingAddress;
250 RegionID = LLUUID.Zero; 221 RegionID = LLUUID.Zero;
251 } 222 }
223
252 public RegionInfo(SimpleRegionInfo ConvertFrom) 224 public RegionInfo(SimpleRegionInfo ConvertFrom)
253 { 225 {
254 m_regionLocX = ConvertFrom.RegionLocX; 226 m_regionLocX = ConvertFrom.RegionLocX;
@@ -259,47 +231,49 @@ namespace OpenSim.Framework
259 RemotingAddress = ConvertFrom.RemotingAddress; 231 RemotingAddress = ConvertFrom.RemotingAddress;
260 RegionID = LLUUID.Zero; 232 RegionID = LLUUID.Zero;
261 } 233 }
234
262 //not in use, should swap to nini though. 235 //not in use, should swap to nini though.
263 public void LoadFromNiniSource(IConfigSource source) 236 public void LoadFromNiniSource(IConfigSource source)
264 { 237 {
265 this.LoadFromNiniSource(source, "RegionInfo"); 238 LoadFromNiniSource(source, "RegionInfo");
266 } 239 }
267 240
268 //not in use, should swap to nini though. 241 //not in use, should swap to nini though.
269 public void LoadFromNiniSource(IConfigSource source, string sectionName) 242 public void LoadFromNiniSource(IConfigSource source, string sectionName)
270 { 243 {
271 string errorMessage = ""; 244 string errorMessage = "";
272 this.RegionID = new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToString())); 245 RegionID = new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToString()));
273 this.RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); 246 RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test");
274 this.m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); 247 m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000"));
275 this.m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); 248 m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000"));
276 // this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); 249 // this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db");
277 250
278 string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); 251 string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0");
279 IPAddress ipAddressResult; 252 IPAddress ipAddressResult;
280 if (IPAddress.TryParse(ipAddress, out ipAddressResult)) 253 if (IPAddress.TryParse(ipAddress, out ipAddressResult))
281 { 254 {
282 this.m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); 255 m_internalEndPoint = new IPEndPoint(ipAddressResult, 0);
283 } 256 }
284 else 257 else
285 { 258 {
286 errorMessage = "needs an IP Address (IPAddress)"; 259 errorMessage = "needs an IP Address (IPAddress)";
287 } 260 }
288 this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port", (int) NetworkServersInfo.DefaultHttpListenerPort); 261 m_internalEndPoint.Port =
262 source.Configs[sectionName].GetInt("internal_ip_port", (int) NetworkServersInfo.DefaultHttpListenerPort);
289 263
290 string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); 264 string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1");
291 if (externalHost != "SYSTEMIP") 265 if (externalHost != "SYSTEMIP")
292 { 266 {
293 this.m_externalHostName = externalHost; 267 m_externalHostName = externalHost;
294 } 268 }
295 else 269 else
296 { 270 {
297 this.m_externalHostName = Util.GetLocalHost().ToString(); 271 m_externalHostName = Util.GetLocalHost().ToString();
298 } 272 }
299 273
300 this.MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); 274 MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test");
301 this.MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); 275 MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User");
302 this.MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); 276 MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test");
303 277
304 if (errorMessage != "") 278 if (errorMessage != "")
305 { 279 {
@@ -309,19 +283,45 @@ namespace OpenSim.Framework
309 283
310 public void loadConfigurationOptions() 284 public void loadConfigurationOptions()
311 { 285 {
312 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Region (Default is recommended, random UUID)", LLUUID.Random().ToString(), true); 286 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
313 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Region Name", "OpenSim Test", false); 287 "UUID of Region (Default is recommended, random UUID)",
314 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); 288 LLUUID.Random().ToString(), true);
315 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); 289 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
290 "Region Name", "OpenSim Test", false);
291 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
292 "Grid Location (X Axis)", "1000", false);
293 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
294 "Grid Location (Y Axis)", "1000", false);
316 //configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); 295 //configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
317 configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); 296 configMember.addConfigurationOption("internal_ip_address",
318 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); 297 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
319 configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); 298 "Internal IP Address for incoming UDP client connections", "0.0.0.0",
320 configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Master Avatar UUID", LLUUID.Zero.ToString(), true); 299 false);
321 configMember.addConfigurationOption("estate_covanant_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Estate Covenant", LLUUID.Zero.ToString(), true); 300 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
322 configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false,(ConfigurationOption.ConfigurationOptionShouldBeAsked)shouldMasterAvatarDetailsBeAsked); 301 "Internal IP Port for incoming UDP client connections",
323 configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false, (ConfigurationOption.ConfigurationOptionShouldBeAsked)shouldMasterAvatarDetailsBeAsked); 302 NetworkServersInfo.DefaultHttpListenerPort.ToString(), false);
324 configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false, (ConfigurationOption.ConfigurationOptionShouldBeAsked)shouldMasterAvatarDetailsBeAsked); 303 configMember.addConfigurationOption("external_host_name",
304 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
305 "External Host Name", "127.0.0.1", false);
306 configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
307 "Master Avatar UUID", LLUUID.Zero.ToString(), true);
308 configMember.addConfigurationOption("estate_covanant_uuid",
309 ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Estate Covenant",
310 LLUUID.Zero.ToString(), true);
311 configMember.addConfigurationOption("master_avatar_first",
312 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
313 "First Name of Master Avatar", "Test", false,
314 (ConfigurationOption.ConfigurationOptionShouldBeAsked)
315 shouldMasterAvatarDetailsBeAsked);
316 configMember.addConfigurationOption("master_avatar_last",
317 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
318 "Last Name of Master Avatar", "User", false,
319 (ConfigurationOption.ConfigurationOptionShouldBeAsked)
320 shouldMasterAvatarDetailsBeAsked);
321 configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
322 "(Sandbox Mode Only)Password for Master Avatar account", "test", false,
323 (ConfigurationOption.ConfigurationOptionShouldBeAsked)
324 shouldMasterAvatarDetailsBeAsked);
325 } 325 }
326 326
327 public bool shouldMasterAvatarDetailsBeAsked(string configuration_key) 327 public bool shouldMasterAvatarDetailsBeAsked(string configuration_key)
@@ -338,58 +338,57 @@ namespace OpenSim.Framework
338 switch (configuration_key) 338 switch (configuration_key)
339 { 339 {
340 case "sim_UUID": 340 case "sim_UUID":
341 this.RegionID = (LLUUID)configuration_result; 341 RegionID = (LLUUID) configuration_result;
342 break; 342 break;
343 case "sim_name": 343 case "sim_name":
344 this.RegionName = (string)configuration_result; 344 RegionName = (string) configuration_result;
345 break; 345 break;
346 case "sim_location_x": 346 case "sim_location_x":
347 this.m_regionLocX = (uint)configuration_result; 347 m_regionLocX = (uint) configuration_result;
348 break; 348 break;
349 case "sim_location_y": 349 case "sim_location_y":
350 this.m_regionLocY = (uint)configuration_result; 350 m_regionLocY = (uint) configuration_result;
351 break; 351 break;
352 case "datastore": 352 case "datastore":
353 this.DataStore = (string)configuration_result; 353 DataStore = (string) configuration_result;
354 break; 354 break;
355 case "internal_ip_address": 355 case "internal_ip_address":
356 IPAddress address = (IPAddress)configuration_result; 356 IPAddress address = (IPAddress) configuration_result;
357 this.m_internalEndPoint = new IPEndPoint(address, 0); 357 m_internalEndPoint = new IPEndPoint(address, 0);
358 break; 358 break;
359 case "internal_ip_port": 359 case "internal_ip_port":
360 this.m_internalEndPoint.Port = (int)configuration_result; 360 m_internalEndPoint.Port = (int) configuration_result;
361 break; 361 break;
362 case "external_host_name": 362 case "external_host_name":
363 if ((string)configuration_result != "SYSTEMIP") 363 if ((string) configuration_result != "SYSTEMIP")
364 { 364 {
365 this.m_externalHostName = (string)configuration_result; 365 m_externalHostName = (string) configuration_result;
366 } 366 }
367 else 367 else
368 { 368 {
369 this.m_externalHostName = Util.GetLocalHost().ToString(); 369 m_externalHostName = Util.GetLocalHost().ToString();
370 } 370 }
371 break; 371 break;
372 case "master_avatar_uuid": 372 case "master_avatar_uuid":
373 this.MasterAvatarAssignedUUID = (LLUUID)configuration_result; 373 MasterAvatarAssignedUUID = (LLUUID) configuration_result;
374 break; 374 break;
375 case "estate_covanant_uuid": 375 case "estate_covanant_uuid":
376 this.CovenantID = (LLUUID)configuration_result; 376 CovenantID = (LLUUID) configuration_result;
377 break; 377 break;
378 378
379 case "master_avatar_first": 379 case "master_avatar_first":
380 this.MasterAvatarFirstName = (string)configuration_result; 380 MasterAvatarFirstName = (string) configuration_result;
381 break; 381 break;
382 case "master_avatar_last": 382 case "master_avatar_last":
383 this.MasterAvatarLastName = (string)configuration_result; 383 MasterAvatarLastName = (string) configuration_result;
384 break; 384 break;
385 case "master_avatar_pass": 385 case "master_avatar_pass":
386 string tempMD5Passwd = (string)configuration_result; 386 string tempMD5Passwd = (string) configuration_result;
387 this.MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); 387 MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
388 break; 388 break;
389 } 389 }
390 390
391 return true; 391 return true;
392 } 392 }
393
394 } 393 }
395} 394} \ No newline at end of file