diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 62 |
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 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Net; | 30 | using System.Net; |
30 | using System.Net.Sockets; | 31 | using System.Net.Sockets; |
31 | using System.Xml; | 32 | using 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 |