diff options
author | mingchen | 2007-11-03 15:09:21 +0000 |
---|---|---|
committer | mingchen | 2007-11-03 15:09:21 +0000 |
commit | 51488ee7f415950583ba389582692900a2c32831 (patch) | |
tree | 7b63fdbb54e9a1bbb3ae7a6ed8d6eac8933e8dbb /OpenSim/Framework | |
parent | testing different rest post method/class for Grid asset client. (possible tha... (diff) | |
download | opensim-SC_OLD-51488ee7f415950583ba389582692900a2c32831.zip opensim-SC_OLD-51488ee7f415950583ba389582692900a2c32831.tar.gz opensim-SC_OLD-51488ee7f415950583ba389582692900a2c32831.tar.bz2 opensim-SC_OLD-51488ee7f415950583ba389582692900a2c32831.tar.xz |
*Moved region loading into its own interface IRegionLoader
*Added ability to load regioninfo remotely from a webserver from a single file. See share/RegionLoading/HOWTO_REMOTE_REGION_LOADING.txt for more info and an example file.
Diffstat (limited to 'OpenSim/Framework')
7 files changed, 605 insertions, 156 deletions
diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs index b68896c..19275b3 100644 --- a/OpenSim/Framework/ConfigurationMember.cs +++ b/OpenSim/Framework/ConfigurationMember.cs | |||
@@ -27,49 +27,57 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Reflection; | ||
31 | using System.Collections; | ||
30 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
31 | using System.Globalization; | 33 | using System.Text; |
32 | using System.Net; | 34 | using System.Net; |
33 | using System.Reflection; | 35 | using System.Xml; |
36 | |||
34 | using libsecondlife; | 37 | using libsecondlife; |
38 | |||
35 | using OpenSim.Framework.Console; | 39 | using OpenSim.Framework.Console; |
40 | using OpenSim.Framework; | ||
41 | using System.Globalization; | ||
36 | 42 | ||
37 | namespace OpenSim.Framework | 43 | namespace OpenSim.Framework |
38 | { | 44 | { |
39 | public class ConfigurationMember | 45 | public class ConfigurationMember |
40 | { | 46 | { |
41 | public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); | 47 | public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); |
42 | |||
43 | public delegate void ConfigurationOptionsLoad(); | 48 | public delegate void ConfigurationOptionsLoad(); |
44 | 49 | ||
45 | private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>(); | 50 | private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>(); |
46 | private string configurationFilename = ""; | 51 | private string configurationFilename = ""; |
47 | private string configurationDescription = ""; | 52 | private string configurationDescription = ""; |
48 | 53 | private XmlNode configurationFromXMLNode = null; | |
49 | private ConfigurationOptionsLoad loadFunction; | 54 | private ConfigurationOptionsLoad loadFunction; |
50 | private ConfigurationOptionResult resultFunction; | 55 | private ConfigurationOptionResult resultFunction; |
51 | 56 | ||
52 | private IGenericConfig configurationPlugin = null; | 57 | private IGenericConfig configurationPlugin = null; |
53 | |||
54 | /// <summary> | 58 | /// <summary> |
55 | /// This is the default configuration DLL loaded | 59 | /// This is the default configuration DLL loaded |
56 | /// </summary> | 60 | /// </summary> |
57 | private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll"; | 61 | private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll"; |
58 | 62 | public ConfigurationMember(string configuration_filename, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) | |
59 | public ConfigurationMember(string configuration_filename, string configuration_description, | ||
60 | ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) | ||
61 | { | 63 | { |
62 | configurationFilename = configuration_filename; | 64 | this.configurationFilename = configuration_filename; |
63 | configurationDescription = configuration_description; | 65 | this.configurationDescription = configuration_description; |
64 | loadFunction = load_function; | 66 | this.loadFunction = load_function; |
65 | resultFunction = result_function; | 67 | this.resultFunction = result_function; |
68 | } | ||
69 | public ConfigurationMember(XmlNode configuration_xml, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) | ||
70 | { | ||
71 | this.configurationFilename = ""; | ||
72 | this.configurationFromXMLNode = configuration_xml; | ||
73 | this.configurationDescription = configuration_description; | ||
74 | this.loadFunction = load_function; | ||
75 | this.resultFunction = result_function; | ||
66 | } | 76 | } |
67 | |||
68 | public void setConfigurationFilename(string filename) | 77 | public void setConfigurationFilename(string filename) |
69 | { | 78 | { |
70 | configurationFilename = filename; | 79 | configurationFilename = filename; |
71 | } | 80 | } |
72 | |||
73 | public void setConfigurationDescription(string desc) | 81 | public void setConfigurationDescription(string desc) |
74 | { | 82 | { |
75 | configurationDescription = desc; | 83 | configurationDescription = desc; |
@@ -84,11 +92,7 @@ namespace OpenSim.Framework | |||
84 | { | 92 | { |
85 | configurationPluginFilename = dll_filename; | 93 | configurationPluginFilename = dll_filename; |
86 | } | 94 | } |
87 | 95 | public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt) | |
88 | public void addConfigurationOption(string configuration_key, | ||
89 | ConfigurationOption.ConfigurationTypes configuration_type, | ||
90 | string configuration_question, string configuration_default, | ||
91 | bool use_default_no_prompt) | ||
92 | { | 96 | { |
93 | ConfigurationOption configOption = new ConfigurationOption(); | 97 | ConfigurationOption configOption = new ConfigurationOption(); |
94 | configOption.configurationKey = configuration_key; | 98 | configOption.configurationKey = configuration_key; |
@@ -97,8 +101,7 @@ namespace OpenSim.Framework | |||
97 | configOption.configurationType = configuration_type; | 101 | configOption.configurationType = configuration_type; |
98 | configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; | 102 | configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; |
99 | 103 | ||
100 | if ((configuration_key != "" && configuration_question != "") || | 104 | if ((configuration_key != "" && configuration_question != "") || (configuration_key != "" && use_default_no_prompt)) |
101 | (configuration_key != "" && use_default_no_prompt)) | ||
102 | { | 105 | { |
103 | if (!configurationOptions.Contains(configOption)) | 106 | if (!configurationOptions.Contains(configOption)) |
104 | { | 107 | { |
@@ -107,37 +110,32 @@ namespace OpenSim.Framework | |||
107 | } | 110 | } |
108 | else | 111 | else |
109 | { | 112 | { |
110 | MainLog.Instance.Notice( | 113 | MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + configuration_key + ")"); |
111 | "Required fields for adding a configuration option is invalid. Will not add this option (" + | ||
112 | configuration_key + ")"); | ||
113 | } | 114 | } |
114 | } | 115 | } |
115 | 116 | ||
116 | public void performConfigurationRetrieve() | 117 | public void performConfigurationRetrieve() |
117 | { | 118 | { |
118 | configurationPlugin = LoadConfigDll(configurationPluginFilename); | 119 | configurationPlugin = this.LoadConfigDll(configurationPluginFilename); |
119 | configurationOptions.Clear(); | 120 | configurationOptions.Clear(); |
120 | if (loadFunction == null) | 121 | if(loadFunction == null) |
121 | { | 122 | { |
122 | MainLog.Instance.Error("Load Function for '" + configurationDescription + | 123 | MainLog.Instance.Error("Load Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); |
123 | "' is null. Refusing to run configuration."); | ||
124 | return; | 124 | return; |
125 | } | 125 | } |
126 | 126 | ||
127 | if (resultFunction == null) | 127 | if(resultFunction == null) |
128 | { | 128 | { |
129 | MainLog.Instance.Error("Result Function for '" + configurationDescription + | 129 | MainLog.Instance.Error("Result Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); |
130 | "' is null. Refusing to run configuration."); | ||
131 | return; | 130 | return; |
132 | } | 131 | } |
133 | 132 | ||
134 | MainLog.Instance.Verbose("Calling Configuration Load Function..."); | 133 | MainLog.Instance.Verbose("Calling Configuration Load Function..."); |
135 | loadFunction(); | 134 | this.loadFunction(); |
136 | 135 | ||
137 | if (configurationOptions.Count <= 0) | 136 | if(configurationOptions.Count <= 0) |
138 | { | 137 | { |
139 | MainLog.Instance.Error("No configuration options were specified for '" + configurationOptions + | 138 | MainLog.Instance.Error("No configuration options were specified for '" + this.configurationOptions + "'. Refusing to continue configuration."); |
140 | "'. Refusing to continue configuration."); | ||
141 | return; | 139 | return; |
142 | } | 140 | } |
143 | 141 | ||
@@ -156,6 +154,12 @@ namespace OpenSim.Framework | |||
156 | } | 154 | } |
157 | else | 155 | else |
158 | { | 156 | { |
157 | if (this.configurationFromXMLNode != null) | ||
158 | { | ||
159 | MainLog.Instance.Notice("Loading from XML Node, will not save to the file"); | ||
160 | configurationPlugin.LoadDataFromString(configurationFromXMLNode.OuterXml); | ||
161 | } | ||
162 | |||
159 | MainLog.Instance.Notice("XML Configuration Filename is not valid; will not save to the file."); | 163 | MainLog.Instance.Notice("XML Configuration Filename is not valid; will not save to the file."); |
160 | useFile = false; | 164 | useFile = false; |
161 | } | 165 | } |
@@ -168,9 +172,10 @@ namespace OpenSim.Framework | |||
168 | bool ignoreNextFromConfig = false; | 172 | bool ignoreNextFromConfig = false; |
169 | while (convertSuccess == false) | 173 | while (convertSuccess == false) |
170 | { | 174 | { |
175 | |||
171 | string console_result = ""; | 176 | string console_result = ""; |
172 | string attribute = null; | 177 | string attribute = null; |
173 | if (useFile) | 178 | if (useFile || (!useFile && configurationFromXMLNode != null)) |
174 | { | 179 | { |
175 | if (!ignoreNextFromConfig) | 180 | if (!ignoreNextFromConfig) |
176 | { | 181 | { |
@@ -190,20 +195,16 @@ namespace OpenSim.Framework | |||
190 | } | 195 | } |
191 | else | 196 | else |
192 | { | 197 | { |
198 | |||
193 | if (configurationDescription.Trim() != "") | 199 | if (configurationDescription.Trim() != "") |
194 | { | 200 | { |
195 | console_result = | 201 | console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); |
196 | MainLog.Instance.CmdPrompt( | ||
197 | configurationDescription + ": " + configOption.configurationQuestion, | ||
198 | configOption.configurationDefault); | ||
199 | } | 202 | } |
200 | else | 203 | else |
201 | { | 204 | { |
202 | console_result = | 205 | console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); |
203 | MainLog.Instance.CmdPrompt(configOption.configurationQuestion, | ||
204 | configOption.configurationDefault); | ||
205 | } | 206 | } |
206 | } | 207 | } |
207 | } | 208 | } |
208 | else | 209 | else |
209 | { | 210 | { |
@@ -266,6 +267,7 @@ namespace OpenSim.Framework | |||
266 | { | 267 | { |
267 | convertSuccess = true; | 268 | convertSuccess = true; |
268 | return_result = intResult; | 269 | return_result = intResult; |
270 | |||
269 | } | 271 | } |
270 | errorMessage = "a signed 32 bit integer (int)"; | 272 | errorMessage = "a signed 32 bit integer (int)"; |
271 | break; | 273 | break; |
@@ -320,6 +322,7 @@ namespace OpenSim.Framework | |||
320 | { | 322 | { |
321 | convertSuccess = true; | 323 | convertSuccess = true; |
322 | return_result = uintResult; | 324 | return_result = uintResult; |
325 | |||
323 | } | 326 | } |
324 | errorMessage = "an unsigned 32 bit integer (uint)"; | 327 | errorMessage = "an unsigned 32 bit integer (uint)"; |
325 | break; | 328 | break; |
@@ -334,9 +337,7 @@ namespace OpenSim.Framework | |||
334 | break; | 337 | break; |
335 | case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: | 338 | case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: |
336 | float floatResult; | 339 | float floatResult; |
337 | if ( | 340 | if (float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out floatResult)) |
338 | float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, | ||
339 | out floatResult)) | ||
340 | { | 341 | { |
341 | convertSuccess = true; | 342 | convertSuccess = true; |
342 | return_result = floatResult; | 343 | return_result = floatResult; |
@@ -345,9 +346,7 @@ namespace OpenSim.Framework | |||
345 | break; | 346 | break; |
346 | case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: | 347 | case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: |
347 | double doubleResult; | 348 | double doubleResult; |
348 | if ( | 349 | if (Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out doubleResult)) |
349 | Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, | ||
350 | out doubleResult)) | ||
351 | { | 350 | { |
352 | convertSuccess = true; | 351 | convertSuccess = true; |
353 | return_result = doubleResult; | 352 | return_result = doubleResult; |
@@ -364,10 +363,9 @@ namespace OpenSim.Framework | |||
364 | } | 363 | } |
365 | 364 | ||
366 | 365 | ||
367 | if (!resultFunction(configOption.configurationKey, return_result)) | 366 | if (!this.resultFunction(configOption.configurationKey, return_result)) |
368 | { | 367 | { |
369 | MainLog.Instance.Notice( | 368 | Console.MainLog.Instance.Notice("The handler for the last configuration option denied that input, please try again."); |
370 | "The handler for the last configuration option denied that input, please try again."); | ||
371 | convertSuccess = false; | 369 | convertSuccess = false; |
372 | ignoreNextFromConfig = true; | 370 | ignoreNextFromConfig = true; |
373 | } | 371 | } |
@@ -376,27 +374,19 @@ namespace OpenSim.Framework | |||
376 | { | 374 | { |
377 | if (configOption.configurationUseDefaultNoPrompt) | 375 | if (configOption.configurationUseDefaultNoPrompt) |
378 | { | 376 | { |
379 | MainLog.Instance.Error("CONFIG", | 377 | MainLog.Instance.Error("CONFIG", string.Format("[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename)); |
380 | string.Format( | ||
381 | "[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", | ||
382 | configOption.configurationKey, console_result, errorMessage, | ||
383 | configurationFilename)); | ||
384 | convertSuccess = true; | 378 | convertSuccess = true; |
385 | } | 379 | } |
386 | else | 380 | else |
387 | { | 381 | { |
388 | MainLog.Instance.Warn("CONFIG", | 382 | MainLog.Instance.Warn("CONFIG", string.Format("[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename)); |
389 | string.Format( | ||
390 | "[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", | ||
391 | configOption.configurationKey, console_result, errorMessage, | ||
392 | configurationFilename)); | ||
393 | ignoreNextFromConfig = true; | 383 | ignoreNextFromConfig = true; |
394 | } | 384 | } |
395 | } | 385 | } |
396 | } | 386 | } |
397 | } | 387 | } |
398 | 388 | ||
399 | if (useFile) | 389 | if(useFile) |
400 | { | 390 | { |
401 | configurationPlugin.Commit(); | 391 | configurationPlugin.Commit(); |
402 | configurationPlugin.Close(); | 392 | configurationPlugin.Close(); |
@@ -418,8 +408,7 @@ namespace OpenSim.Framework | |||
418 | 408 | ||
419 | if (typeInterface != null) | 409 | if (typeInterface != null) |
420 | { | 410 | { |
421 | plug = | 411 | plug = (IGenericConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
422 | (IGenericConfig) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
423 | } | 412 | } |
424 | } | 413 | } |
425 | } | 414 | } |
@@ -431,10 +420,10 @@ namespace OpenSim.Framework | |||
431 | 420 | ||
432 | public void forceSetConfigurationOption(string configuration_key, string configuration_value) | 421 | public void forceSetConfigurationOption(string configuration_key, string configuration_value) |
433 | { | 422 | { |
434 | configurationPlugin.LoadData(); | 423 | this.configurationPlugin.LoadData(); |
435 | configurationPlugin.SetAttribute(configuration_key, configuration_value); | 424 | this.configurationPlugin.SetAttribute(configuration_key, configuration_value); |
436 | configurationPlugin.Commit(); | 425 | this.configurationPlugin.Commit(); |
437 | configurationPlugin.Close(); | 426 | this.configurationPlugin.Close(); |
438 | } | 427 | } |
439 | } | 428 | } |
440 | } \ No newline at end of file | 429 | } |
diff --git a/OpenSim/Framework/IRegionLoader.cs b/OpenSim/Framework/IRegionLoader.cs new file mode 100644 index 0000000..516a886 --- /dev/null +++ b/OpenSim/Framework/IRegionLoader.cs | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Framework; | ||
33 | using Nini.Config; | ||
34 | namespace OpenSim.Framework | ||
35 | { | ||
36 | public interface IRegionLoader | ||
37 | { | ||
38 | void SetIniConfigSource(IniConfigSource configSource); | ||
39 | RegionInfo[] LoadRegions(); | ||
40 | } | ||
41 | } | ||
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 1257849..a32b43c 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -26,10 +26,16 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Globalization; | ||
29 | using System.Net; | 30 | using System.Net; |
31 | using System.Xml; | ||
30 | using System.Net.Sockets; | 32 | using System.Net.Sockets; |
31 | using libsecondlife; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
34 | using libsecondlife; | ||
35 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Framework; | ||
37 | |||
38 | |||
33 | 39 | ||
34 | namespace OpenSim.Framework | 40 | namespace OpenSim.Framework |
35 | { | 41 | { |
@@ -41,6 +47,7 @@ namespace OpenSim.Framework | |||
41 | 47 | ||
42 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | 48 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) |
43 | { | 49 | { |
50 | |||
44 | m_regionLocX = regionLocX; | 51 | m_regionLocX = regionLocX; |
45 | m_regionLocY = regionLocY; | 52 | m_regionLocY = regionLocY; |
46 | 53 | ||
@@ -50,6 +57,7 @@ namespace OpenSim.Framework | |||
50 | 57 | ||
51 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) | 58 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) |
52 | { | 59 | { |
60 | |||
53 | m_regionLocX = regionLocX; | 61 | m_regionLocX = regionLocX; |
54 | m_regionLocY = regionLocY; | 62 | m_regionLocY = regionLocY; |
55 | 63 | ||
@@ -61,11 +69,16 @@ namespace OpenSim.Framework | |||
61 | public LLUUID RegionID = new LLUUID(); | 69 | public LLUUID RegionID = new LLUUID(); |
62 | 70 | ||
63 | private uint m_remotingPort; | 71 | private uint m_remotingPort; |
64 | |||
65 | public uint RemotingPort | 72 | public uint RemotingPort |
66 | { | 73 | { |
67 | get { return m_remotingPort; } | 74 | get |
68 | set { m_remotingPort = value; } | 75 | { |
76 | return m_remotingPort; | ||
77 | } | ||
78 | set | ||
79 | { | ||
80 | m_remotingPort = value; | ||
81 | } | ||
69 | } | 82 | } |
70 | 83 | ||
71 | public string RemotingAddress; | 84 | public string RemotingAddress; |
@@ -98,49 +111,76 @@ namespace OpenSim.Framework | |||
98 | ia = Adr; | 111 | ia = Adr; |
99 | break; | 112 | break; |
100 | } | 113 | } |
114 | |||
101 | } | 115 | } |
102 | 116 | ||
103 | return new IPEndPoint(ia, m_internalEndPoint.Port); | 117 | return new IPEndPoint(ia, m_internalEndPoint.Port); |
104 | } | 118 | } |
105 | 119 | ||
106 | set { m_externalHostName = value.ToString(); } | 120 | set |
121 | { | ||
122 | m_externalHostName = value.ToString(); | ||
123 | } | ||
107 | } | 124 | } |
108 | 125 | ||
109 | protected string m_externalHostName; | 126 | protected string m_externalHostName; |
110 | |||
111 | public string ExternalHostName | 127 | public string ExternalHostName |
112 | { | 128 | { |
113 | get { return m_externalHostName; } | 129 | get |
114 | set { m_externalHostName = value; } | 130 | { |
131 | return m_externalHostName; | ||
132 | } | ||
133 | set | ||
134 | { | ||
135 | m_externalHostName = value; | ||
136 | } | ||
115 | } | 137 | } |
116 | 138 | ||
117 | protected IPEndPoint m_internalEndPoint; | 139 | protected IPEndPoint m_internalEndPoint; |
118 | |||
119 | public IPEndPoint InternalEndPoint | 140 | public IPEndPoint InternalEndPoint |
120 | { | 141 | { |
121 | get { return m_internalEndPoint; } | 142 | get |
122 | set { m_internalEndPoint = value; } | 143 | { |
144 | return m_internalEndPoint; | ||
145 | } | ||
146 | set | ||
147 | { | ||
148 | m_internalEndPoint = value; | ||
149 | } | ||
123 | } | 150 | } |
124 | 151 | ||
125 | protected uint? m_regionLocX; | 152 | protected uint? m_regionLocX; |
126 | |||
127 | public uint RegionLocX | 153 | public uint RegionLocX |
128 | { | 154 | { |
129 | get { return m_regionLocX.Value; } | 155 | get |
130 | set { m_regionLocX = value; } | 156 | { |
157 | return m_regionLocX.Value; | ||
158 | } | ||
159 | set | ||
160 | { | ||
161 | m_regionLocX = value; | ||
162 | } | ||
131 | } | 163 | } |
132 | 164 | ||
133 | protected uint? m_regionLocY; | 165 | protected uint? m_regionLocY; |
134 | |||
135 | public uint RegionLocY | 166 | public uint RegionLocY |
136 | { | 167 | { |
137 | get { return m_regionLocY.Value; } | 168 | get |
138 | set { m_regionLocY = value; } | 169 | { |
170 | return m_regionLocY.Value; | ||
171 | } | ||
172 | set | ||
173 | { | ||
174 | m_regionLocY = value; | ||
175 | } | ||
139 | } | 176 | } |
140 | 177 | ||
141 | public ulong RegionHandle | 178 | public ulong RegionHandle |
142 | { | 179 | { |
143 | get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); } | 180 | get |
181 | { | ||
182 | return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | ||
183 | } | ||
144 | } | 184 | } |
145 | } | 185 | } |
146 | 186 | ||
@@ -158,81 +198,84 @@ namespace OpenSim.Framework | |||
158 | 198 | ||
159 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. | 199 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. |
160 | private static EstateSettings m_estateSettings; | 200 | private static EstateSettings m_estateSettings; |
161 | |||
162 | public EstateSettings EstateSettings | 201 | public EstateSettings EstateSettings |
163 | { | 202 | { |
164 | get | 203 | get |
165 | { | 204 | { |
166 | if (m_estateSettings == null) | 205 | if( m_estateSettings == null ) |
167 | { | 206 | { |
168 | m_estateSettings = new EstateSettings(); | 207 | m_estateSettings = new EstateSettings(); |
169 | } | 208 | } |
170 | 209 | ||
171 | return m_estateSettings; | 210 | return m_estateSettings; |
172 | } | 211 | } |
212 | |||
173 | } | 213 | } |
174 | 214 | ||
175 | public ConfigurationMember configMember; | 215 | public ConfigurationMember configMember; |
176 | |||
177 | public RegionInfo(string description, string filename) | 216 | public RegionInfo(string description, string filename) |
178 | { | 217 | { |
179 | configMember = | 218 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); |
180 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); | 219 | configMember.performConfigurationRetrieve(); |
220 | } | ||
221 | public RegionInfo(string description, XmlNode xmlNode) | ||
222 | { | ||
223 | configMember = new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration); | ||
181 | configMember.performConfigurationRetrieve(); | 224 | configMember.performConfigurationRetrieve(); |
182 | } | 225 | } |
183 | |||
184 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : | 226 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : |
185 | base(regionLocX, regionLocY, internalEndPoint, externalUri) | 227 | base(regionLocX, regionLocY, internalEndPoint, externalUri) |
186 | { | 228 | { |
229 | |||
230 | |||
187 | } | 231 | } |
188 | 232 | ||
189 | public RegionInfo() | 233 | public RegionInfo() |
190 | { | 234 | { |
235 | |||
191 | } | 236 | } |
192 | 237 | ||
193 | //not in use, should swap to nini though. | 238 | //not in use, should swap to nini though. |
194 | public void LoadFromNiniSource(IConfigSource source) | 239 | public void LoadFromNiniSource(IConfigSource source) |
195 | { | 240 | { |
196 | LoadFromNiniSource(source, "RegionInfo"); | 241 | this.LoadFromNiniSource(source, "RegionInfo"); |
197 | } | 242 | } |
198 | 243 | ||
199 | //not in use, should swap to nini though. | 244 | //not in use, should swap to nini though. |
200 | public void LoadFromNiniSource(IConfigSource source, string sectionName) | 245 | public void LoadFromNiniSource(IConfigSource source, string sectionName) |
201 | { | 246 | { |
202 | string errorMessage = ""; | 247 | string errorMessage = ""; |
203 | RegionID = | 248 | this.RegionID = new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated())); |
204 | new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated())); | 249 | this.RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); |
205 | RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); | 250 | this.m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); |
206 | m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); | 251 | this.m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); |
207 | m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); | 252 | this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); |
208 | DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); | ||
209 | 253 | ||
210 | string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); | 254 | string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); |
211 | IPAddress ipAddressResult; | 255 | IPAddress ipAddressResult; |
212 | if (IPAddress.TryParse(ipAddress, out ipAddressResult)) | 256 | if (IPAddress.TryParse(ipAddress, out ipAddressResult)) |
213 | { | 257 | { |
214 | m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); | 258 | this.m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); |
215 | } | 259 | } |
216 | else | 260 | else |
217 | { | 261 | { |
218 | errorMessage = "needs an IP Address (IPAddress)"; | 262 | errorMessage = "needs an IP Address (IPAddress)"; |
219 | } | 263 | } |
220 | m_internalEndPoint.Port = | 264 | this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort); |
221 | source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort); | ||
222 | 265 | ||
223 | string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); | 266 | string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); |
224 | if (externalHost != "SYSTEMIP") | 267 | if (externalHost != "SYSTEMIP") |
225 | { | 268 | { |
226 | m_externalHostName = externalHost; | 269 | this.m_externalHostName = externalHost; |
227 | } | 270 | } |
228 | else | 271 | else |
229 | { | 272 | { |
230 | m_externalHostName = Util.GetLocalHost().ToString(); | 273 | this.m_externalHostName = Util.GetLocalHost().ToString(); |
231 | } | 274 | } |
232 | 275 | ||
233 | MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); | 276 | this.MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); |
234 | MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); | 277 | this.MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); |
235 | MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); | 278 | this.MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); |
236 | 279 | ||
237 | if (errorMessage != "") | 280 | if (errorMessage != "") |
238 | { | 281 | { |
@@ -242,36 +285,17 @@ namespace OpenSim.Framework | |||
242 | 285 | ||
243 | public void loadConfigurationOptions() | 286 | public void loadConfigurationOptions() |
244 | { | 287 | { |
245 | configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, | 288 | configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Region (Default is recommended, random UUID)", LLUUID.Random().ToString(), true); |
246 | "UUID of Region (Default is recommended, random UUID)", | 289 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Region Name", "OpenSim Test", false); |
247 | LLUUID.Random().ToString(), true); | 290 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); |
248 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | 291 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); |
249 | "Region Name", "OpenSim Test", false); | 292 | configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); |
250 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | 293 | configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); |
251 | "Grid Location (X Axis)", "1000", false); | 294 | configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); |
252 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | 295 | configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); |
253 | "Grid Location (Y Axis)", "1000", false); | 296 | configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false); |
254 | configMember.addConfigurationOption("datastore", | 297 | configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false); |
255 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | 298 | configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false); |
256 | "Filename for local storage", "OpenSim.db", false); | ||
257 | configMember.addConfigurationOption("internal_ip_address", | ||
258 | ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, | ||
259 | "Internal IP Address for incoming UDP client connections", "0.0.0.0", | ||
260 | false); | ||
261 | configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
262 | "Internal IP Port for incoming UDP client connections", | ||
263 | NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); | ||
264 | configMember.addConfigurationOption("external_host_name", | ||
265 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
266 | "External Host Name", "127.0.0.1", false); | ||
267 | configMember.addConfigurationOption("master_avatar_first", | ||
268 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
269 | "First Name of Master Avatar", "Test", false); | ||
270 | configMember.addConfigurationOption("master_avatar_last", | ||
271 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
272 | "Last Name of Master Avatar", "User", false); | ||
273 | configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
274 | "(Sandbox Mode Only)Password for Master Avatar account", "test", false); | ||
275 | } | 299 | } |
276 | 300 | ||
277 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | 301 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) |
@@ -279,50 +303,51 @@ namespace OpenSim.Framework | |||
279 | switch (configuration_key) | 303 | switch (configuration_key) |
280 | { | 304 | { |
281 | case "sim_UUID": | 305 | case "sim_UUID": |
282 | RegionID = (LLUUID) configuration_result; | 306 | this.RegionID = (LLUUID)configuration_result; |
283 | break; | 307 | break; |
284 | case "sim_name": | 308 | case "sim_name": |
285 | RegionName = (string) configuration_result; | 309 | this.RegionName = (string)configuration_result; |
286 | break; | 310 | break; |
287 | case "sim_location_x": | 311 | case "sim_location_x": |
288 | m_regionLocX = (uint) configuration_result; | 312 | this.m_regionLocX = (uint)configuration_result; |
289 | break; | 313 | break; |
290 | case "sim_location_y": | 314 | case "sim_location_y": |
291 | m_regionLocY = (uint) configuration_result; | 315 | this.m_regionLocY = (uint)configuration_result; |
292 | break; | 316 | break; |
293 | case "datastore": | 317 | case "datastore": |
294 | DataStore = (string) configuration_result; | 318 | this.DataStore = (string)configuration_result; |
295 | break; | 319 | break; |
296 | case "internal_ip_address": | 320 | case "internal_ip_address": |
297 | IPAddress address = (IPAddress) configuration_result; | 321 | IPAddress address = (IPAddress)configuration_result; |
298 | m_internalEndPoint = new IPEndPoint(address, 0); | 322 | this.m_internalEndPoint = new IPEndPoint(address, 0); |
299 | break; | 323 | break; |
300 | case "internal_ip_port": | 324 | case "internal_ip_port": |
301 | m_internalEndPoint.Port = (int) configuration_result; | 325 | this.m_internalEndPoint.Port = (int)configuration_result; |
302 | break; | 326 | break; |
303 | case "external_host_name": | 327 | case "external_host_name": |
304 | if ((string) configuration_result != "SYSTEMIP") | 328 | if ((string)configuration_result != "SYSTEMIP") |
305 | { | 329 | { |
306 | m_externalHostName = (string) configuration_result; | 330 | this.m_externalHostName = (string)configuration_result; |
307 | } | 331 | } |
308 | else | 332 | else |
309 | { | 333 | { |
310 | m_externalHostName = Util.GetLocalHost().ToString(); | 334 | this.m_externalHostName = Util.GetLocalHost().ToString(); |
311 | } | 335 | } |
312 | break; | 336 | break; |
313 | case "master_avatar_first": | 337 | case "master_avatar_first": |
314 | MasterAvatarFirstName = (string) configuration_result; | 338 | this.MasterAvatarFirstName = (string)configuration_result; |
315 | break; | 339 | break; |
316 | case "master_avatar_last": | 340 | case "master_avatar_last": |
317 | MasterAvatarLastName = (string) configuration_result; | 341 | this.MasterAvatarLastName = (string)configuration_result; |
318 | break; | 342 | break; |
319 | case "master_avatar_pass": | 343 | case "master_avatar_pass": |
320 | string tempMD5Passwd = (string) configuration_result; | 344 | string tempMD5Passwd = (string)configuration_result; |
321 | MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); | 345 | this.MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); |
322 | break; | 346 | break; |
323 | } | 347 | } |
324 | 348 | ||
325 | return true; | 349 | return true; |
326 | } | 350 | } |
351 | |||
327 | } | 352 | } |
328 | } \ No newline at end of file | 353 | } |
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/OpenSim.Framework.RegionLoader.Filesystem.csproj b/OpenSim/Framework/RegionLoader/Filesystem/OpenSim.Framework.RegionLoader.Filesystem.csproj new file mode 100644 index 0000000..d353d1b --- /dev/null +++ b/OpenSim/Framework/RegionLoader/Filesystem/OpenSim.Framework.RegionLoader.Filesystem.csproj | |||
@@ -0,0 +1,112 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{9A0DA098-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Framework.RegionLoader.Filesystem</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Framework.RegionLoader.Filesystem</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Db4objects.Db4o.dll" > | ||
62 | <HintPath>..\..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="Nini.dll" > | ||
70 | <HintPath>..\..\..\..\bin\Nini.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System" > | ||
74 | <HintPath>System.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | <Reference Include="XMLRPC.dll" > | ||
82 | <HintPath>..\..\..\..\bin\XMLRPC.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
85 | </ItemGroup> | ||
86 | <ItemGroup> | ||
87 | <ProjectReference Include="..\..\OpenSim.Framework.csproj"> | ||
88 | <Name>OpenSim.Framework</Name> | ||
89 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
90 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
91 | <Private>False</Private> | ||
92 | </ProjectReference> | ||
93 | <ProjectReference Include="..\..\Console\OpenSim.Framework.Console.csproj"> | ||
94 | <Name>OpenSim.Framework.Console</Name> | ||
95 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
96 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
97 | <Private>False</Private> | ||
98 | </ProjectReference> | ||
99 | </ItemGroup> | ||
100 | <ItemGroup> | ||
101 | <Compile Include="RegionLoaderFileSystem.cs"> | ||
102 | <SubType>Code</SubType> | ||
103 | </Compile> | ||
104 | </ItemGroup> | ||
105 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
106 | <PropertyGroup> | ||
107 | <PreBuildEvent> | ||
108 | </PreBuildEvent> | ||
109 | <PostBuildEvent> | ||
110 | </PostBuildEvent> | ||
111 | </PropertyGroup> | ||
112 | </Project> | ||
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs new file mode 100644 index 0000000..5ebcb64 --- /dev/null +++ b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using Nini.Config; | ||
32 | using OpenSim.Framework; | ||
33 | using System.IO; | ||
34 | |||
35 | namespace OpenSim.Framework.RegionLoader.Filesystem | ||
36 | { | ||
37 | public class RegionLoaderFileSystem : IRegionLoader | ||
38 | { | ||
39 | public void SetIniConfigSource(IniConfigSource configSource) | ||
40 | { | ||
41 | } | ||
42 | public RegionInfo[] LoadRegions() | ||
43 | { | ||
44 | string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); | ||
45 | |||
46 | if (!Directory.Exists(regionConfigPath)) | ||
47 | { | ||
48 | Directory.CreateDirectory(regionConfigPath); | ||
49 | } | ||
50 | |||
51 | string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); | ||
52 | |||
53 | if (configFiles.Length == 0) | ||
54 | { | ||
55 | new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "default.xml")); | ||
56 | configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); | ||
57 | } | ||
58 | |||
59 | RegionInfo[] regionInfos = new RegionInfo[configFiles.Length]; | ||
60 | for (int i = 0; i < configFiles.Length; i++) | ||
61 | { | ||
62 | |||
63 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i]); | ||
64 | regionInfos[i] = regionInfo; | ||
65 | } | ||
66 | |||
67 | |||
68 | return regionInfos; | ||
69 | } | ||
70 | |||
71 | } | ||
72 | } | ||
diff --git a/OpenSim/Framework/RegionLoader/Web/OpenSim.Framework.RegionLoader.Web.csproj b/OpenSim/Framework/RegionLoader/Web/OpenSim.Framework.RegionLoader.Web.csproj new file mode 100644 index 0000000..18dcebf --- /dev/null +++ b/OpenSim/Framework/RegionLoader/Web/OpenSim.Framework.RegionLoader.Web.csproj | |||
@@ -0,0 +1,112 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{CA806165-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Framework.RegionLoader.Web</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Framework.RegionLoader.Web</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Db4objects.Db4o.dll" > | ||
62 | <HintPath>..\..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="Nini.dll" > | ||
70 | <HintPath>..\..\..\..\bin\Nini.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System" > | ||
74 | <HintPath>System.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | <Reference Include="XMLRPC.dll" > | ||
82 | <HintPath>..\..\..\..\bin\XMLRPC.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
85 | </ItemGroup> | ||
86 | <ItemGroup> | ||
87 | <ProjectReference Include="..\..\OpenSim.Framework.csproj"> | ||
88 | <Name>OpenSim.Framework</Name> | ||
89 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
90 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
91 | <Private>False</Private> | ||
92 | </ProjectReference> | ||
93 | <ProjectReference Include="..\..\Console\OpenSim.Framework.Console.csproj"> | ||
94 | <Name>OpenSim.Framework.Console</Name> | ||
95 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
96 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
97 | <Private>False</Private> | ||
98 | </ProjectReference> | ||
99 | </ItemGroup> | ||
100 | <ItemGroup> | ||
101 | <Compile Include="RegionLoaderWebServer.cs"> | ||
102 | <SubType>Code</SubType> | ||
103 | </Compile> | ||
104 | </ItemGroup> | ||
105 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
106 | <PropertyGroup> | ||
107 | <PreBuildEvent> | ||
108 | </PreBuildEvent> | ||
109 | <PostBuildEvent> | ||
110 | </PostBuildEvent> | ||
111 | </PropertyGroup> | ||
112 | </Project> | ||
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs new file mode 100644 index 0000000..6a52a43 --- /dev/null +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Net; | ||
30 | using System.IO; | ||
31 | using System.Xml; | ||
32 | using System.Collections.Generic; | ||
33 | using System.Text; | ||
34 | using Nini.Config; | ||
35 | using OpenSim.Framework; | ||
36 | |||
37 | namespace OpenSim.Framework.RegionLoader.Web | ||
38 | { | ||
39 | public class RegionLoaderWebServer : IRegionLoader | ||
40 | { | ||
41 | private IniConfigSource m_configSouce; | ||
42 | public void SetIniConfigSource(IniConfigSource configSource) | ||
43 | { | ||
44 | m_configSouce = configSource; | ||
45 | } | ||
46 | public RegionInfo[] LoadRegions() | ||
47 | { | ||
48 | if (m_configSouce == null) | ||
49 | { | ||
50 | Console.MainLog.Instance.Error("Unable to load configuration source! (WebServer Region Loader)"); | ||
51 | return null; | ||
52 | } | ||
53 | else | ||
54 | { | ||
55 | IniConfig startupConfig = (IniConfig)m_configSouce.Configs["Startup"]; | ||
56 | string url = startupConfig.GetString("regionload_webserver_url","").Trim(); | ||
57 | if (url == "") | ||
58 | { | ||
59 | Console.MainLog.Instance.Error("Unable to load webserver URL - URL was empty (WebServer Region Loader"); | ||
60 | return null; | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | |||
65 | HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); | ||
66 | webRequest.Timeout = 30000; //30 Second Timeout | ||
67 | Console.MainLog.Instance.Debug("Sending Download Request..."); | ||
68 | HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); | ||
69 | Console.MainLog.Instance.Debug("Downloading Region Information From Remote Server..."); | ||
70 | StreamReader reader = new StreamReader(webResponse.GetResponseStream()); | ||
71 | string xmlSource = ""; | ||
72 | string tempStr = reader.ReadLine(); | ||
73 | while (tempStr != null) | ||
74 | { | ||
75 | xmlSource = xmlSource + tempStr; | ||
76 | tempStr = reader.ReadLine(); | ||
77 | } | ||
78 | Console.MainLog.Instance.Debug("Done downloading region information from server. Total Bytes: " + xmlSource.Length); | ||
79 | XmlDocument xmlDoc = new XmlDocument(); | ||
80 | xmlDoc.LoadXml(xmlSource); | ||
81 | if (xmlDoc.FirstChild.Name == "Regions") | ||
82 | { | ||
83 | RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count]; | ||
84 | int i; | ||
85 | for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) | ||
86 | { | ||
87 | Console.MainLog.Instance.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); | ||
88 | regionInfos[i] = new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i]); | ||
89 | } | ||
90 | |||
91 | return regionInfos; | ||
92 | } | ||
93 | return null; | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | } | ||
98 | } | ||