aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/RegionInfo.cs62
1 files changed, 62 insertions, 0 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 3896a6e..afd50a9 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Net; 30using System.Net;
30using System.Net.Sockets; 31using System.Net.Sockets;
31using System.Xml; 32using System.Xml;
@@ -197,6 +198,67 @@ namespace OpenSim.Framework
197 { 198 {
198 return m_internalEndPoint.Port; 199 return m_internalEndPoint.Port;
199 } 200 }
201
202 public Dictionary<string, object> ToKeyValuePairs()
203 {
204 Dictionary<string, object> kvp = new Dictionary<string, object>();
205 kvp["uuid"] = RegionID.ToString();
206 kvp["locX"] = RegionLocX.ToString();
207 kvp["locY"] = RegionLocY.ToString();
208 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
209 kvp["external_port"] = ExternalEndPoint.Port.ToString();
210 kvp["external_host_name"] = ExternalHostName;
211 kvp["http_port"] = HttpPort.ToString();
212 kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
213 kvp["internal_port"] = InternalEndPoint.Port.ToString();
214 kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
215 kvp["server_uri"] = ServerURI;
216
217 return kvp;
218 }
219
220 public SimpleRegionInfo(Dictionary<string, object> kvp)
221 {
222 if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null))
223 {
224 int port = 0;
225 Int32.TryParse((string)kvp["external_port"], out port);
226 IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port);
227 ExternalEndPoint = ep;
228 }
229 else
230 ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
231
232 if (kvp["external_host_name"] != null)
233 ExternalHostName = (string)kvp["external_host_name"];
234
235 if (kvp["http_port"] != null)
236 {
237 UInt32 port = 0;
238 UInt32.TryParse((string)kvp["http_port"], out port);
239 HttpPort = port;
240 }
241
242 if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null))
243 {
244 int port = 0;
245 Int32.TryParse((string)kvp["internal_port"], out port);
246 IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port);
247 InternalEndPoint = ep;
248 }
249 else
250 InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
251
252 if (kvp["alternate_ports"] != null)
253 {
254 bool alts = false;
255 Boolean.TryParse((string)kvp["alternate_ports"], out alts);
256 m_allow_alternate_ports = alts;
257 }
258
259 if (kvp["server_uri"] != null)
260 ServerURI = (string)kvp["server_uri"];
261 }
200 } 262 }
201 263
202 public class RegionInfo : SimpleRegionInfo 264 public class RegionInfo : SimpleRegionInfo