aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General
diff options
context:
space:
mode:
authormingchen2007-07-18 23:15:08 +0000
committermingchen2007-07-18 23:15:08 +0000
commit222becc8795d8abd8263c8abf8212de91faa4748 (patch)
treeac0eb1b420c2f60975b759296c94813f41925798 /OpenSim/Framework/General
parent* Reverting 1371 (diff)
downloadopensim-SC_OLD-222becc8795d8abd8263c8abf8212de91faa4748.zip
opensim-SC_OLD-222becc8795d8abd8263c8abf8212de91faa4748.tar.gz
opensim-SC_OLD-222becc8795d8abd8263c8abf8212de91faa4748.tar.bz2
opensim-SC_OLD-222becc8795d8abd8263c8abf8212de91faa4748.tar.xz
*New Configuration System, much easier and less buggy compared to the original system in place
*View RegionInfo.cs for an example on how it works! *This hopefully copies all the files over, but who knows :)
Diffstat (limited to 'OpenSim/Framework/General')
-rw-r--r--OpenSim/Framework/General/AgentCircuitManager.cs2
-rw-r--r--OpenSim/Framework/General/Configuration/ConfigurationMember.cs311
-rw-r--r--OpenSim/Framework/General/Configuration/ConfigurationOption.cs34
-rw-r--r--OpenSim/Framework/General/Configuration/GridConfig.cs78
-rw-r--r--OpenSim/Framework/General/Configuration/Interfaces/IGenericConfig.cs38
-rw-r--r--OpenSim/Framework/General/Configuration/UserConfig.cs55
-rw-r--r--OpenSim/Framework/General/Configuration/XmlConfiguration.cs123
-rw-r--r--OpenSim/Framework/General/Types/NetworkServersInfo.cs216
-rw-r--r--OpenSim/Framework/General/Types/RegionInfo.cs244
9 files changed, 765 insertions, 336 deletions
diff --git a/OpenSim/Framework/General/AgentCircuitManager.cs b/OpenSim/Framework/General/AgentCircuitManager.cs
index c19d6b1..10b0430 100644
--- a/OpenSim/Framework/General/AgentCircuitManager.cs
+++ b/OpenSim/Framework/General/AgentCircuitManager.cs
@@ -30,7 +30,7 @@ using libsecondlife;
30using OpenSim.Framework.Interfaces; 30using OpenSim.Framework.Interfaces;
31using OpenSim.Framework.Types; 31using OpenSim.Framework.Types;
32 32
33namespace OpenSim.Framework 33namespace OpenSim.Framework.Types
34{ 34{
35 public class AgentCircuitManager 35 public class AgentCircuitManager
36 { 36 {
diff --git a/OpenSim/Framework/General/Configuration/ConfigurationMember.cs b/OpenSim/Framework/General/Configuration/ConfigurationMember.cs
new file mode 100644
index 0000000..2d945b5
--- /dev/null
+++ b/OpenSim/Framework/General/Configuration/ConfigurationMember.cs
@@ -0,0 +1,311 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Text;
5using System.Net;
6
7using libsecondlife;
8
9using OpenSim.Framework.Console;
10
11namespace OpenSim.Framework.Configuration
12{
13 public class ConfigurationMember
14 {
15 public delegate void ConfigurationOptionResult(string configuration_key, object configuration_result);
16 public delegate void ConfigurationOptionsLoad();
17
18 private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>();
19 private string configurationFilename = "";
20 private string configurationDescription = "";
21
22 private ConfigurationOptionsLoad loadFunction;
23 private ConfigurationOptionResult resultFunction;
24
25 public ConfigurationMember(string configuration_filename, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function)
26 {
27 this.configurationFilename = configuration_filename;
28 this.configurationDescription = configuration_description;
29 this.loadFunction = load_function;
30 this.resultFunction = result_function;
31 }
32
33 public void setConfigurationFilename(string filename)
34 {
35 configurationFilename = filename;
36 }
37 public void setConfigurationDescription(string desc)
38 {
39 configurationDescription = desc;
40 }
41
42 public void setConfigurationResultFunction(ConfigurationOptionResult result)
43 {
44 resultFunction = result;
45 }
46
47 public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default)
48 {
49 ConfigurationOption configOption = new ConfigurationOption();
50 configOption.configurationKey = configuration_key;
51 configOption.configurationQuestion = configuration_question;
52 configOption.configurationDefault = configuration_default;
53 configOption.configurationType = configuration_type;
54
55 if (configuration_key != "" && configuration_question != "" && configuration_type != null)
56 {
57 if (!configurationOptions.Contains(configOption))
58 {
59 configurationOptions.Add(configOption);
60 }
61 }
62 else
63 {
64 MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + configuration_key + ")");
65 }
66 }
67
68 public void performConfigurationRetrieve()
69 {
70 configurationOptions.Clear();
71 if(loadFunction == null)
72 {
73 MainLog.Instance.Error("Load Function for '" + this.configurationDescription + "' is null. Refusing to run configuration.");
74 return;
75 }
76
77 if(resultFunction == null)
78 {
79 MainLog.Instance.Error("Result Function for '" + this.configurationDescription + "' is null. Refusing to run configuration.");
80 return;
81 }
82
83 MainLog.Instance.Verbose("Calling Configuration Load Function...");
84 this.loadFunction();
85
86 if(configurationOptions.Count <= 0)
87 {
88 MainLog.Instance.Error("No configuration options were specified for '" + this.configurationOptions + "'. Refusing to continue configuration.");
89 return;
90 }
91
92 bool useFile = true;
93 XmlConfiguration xmlConfig = null;
94 if (configurationFilename.Trim() != "")
95 {
96 xmlConfig = new XmlConfiguration(configurationFilename);
97
98 }
99
100 if(xmlConfig != null)
101 {
102 xmlConfig.LoadData();
103 useFile = true;
104 }
105 else
106 {
107 MainLog.Instance.Notice("XML Configuration Filename is not valid; will not save to the file.");
108 useFile = false;
109 }
110
111 foreach (ConfigurationOption configOption in configurationOptions)
112 {
113 bool convertSuccess = false;
114 object return_result = null;
115 string errorMessage = "";
116 bool ignoreNextFromConfig = false;
117 while (convertSuccess == false)
118 {
119
120 string attribute = null;
121 if (useFile)
122 {
123 if (!ignoreNextFromConfig)
124 {
125 attribute = xmlConfig.GetAttribute(configOption.configurationKey);
126 }
127 else
128 {
129 ignoreNextFromConfig = false;
130 }
131 }
132
133 string console_result = "";
134 if (attribute == null)
135 {
136 if (configurationDescription.Trim() != "")
137 {
138 console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault);
139 }
140 else
141 {
142 console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault);
143 }
144 }
145 else
146 {
147 console_result = attribute;
148 }
149
150 switch (configOption.configurationType)
151 {
152 case ConfigurationOption.ConfigurationTypes.TYPE_STRING:
153 return_result = console_result;
154 convertSuccess = true;
155 break;
156 case ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN:
157 bool boolResult;
158 if (Boolean.TryParse(console_result, out boolResult))
159 {
160 convertSuccess = true;
161 return_result = boolResult;
162 }
163 errorMessage = "'true' or 'false' (Boolean)";
164 break;
165 case ConfigurationOption.ConfigurationTypes.TYPE_BYTE:
166 byte byteResult;
167 if (Byte.TryParse(console_result, out byteResult))
168 {
169 convertSuccess = true;
170 return_result = byteResult;
171 }
172 errorMessage = "a byte (Byte)";
173 break;
174 case ConfigurationOption.ConfigurationTypes.TYPE_CHARACTER:
175 char charResult;
176 if (Char.TryParse(console_result, out charResult))
177 {
178 convertSuccess = true;
179 return_result = charResult;
180 }
181 errorMessage = "a character (Char)";
182 break;
183 case ConfigurationOption.ConfigurationTypes.TYPE_INT16:
184 short shortResult;
185 if (Int16.TryParse(console_result, out shortResult))
186 {
187 convertSuccess = true;
188 return_result = shortResult;
189 }
190 errorMessage = "a signed 32 bit integer (short)";
191 break;
192 case ConfigurationOption.ConfigurationTypes.TYPE_INT32:
193 int intResult;
194 if (Int32.TryParse(console_result, out intResult))
195 {
196 convertSuccess = true;
197 return_result = intResult;
198
199 }
200 errorMessage = "a signed 32 bit integer (int)";
201 break;
202 case ConfigurationOption.ConfigurationTypes.TYPE_INT64:
203 long longResult;
204 if (Int64.TryParse(console_result, out longResult))
205 {
206 convertSuccess = true;
207 return_result = longResult;
208 }
209 errorMessage = "a signed 32 bit integer (long)";
210 break;
211 case ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS:
212 IPAddress ipAddressResult;
213 if (IPAddress.TryParse(console_result, out ipAddressResult))
214 {
215 convertSuccess = true;
216 return_result = ipAddressResult;
217 }
218 errorMessage = "an IP Address (IPAddress)";
219 break;
220 case ConfigurationOption.ConfigurationTypes.TYPE_LLUUID:
221 LLUUID uuidResult;
222 if (LLUUID.TryParse(console_result, out uuidResult))
223 {
224 convertSuccess = true;
225 return_result = uuidResult;
226 }
227 errorMessage = "a UUID (LLUUID)";
228 break;
229 case ConfigurationOption.ConfigurationTypes.TYPE_LLVECTOR3:
230 LLVector3 vectorResult;
231 if (LLVector3.TryParse(console_result, out vectorResult))
232 {
233 convertSuccess = true;
234 return_result = vectorResult;
235 }
236 errorMessage = "a vector (LLVector3)";
237 break;
238 case ConfigurationOption.ConfigurationTypes.TYPE_UINT16:
239 ushort ushortResult;
240 if (UInt16.TryParse(console_result, out ushortResult))
241 {
242 convertSuccess = true;
243 return_result = ushortResult;
244 }
245 errorMessage = "an unsigned 16 bit integer (ushort)";
246 break;
247 case ConfigurationOption.ConfigurationTypes.TYPE_UINT32:
248 uint uintResult;
249 if (UInt32.TryParse(console_result, out uintResult))
250 {
251 convertSuccess = true;
252 return_result = uintResult;
253
254 }
255 errorMessage = "an unsigned 32 bit integer (uint)";
256 break;
257 case ConfigurationOption.ConfigurationTypes.TYPE_UINT64:
258 ulong ulongResult;
259 if (UInt64.TryParse(console_result, out ulongResult))
260 {
261 convertSuccess = true;
262 return_result = ulongResult;
263 }
264 errorMessage = "an unsigned 64 bit integer (ulong)";
265 break;
266 case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT:
267 float floatResult;
268 if (float.TryParse(console_result, out floatResult))
269 {
270 convertSuccess = true;
271 return_result = floatResult;
272 }
273 errorMessage = "a single-precision floating point number (float)";
274 break;
275 case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE:
276 double doubleResult;
277 if (Double.TryParse(console_result, out doubleResult))
278 {
279 convertSuccess = true;
280 return_result = doubleResult;
281 }
282 errorMessage = "an double-precision floating point number (double)";
283 break;
284 }
285
286 if (convertSuccess)
287 {
288 if (useFile)
289 {
290 xmlConfig.SetAttribute(configOption.configurationKey, console_result);
291 }
292
293
294 this.resultFunction(configOption.configurationKey, return_result);
295 }
296 else
297 {
298 MainLog.Instance.Warn("Incorrect result given, the configuration option must be " + errorMessage + ". Prompting for same option...");
299 ignoreNextFromConfig = true;
300 }
301 }
302 }
303
304 if(useFile)
305 {
306 xmlConfig.Commit();
307 xmlConfig.Close();
308 }
309 }
310 }
311}
diff --git a/OpenSim/Framework/General/Configuration/ConfigurationOption.cs b/OpenSim/Framework/General/Configuration/ConfigurationOption.cs
new file mode 100644
index 0000000..15da1aa
--- /dev/null
+++ b/OpenSim/Framework/General/Configuration/ConfigurationOption.cs
@@ -0,0 +1,34 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Configuration
6{
7 public class ConfigurationOption
8 {
9 public enum ConfigurationTypes
10 {
11 TYPE_STRING,
12 TYPE_UINT16,
13 TYPE_UINT32,
14 TYPE_UINT64,
15 TYPE_INT16,
16 TYPE_INT32,
17 TYPE_INT64,
18 TYPE_IP_ADDRESS,
19 TYPE_CHARACTER,
20 TYPE_BOOLEAN,
21 TYPE_BYTE,
22 TYPE_LLUUID,
23 TYPE_LLVECTOR3,
24 TYPE_FLOAT,
25 TYPE_DOUBLE
26 };
27
28 public string configurationKey = "";
29 public string configurationQuestion = "";
30 public string configurationDefault = "";
31
32 public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING;
33 }
34}
diff --git a/OpenSim/Framework/General/Configuration/GridConfig.cs b/OpenSim/Framework/General/Configuration/GridConfig.cs
new file mode 100644
index 0000000..97dd699
--- /dev/null
+++ b/OpenSim/Framework/General/Configuration/GridConfig.cs
@@ -0,0 +1,78 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Configuration
6{
7 public class GridConfig
8 {
9 public string GridOwner = "";
10 public string DefaultAssetServer = "";
11 public string AssetSendKey = "";
12 public string AssetRecvKey = "";
13
14 public string DefaultUserServer = "";
15 public string UserSendKey = "";
16 public string UserRecvKey = "";
17
18 public string SimSendKey = "";
19 public string SimRecvKey = "";
20
21 private ConfigurationMember configMember;
22 public GridConfig(string description, string filename)
23 {
24 configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration);
25 configMember.performConfigurationRetrieve();
26 }
27
28 public void loadConfigurationOptions()
29 {
30 configMember.addConfigurationOption("grid_owner",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"OGS Grid Owner","OGS development team");
31 configMember.addConfigurationOption("default_asset_server",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Default Asset Server URI","http://127.0.0.1:8003/");
32 configMember.addConfigurationOption("asset_send_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to send to asset server","null");
33 configMember.addConfigurationOption("asset_recv_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to expect from asset server","null");
34
35 configMember.addConfigurationOption("default_user_server",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Default User Server URI","http://127.0.0.1:8002/");
36 configMember.addConfigurationOption("user_send_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to send to user server","null");
37 configMember.addConfigurationOption("user_recv_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to expect from user server","null");
38
39 configMember.addConfigurationOption("sim_send_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to send to a simulator","null");
40 configMember.addConfigurationOption("sim_recv_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to expect from a simulator","null");
41
42 }
43
44 public void handleIncomingConfiguration(string configuration_key, object configuration_result)
45 {
46 switch (configuration_key)
47 {
48 case "grid_owner":
49 this.GridOwner = (string)configuration_result;
50 break;
51 case "default_asset_server":
52 this.DefaultAssetServer = (string)configuration_result;
53 break;
54 case "asset_send_key":
55 this.AssetSendKey = (string)configuration_result;
56 break;
57 case "asset_recv_key":
58 this.AssetRecvKey = (string)configuration_result;
59 break;
60 case "default_user_server":
61 this.DefaultUserServer = (string)configuration_result;
62 break;
63 case "user_send_key":
64 this.UserSendKey = (string)configuration_result;
65 break;
66 case "user_recv_key":
67 this.UserRecvKey = (string)configuration_result;
68 break;
69 case "sim_send_key":
70 this.SimSendKey = (string)configuration_result;
71 break;
72 case "sim_recv_key":
73 this.SimRecvKey = (string)configuration_result;
74 break;
75 }
76 }
77 }
78}
diff --git a/OpenSim/Framework/General/Configuration/Interfaces/IGenericConfig.cs b/OpenSim/Framework/General/Configuration/Interfaces/IGenericConfig.cs
new file mode 100644
index 0000000..2c379dd
--- /dev/null
+++ b/OpenSim/Framework/General/Configuration/Interfaces/IGenericConfig.cs
@@ -0,0 +1,38 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.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*/
28namespace OpenSim.Framework.Interfaces
29{
30 public interface IGenericConfig
31 {
32 void LoadData();
33 string GetAttribute(string attributeName);
34 bool SetAttribute(string attributeName, string attributeValue);
35 void Commit();
36 void Close();
37 }
38}
diff --git a/OpenSim/Framework/General/Configuration/UserConfig.cs b/OpenSim/Framework/General/Configuration/UserConfig.cs
new file mode 100644
index 0000000..9d607b3
--- /dev/null
+++ b/OpenSim/Framework/General/Configuration/UserConfig.cs
@@ -0,0 +1,55 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Configuration
6{
7 /// <summary>
8 /// UserConfig -- For User Server Configuration
9 /// </summary>
10 public class UserConfig
11 {
12 public string DefaultStartupMsg = "";
13 public string GridServerURL = "";
14 public string GridSendKey = "";
15 public string GridRecvKey = "";
16
17 private ConfigurationMember configMember;
18
19 public UserConfig(string description, string filename)
20 {
21 configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration);
22 configMember.performConfigurationRetrieve();
23 }
24
25 public void loadConfigurationOptions()
26 {
27 configMember.addConfigurationOption("default_startup_message",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Default Startup Message","Welcome to OGS");
28
29 configMember.addConfigurationOption("default_grid_server",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Default Grid Server URI","http://127.0.0.1:8001/");
30 configMember.addConfigurationOption("grid_send_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to send to grid server","null");
31 configMember.addConfigurationOption("grid_recv_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to expect from grid server","null");
32
33
34 }
35
36 public void handleIncomingConfiguration(string configuration_key, object configuration_result)
37 {
38 switch (configuration_key)
39 {
40 case "default_startup_message":
41 this.DefaultStartupMsg = (string)configuration_result;
42 break;
43 case "default_grid_server":
44 this.GridServerURL = (string)configuration_result;
45 break;
46 case "grid_send_key":
47 this.GridSendKey = (string)configuration_result;
48 break;
49 case "grid_recv_key":
50 this.GridRecvKey = (string)configuration_result;
51 break;
52 }
53 }
54 }
55}
diff --git a/OpenSim/Framework/General/Configuration/XmlConfiguration.cs b/OpenSim/Framework/General/Configuration/XmlConfiguration.cs
new file mode 100644
index 0000000..e1f3816
--- /dev/null
+++ b/OpenSim/Framework/General/Configuration/XmlConfiguration.cs
@@ -0,0 +1,123 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.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*/
28using System;
29using System.IO;
30using System.Xml;
31
32using OpenSim.Framework.Interfaces;
33
34namespace OpenSim.Framework.Configuration
35{
36 public class XmlConfiguration : IGenericConfig
37 {
38 private XmlDocument doc;
39 private XmlNode rootNode;
40 private XmlNode configNode;
41 private string fileName;
42 private bool createdFile = false;
43
44 public XmlConfiguration(string filename)
45 {
46 fileName = filename;
47 }
48
49 public void LoadData()
50 {
51 doc = new XmlDocument();
52
53 if (File.Exists(fileName))
54 {
55 XmlTextReader reader = new XmlTextReader(fileName);
56 reader.WhitespaceHandling = WhitespaceHandling.None;
57 doc.Load(reader);
58 reader.Close();
59 }
60 else
61 {
62 createdFile = true;
63 rootNode = doc.CreateNode(XmlNodeType.Element, "Root", "");
64 doc.AppendChild(rootNode);
65 configNode = doc.CreateNode(XmlNodeType.Element, "Config", "");
66 rootNode.AppendChild(configNode);
67 }
68
69
70 rootNode = doc.FirstChild;
71 if (rootNode.Name != "Root")
72 throw new Exception("Error: Invalid .xml File. Missing <Root>");
73
74 configNode = rootNode.FirstChild;
75 if (configNode.Name != "Config")
76 throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>");
77
78 if (createdFile)
79 {
80 this.Commit();
81 }
82 }
83
84 public string GetAttribute(string attributeName)
85 {
86 string result = null;
87 if (configNode.Attributes[attributeName] != null)
88 {
89 result = ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value;
90 }
91 return result;
92 }
93
94 public bool SetAttribute(string attributeName, string attributeValue)
95 {
96 if (configNode.Attributes[attributeName] != null)
97 {
98 ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue;
99 }
100 else
101 {
102 XmlAttribute attri;
103 attri = doc.CreateAttribute(attributeName);
104 attri.Value = attributeValue;
105 configNode.Attributes.Append(attri);
106 }
107 return true;
108 }
109
110 public void Commit()
111 {
112 doc.Save(fileName);
113 }
114
115 public void Close()
116 {
117 configNode = null;
118 rootNode = null;
119 doc = null;
120 }
121
122 }
123}
diff --git a/OpenSim/Framework/General/Types/NetworkServersInfo.cs b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
index 6259d7b..40557be 100644
--- a/OpenSim/Framework/General/Types/NetworkServersInfo.cs
+++ b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using OpenSim.Framework.Console; 29using OpenSim.Framework.Console;
30using OpenSim.Framework.Interfaces; 30using OpenSim.Framework.Interfaces;
31using OpenSim.Framework.Configuration;
31 32
32namespace OpenSim.Framework.Types 33namespace OpenSim.Framework.Types
33{ 34{
@@ -44,175 +45,76 @@ namespace OpenSim.Framework.Types
44 public string UserRecvKey = ""; 45 public string UserRecvKey = "";
45 public bool isSandbox; 46 public bool isSandbox;
46 47
47 public uint DefaultHomeLocX = 1000; 48 public uint DefaultHomeLocX = 0;
48 public uint DefaultHomeLocY = 1000; 49 public uint DefaultHomeLocY = 0;
49 50
50 public int HttpListenerPort = 9000; 51 public int HttpListenerPort = 9000;
51 public int RemotingListenerPort = 8895; 52 public int RemotingListenerPort = 8895;
52 53
53 public void InitConfig(bool sandboxMode, IGenericConfig configData) 54 private ConfigurationMember configMember;
54 {
55 this.isSandbox = sandboxMode;
56
57 try
58 {
59 string attri = "";
60
61 attri = "";
62 attri = configData.GetAttribute("HttpListenerPort");
63 if (attri == "")
64 {
65 string location = MainLog.Instance.CmdPrompt("Http Listener Port", "9000");
66 configData.SetAttribute("HttpListenerPort", location);
67 this.HttpListenerPort = Convert.ToInt32(location);
68 }
69 else
70 {
71 this.HttpListenerPort = Convert.ToInt32(attri);
72 }
73
74 attri = "";
75 attri = configData.GetAttribute("RemotingListenerPort");
76 if (attri == "")
77 {
78 string location = MainLog.Instance.CmdPrompt("Remoting Listener Port", "8895");
79 configData.SetAttribute("RemotingListenerPort", location);
80 this.RemotingListenerPort = Convert.ToInt32(location);
81 }
82 else
83 {
84 this.RemotingListenerPort = Convert.ToInt32(attri);
85 }
86
87 if (sandboxMode)
88 {
89 // default home location X
90 attri = "";
91 attri = configData.GetAttribute("DefaultLocationX");
92 if (attri == "")
93 {
94 string location = MainLog.Instance.CmdPrompt("Default Home Location X", "1000");
95 configData.SetAttribute("DefaultLocationX", location);
96 this.DefaultHomeLocX = (uint)Convert.ToUInt32(location);
97 }
98 else
99 {
100 this.DefaultHomeLocX = (uint)Convert.ToUInt32(attri);
101 }
102
103 // default home location Y
104 attri = "";
105 attri = configData.GetAttribute("DefaultLocationY");
106 if (attri == "")
107 {
108 string location = MainLog.Instance.CmdPrompt("Default Home Location Y", "1000");
109 configData.SetAttribute("DefaultLocationY", location);
110 this.DefaultHomeLocY = (uint)Convert.ToUInt32(location);
111 }
112 else
113 {
114 this.DefaultHomeLocY = (uint)Convert.ToUInt32(attri);
115 }
116 }
117 if (!isSandbox)
118 {
119 //Grid Server
120 attri = "";
121 attri = configData.GetAttribute("GridServerURL");
122 if (attri == "")
123 {
124 this.GridURL = MainLog.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/");
125 configData.SetAttribute("GridServerURL", this.GridURL);
126 }
127 else
128 {
129 this.GridURL = attri;
130 }
131 55
132 //Grid Send Key 56 public NetworkServersInfo(string description, string filename)
133 attri = ""; 57 {
134 attri = configData.GetAttribute("GridSendKey"); 58 configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleConfigurationItem);
135 if (attri == "") 59 configMember.performConfigurationRetrieve();
136 { 60 }
137 this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server", "null");
138 configData.SetAttribute("GridSendKey", this.GridSendKey);
139 }
140 else
141 {
142 this.GridSendKey = attri;
143 }
144 61
145 //Grid Receive Key 62 public void loadConfigurationOptions()
146 attri = ""; 63 {
147 attri = configData.GetAttribute("GridRecvKey");
148 if (attri == "")
149 {
150 this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server", "null");
151 configData.SetAttribute("GridRecvKey", this.GridRecvKey);
152 }
153 else
154 {
155 this.GridRecvKey = attri;
156 }
157 64
158 //Grid Server 65 configMember.addConfigurationOption("HttpListenerPort", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "HTTP Listener Port", "9000");
159 attri = ""; 66 configMember.addConfigurationOption("RemotingListenerPort", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Remoting Listener Port", "8895");
160 attri = configData.GetAttribute("UserServerURL"); 67 configMember.addConfigurationOption("DefaultLocationX", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Default Home Location (X Axis)", "1000");
161 if (attri == "") 68 configMember.addConfigurationOption("DefaultLocationY", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Default Home Location (Y Axis)", "1000");
162 {
163 this.UserURL= MainLog.Instance.CmdPrompt("User server URL", "http://127.0.0.1:8002/");
164 configData.SetAttribute("UserServerURL", this.UserURL);
165 }
166 else
167 {
168 this.UserURL = attri;
169 }
170 69
171 //Grid Send Key 70 configMember.addConfigurationOption("GridServerURL", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Grid Server URL", "http://127.0.0.1:8001");
172 attri = ""; 71 configMember.addConfigurationOption("GridSendKey", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to grid server", "null");
173 attri = configData.GetAttribute("UserSendKey"); 72 configMember.addConfigurationOption("GridRecvKey", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from grid server", "null");
174 if (attri == "")
175 {
176 this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server", "null");
177 configData.SetAttribute("UserSendKey", this.UserSendKey);
178 }
179 else
180 {
181 this.UserSendKey = attri;
182 }
183 73
184 //Grid Receive Key 74 configMember.addConfigurationOption("UserServerURL", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "User Server URL", "http://127.0.0.1:8002");
185 attri = ""; 75 configMember.addConfigurationOption("UserSendKey", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null");
186 attri = configData.GetAttribute("UserRecvKey"); 76 configMember.addConfigurationOption("UserRecvKey", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null");
187 if (attri == "")
188 {
189 this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server", "null");
190 configData.SetAttribute("UserRecvKey", this.UserRecvKey);
191 }
192 else
193 {
194 this.UserRecvKey = attri;
195 }
196 77
197 attri = ""; 78 configMember.addConfigurationOption("AssetServerURL", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Asset Server URL", "http://127.0.0.1:8003");
198 attri = configData.GetAttribute("AssetServerURL"); 79 }
199 if (attri == "")
200 {
201 this.AssetURL = MainLog.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/");
202 configData.SetAttribute("AssetServerURL", this.GridURL);
203 }
204 else
205 {
206 this.AssetURL = attri;
207 }
208 80
209 } 81 public void handleConfigurationItem(string configuration_key, object configuration_object)
210 configData.Commit(); 82 {
211 } 83 switch (configuration_key)
212 catch (Exception e)
213 { 84 {
214 MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); 85 case "HttpListenerPort":
215 MainLog.Instance.Warn(e.ToString()); 86 this.HttpListenerPort = (int)configuration_object;
87 break;
88 case "RemotingListenerPort":
89 this.RemotingListenerPort = (int)configuration_object;
90 break;
91 case "DefaultLocationX":
92 this.DefaultHomeLocX = (uint)configuration_object;
93 break;
94 case "DefaultLocationY":
95 this.DefaultHomeLocY = (uint)configuration_object;
96 break;
97 case "GridServerURL":
98 this.GridURL = (string)configuration_object;
99 break;
100 case "GridSendKey":
101 this.GridSendKey = (string)configuration_object;
102 break;
103 case "GridRecvKey":
104 this.GridRecvKey = (string)configuration_object;
105 break;
106 case "UserServerURL":
107 this.UserURL = (string)configuration_object;
108 break;
109 case "UserSendKey":
110 this.UserSendKey = (string)configuration_object;
111 break;
112 case "UserRecvKey":
113 this.UserRecvKey = (string)configuration_object;
114 break;
115 case "AssetServerURL":
116 this.AssetURL = (string)configuration_object;
117 break;
216 } 118 }
217 } 119 }
218 } 120 }
diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs
index 251d7f8..b7c35c7 100644
--- a/OpenSim/Framework/General/Types/RegionInfo.cs
+++ b/OpenSim/Framework/General/Types/RegionInfo.cs
@@ -34,6 +34,8 @@ using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Utilities; 35using OpenSim.Framework.Utilities;
36 36
37using OpenSim.Framework.Configuration;
38
37namespace OpenSim.Framework.Types 39namespace OpenSim.Framework.Types
38{ 40{
39 public class RegionInfo 41 public class RegionInfo
@@ -71,11 +73,11 @@ namespace OpenSim.Framework.Types
71 } 73 }
72 74
73 } 75 }
74 76
75 return new IPEndPoint(ia, m_internalEndPoint.Port); 77 return new IPEndPoint(ia, m_internalEndPoint.Port);
76 } 78 }
77 } 79 }
78 80
79 private string m_externalHostName; 81 private string m_externalHostName;
80 public string ExternalHostName 82 public string ExternalHostName
81 { 83 {
@@ -117,7 +119,6 @@ namespace OpenSim.Framework.Types
117 } 119 }
118 } 120 }
119 121
120 // Only used for remote regions , ie ones not in the current instance
121 private uint m_remotingPort; 122 private uint m_remotingPort;
122 public uint RemotingPort 123 public uint RemotingPort
123 { 124 {
@@ -142,14 +143,18 @@ namespace OpenSim.Framework.Types
142 143
143 public EstateSettings estateSettings; 144 public EstateSettings estateSettings;
144 145
145 public RegionInfo() 146 public ConfigurationMember configMember;
147 public RegionInfo(string description, string filename)
146 { 148 {
147 estateSettings = new EstateSettings(); 149 estateSettings = new EstateSettings();
150 configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration);
151 configMember.performConfigurationRetrieve();
148 } 152 }
149 153
150 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 154 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
151 : this()
152 { 155 {
156
157 estateSettings = new EstateSettings();
153 m_regionLocX = regionLocX; 158 m_regionLocX = regionLocX;
154 m_regionLocY = regionLocY; 159 m_regionLocY = regionLocY;
155 160
@@ -157,187 +162,70 @@ namespace OpenSim.Framework.Types
157 m_externalHostName = externalUri; 162 m_externalHostName = externalUri;
158 } 163 }
159 164
160 public void InitConfig(bool sandboxMode, IGenericConfig configData) 165 public void loadConfigurationOptions()
161 {
162 this.isSandbox = sandboxMode;
163 try
164 {
165 string attri = "";
166
167 // Sim UUID
168 string simId = configData.GetAttribute("SimUUID");
169 if (String.IsNullOrEmpty( simId ))
170 {
171 this.SimUUID = LLUUID.Random();
172 }
173 else
174 {
175 this.SimUUID = new LLUUID(simId);
176 }
177 configData.SetAttribute("SimUUID", this.SimUUID.ToString());
178
179 this.RegionName = GetString(configData, "SimName", "OpenSim test", "Region Name");
180
181 //m_regionLocX = (uint) GetInt(configData, "SimLocationX", 1000, "Grid Location X");
182
183 attri = "";
184 attri = configData.GetAttribute("SimLocationX");
185 if (attri == "")
186 {
187 string location = MainLog.Instance.CmdPrompt("Grid Location X", "1000");
188 configData.SetAttribute("SimLocationX", location);
189 m_regionLocX = (uint)Convert.ToUInt32(location);
190 }
191 else
192 {
193 m_regionLocX = (uint)Convert.ToUInt32(attri);
194 }
195 // Sim/Grid location Y
196 attri = "";
197 attri = configData.GetAttribute("SimLocationY");
198 if (attri == "")
199 {
200 string location = MainLog.Instance.CmdPrompt("Grid Location Y", "1000");
201 configData.SetAttribute("SimLocationY", location);
202 m_regionLocY = (uint)Convert.ToUInt32(location);
203 }
204 else
205 {
206 m_regionLocY = (uint)Convert.ToUInt32(attri);
207 }
208
209 m_regionHandle = null;
210
211 this.DataStore = GetString(configData, "Datastore", "localworld.yap", "Filename for local storage");
212
213 string internalAddress = GetString(configData, "InternalIPAddress", "0.0.0.0", "Internal IP Address for UDP client connections").ToString();
214 int internalPort = GetIPPort(configData, "InternalIPPort", "9000", "Internal IP Port for UDP client connections");
215 IPAddress internalIPAddress = Util.GetHostFromDNS(internalAddress);
216 m_internalEndPoint = new IPEndPoint(internalIPAddress, internalPort);
217
218 m_externalHostName = GetString(configData, "ExternalHostName", "127.0.0.1", "External Host Name");
219
220 estateSettings.terrainFile =
221 GetString(configData, "TerrainFile", "default.r32", "GENERAL SETTING: Default Terrain File");
222
223 attri = "";
224 attri = configData.GetAttribute("TerrainMultiplier");
225 if (attri == "")
226 {
227 string re = MainLog.Instance.CmdPrompt("GENERAL SETTING: Terrain Height Multiplier", "60.0");
228 this.estateSettings.terrainMultiplier = Convert.ToDouble(re, CultureInfo.InvariantCulture);
229 configData.SetAttribute("TerrainMultiplier", this.estateSettings.terrainMultiplier.ToString());
230 }
231 else
232 {
233 this.estateSettings.terrainMultiplier = Convert.ToDouble(attri);
234 }
235
236 attri = "";
237 attri = configData.GetAttribute("MasterAvatarFirstName");
238 if (attri == "")
239 {
240 this.MasterAvatarFirstName = MainLog.Instance.CmdPrompt("First name of Master Avatar (Land and Region Owner)", "Test");
241
242 configData.SetAttribute("MasterAvatarFirstName", this.MasterAvatarFirstName);
243 }
244 else
245 {
246 this.MasterAvatarFirstName = attri;
247 }
248
249 attri = "";
250 attri = configData.GetAttribute("MasterAvatarLastName");
251 if (attri == "")
252 {
253 this.MasterAvatarLastName = MainLog.Instance.CmdPrompt("Last name of Master Avatar (Land and Region Owner)", "User");
254
255 configData.SetAttribute("MasterAvatarLastName", this.MasterAvatarLastName);
256 }
257 else
258 {
259 this.MasterAvatarLastName = attri;
260 }
261
262 if (isSandbox) //Sandbox Mode Specific Settings
263 {
264 attri = "";
265 attri = configData.GetAttribute("MasterAvatarSandboxPassword");
266 if (attri == "")
267 {
268 this.MasterAvatarSandboxPassword = MainLog.Instance.CmdPrompt("Password of Master Avatar (Needed for sandbox mode account creation only)", "test");
269
270 //Should I store this?
271 configData.SetAttribute("MasterAvatarSandboxPassword", this.MasterAvatarSandboxPassword);
272 }
273 else
274 {
275 this.MasterAvatarSandboxPassword = attri;
276 }
277 }
278
279 configData.Commit();
280 }
281 catch (Exception e)
282 {
283 MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
284 MainLog.Instance.Warn(e.ToString());
285 }
286
287 MainLog.Instance.Verbose("Sim settings loaded:");
288 MainLog.Instance.Verbose("UUID: " + this.SimUUID.ToStringHyphenated());
289 MainLog.Instance.Verbose("Name: " + this.RegionName);
290 MainLog.Instance.Verbose("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
291 MainLog.Instance.Verbose("Region Handle: " + this.RegionHandle.ToString());
292 MainLog.Instance.Verbose("Listening on IP end point: " + m_internalEndPoint.ToString() );
293 MainLog.Instance.Verbose("Sandbox Mode? " + isSandbox.ToString());
294
295 }
296
297 private uint GetInt(IGenericConfig configData, string p, int p_3, string p_4)
298 { 166 {
299 throw new Exception("The method or operation is not implemented."); 167 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Simulator (Default is recommended, random UUID)", LLUUID.Random().ToString());
300 } 168 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Simulator Name", "OpenSim Test");
301 169 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000");
302 private string GetString(IGenericConfig configData, string attrName, string defaultvalue, string prompt) 170 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000");
303 { 171 configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Filename for local storage", "localworld.yap");
304 string s = configData.GetAttribute(attrName); 172 configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0");
173 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", "9000");
174 configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "External Host Name", "127.0.0.1");
175 configMember.addConfigurationOption("terrain_file", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Default Terrain File", "default.r32");
176 configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, "Terrain Height Multiplier", "60.0");
177 configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "First Name of Master Avatar", "Test");
178 configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Last Name of Master Avatar", "User");
179 configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test");
305 180
306 if (String.IsNullOrEmpty( s ))
307 {
308 s = MainLog.Instance.CmdPrompt(prompt, defaultvalue);
309 configData.SetAttribute(attrName, s );
310 }
311 return s;
312 } 181 }
313 182
314 private IPAddress GetIPAddress(IGenericConfig configData, string attrName, string defaultvalue, string prompt) 183 public void handleIncomingConfiguration(string configuration_key, object configuration_result)
315 { 184 {
316 string addressStr = configData.GetAttribute(attrName); 185 switch (configuration_key)
317
318 IPAddress address;
319
320 if (!IPAddress.TryParse(addressStr, out address))
321 { 186 {
322 address = MainLog.Instance.CmdPromptIPAddress(prompt, defaultvalue); 187 case "sim_UUID":
323 configData.SetAttribute(attrName, address.ToString()); 188 this.SimUUID = (LLUUID)configuration_result;
189 break;
190 case "sim_name":
191 this.RegionName = (string)configuration_result;
192 break;
193 case "sim_location_x":
194 this.m_regionLocX = (uint)configuration_result;
195 break;
196 case "sim_location_y":
197 this.m_regionLocY = (uint)configuration_result;
198 break;
199 case "datastore":
200 this.DataStore = (string)configuration_result;
201 break;
202 case "internal_ip_address":
203 IPAddress address = (IPAddress)configuration_result;
204 this.m_internalEndPoint = new IPEndPoint(address, 0);
205 break;
206 case "internal_ip_port":
207 this.m_internalEndPoint.Port = (int)configuration_result;
208 break;
209 case "external_host_name":
210 this.m_externalHostName = (string)configuration_result;
211 break;
212 case "terrain_file":
213 this.estateSettings.terrainFile = (string)configuration_result;
214 break;
215 case "terrain_multiplier":
216 this.estateSettings.terrainMultiplier = (double)configuration_result;
217 break;
218 case "master_avatar_first":
219 this.MasterAvatarFirstName = (string)configuration_result;
220 break;
221 case "master_avatar_last":
222 this.MasterAvatarLastName = (string)configuration_result;
223 break;
224 case "master_avatar_pass":
225 this.MasterAvatarSandboxPassword = (string)configuration_result;
226 break;
324 } 227 }
325 return address;
326 } 228 }
327
328 private int GetIPPort(IGenericConfig configData, string attrName, string defaultvalue, string prompt)
329 {
330 string portStr = configData.GetAttribute(attrName);
331 229
332 int port;
333
334 if (!int.TryParse(portStr, out port))
335 {
336 port = MainLog.Instance.CmdPromptIPPort(prompt, defaultvalue);
337 configData.SetAttribute(attrName, port.ToString());
338 }
339
340 return port;
341 }
342 } 230 }
343} 231}