diff options
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/HGOpenSimNode.cs | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs index cf0f917..a8dd00e 100644 --- a/OpenSim/Region/Application/HGOpenSimNode.cs +++ b/OpenSim/Region/Application/HGOpenSimNode.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Xml; | ||
31 | using log4net; | 32 | using log4net; |
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -69,6 +70,8 @@ namespace OpenSim | |||
69 | 70 | ||
70 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", "Set local coordinate to map HG regions to", RunCommand); | 71 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", "Set local coordinate to map HG regions to", RunCommand); |
71 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", "Link a hypergrid region", RunCommand); | 72 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", "Link a hypergrid region", RunCommand); |
73 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-URI", "link-URI <URL of xml files>", "ok", RunCommand); | ||
74 | |||
72 | } | 75 | } |
73 | 76 | ||
74 | protected override void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder) | 77 | protected override void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder) |
@@ -144,6 +147,32 @@ namespace OpenSim | |||
144 | string command = cmdparams[0]; | 147 | string command = cmdparams[0]; |
145 | cmdparams.RemoveAt(0); | 148 | cmdparams.RemoveAt(0); |
146 | 149 | ||
150 | |||
151 | if (command.Equals("link-URI")) | ||
152 | { | ||
153 | |||
154 | if (cmdparams.Count > 1 | cmdparams.Count < 1) | ||
155 | { | ||
156 | m_log.Info("Invalid usage"); | ||
157 | m_log.Info("link-URI <URL of xml files>"); | ||
158 | return; | ||
159 | } | ||
160 | |||
161 | |||
162 | m_log.Info(cmdparams[0].ToString()); | ||
163 | |||
164 | LoadXmlLinkFile(cmdparams[0].ToString()); | ||
165 | } | ||
166 | |||
167 | |||
168 | |||
169 | |||
170 | |||
171 | |||
172 | |||
173 | |||
174 | |||
175 | |||
147 | if (command.Equals("link-mapping")) | 176 | if (command.Equals("link-mapping")) |
148 | { | 177 | { |
149 | if (cmdparams.Count == 2) | 178 | if (cmdparams.Count == 2) |
@@ -233,6 +262,56 @@ namespace OpenSim | |||
233 | } | 262 | } |
234 | } | 263 | } |
235 | 264 | ||
265 | private void LoadXmlLinkFile(string URI) | ||
266 | { | ||
267 | |||
268 | |||
269 | //use http://www.hgurl.com/hypergrid.xml for test | ||
270 | |||
271 | RegionInfo RegInfo; | ||
272 | |||
273 | try | ||
274 | { | ||
275 | |||
276 | |||
277 | XmlReader r = XmlReader.Create(URI); | ||
278 | XmlConfigSource reader = new XmlConfigSource(r); | ||
279 | |||
280 | |||
281 | for (int t = 0; t < reader.Configs.Count; t++) | ||
282 | { | ||
283 | |||
284 | m_log.Info(reader.Configs[t].Name); | ||
285 | m_log.Info(reader.Configs[t].Get("xloc").ToString()); | ||
286 | string region_Name = reader.Configs[t].Name; | ||
287 | uint xloc = (uint)reader.Configs[t].GetInt("xloc"); | ||
288 | uint yloc = (uint)reader.Configs[t].GetInt("yloc"); | ||
289 | uint externalPort = (uint)reader.Configs[t].GetInt("externalPort"); | ||
290 | string externalHostName = reader.Configs[t].Get("externalHostName"); | ||
291 | |||
292 | |||
293 | |||
294 | HGHyperlink.TryCreateLink(m_sceneManager.CurrentOrFirstScene, null, xloc, yloc, region_Name, externalPort, externalHostName, out RegInfo); | ||
295 | |||
296 | |||
297 | } | ||
298 | |||
299 | r.Close(); | ||
300 | |||
301 | |||
302 | |||
303 | } | ||
304 | |||
305 | catch (Exception e) | ||
306 | { | ||
307 | m_log.Info(e.ToString()); | ||
308 | } | ||
309 | |||
310 | |||
311 | } | ||
312 | |||
313 | |||
314 | |||
236 | /* | 315 | /* |
237 | private void LoadXmlLinkFile(string[] cmdparams) | 316 | private void LoadXmlLinkFile(string[] cmdparams) |
238 | { | 317 | { |