aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Application/HGOpenSimNode.cs114
1 files changed, 22 insertions, 92 deletions
diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs
index a8dd00e..0a8075c 100644
--- a/OpenSim/Region/Application/HGOpenSimNode.cs
+++ b/OpenSim/Region/Application/HGOpenSimNode.cs
@@ -49,9 +49,9 @@ namespace OpenSim
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private IHyperlink HGServices = null; 50 private IHyperlink HGServices = null;
51 51
52// private uint m_autoMappingX = 0; 52 private uint m_autoMappingX = 0;
53// private uint m_autoMappingY = 0; 53 private uint m_autoMappingY = 0;
54// private bool m_enableAutoMapping = false; 54 private bool m_enableAutoMapping = false;
55 55
56 public HGOpenSimNode(IConfigSource configSource) : base(configSource) 56 public HGOpenSimNode(IConfigSource configSource) : base(configSource)
57 { 57 {
@@ -70,7 +70,6 @@ namespace OpenSim
70 70
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-mapping", "link-mapping [<x> <y>] <cr>", "Set local coordinate to map HG regions to", RunCommand);
72 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 73
75 } 74 }
76 75
@@ -147,47 +146,21 @@ namespace OpenSim
147 string command = cmdparams[0]; 146 string command = cmdparams[0];
148 cmdparams.RemoveAt(0); 147 cmdparams.RemoveAt(0);
149 148
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
176 if (command.Equals("link-mapping")) 149 if (command.Equals("link-mapping"))
177 { 150 {
178 if (cmdparams.Count == 2) 151 if (cmdparams.Count == 2)
179 { 152 {
180 try 153 try
181 { 154 {
182// m_autoMappingX = Convert.ToUInt32(cmdparams[0]); 155 m_autoMappingX = Convert.ToUInt32(cmdparams[0]);
183// m_autoMappingY = Convert.ToUInt32(cmdparams[1]); 156 m_autoMappingY = Convert.ToUInt32(cmdparams[1]);
184// m_enableAutoMapping = true; 157 m_enableAutoMapping = true;
185 } 158 }
186 catch (Exception) 159 catch (Exception)
187 { 160 {
188// m_autoMappingX = 0; 161 m_autoMappingX = 0;
189// m_autoMappingY = 0; 162 m_autoMappingY = 0;
190// m_enableAutoMapping = false; 163 m_enableAutoMapping = false;
191 } 164 }
192 } 165 }
193 } 166 }
@@ -195,7 +168,14 @@ namespace OpenSim
195 { 168 {
196 if (cmdparams.Count < 3) 169 if (cmdparams.Count < 3)
197 { 170 {
198 LinkRegionCmdUsage(); 171 if ((cmdparams.Count == 1) || (cmdparams.Count == 2))
172 {
173 LoadXmlLinkFile(cmdparams);
174 }
175 else
176 {
177 LinkRegionCmdUsage();
178 }
199 return; 179 return;
200 } 180 }
201 181
@@ -262,66 +242,16 @@ namespace OpenSim
262 } 242 }
263 } 243 }
264 244
265 private void LoadXmlLinkFile(string URI) 245 private void LoadXmlLinkFile(List<string> cmdparams)
266 { 246 {
267
268
269 //use http://www.hgurl.com/hypergrid.xml for test 247 //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
315 /*
316 private void LoadXmlLinkFile(string[] cmdparams)
317 {
318 try 248 try
319 { 249 {
320 XmlReader r = XmlReader.Create(cmdparams[0]); 250 XmlReader r = XmlReader.Create(cmdparams[0]);
321 XmlConfigSource cs = new XmlConfigSource(r); 251 XmlConfigSource cs = new XmlConfigSource(r);
322 string[] excludeSections = null; 252 string[] excludeSections = null;
323 253
324 if (cmdparams.Length == 2) 254 if (cmdparams.Count == 2)
325 { 255 {
326 if (cmdparams[1].ToLower().StartsWith("excludelist:")) 256 if (cmdparams[1].ToLower().StartsWith("excludelist:"))
327 { 257 {
@@ -358,9 +288,8 @@ namespace OpenSim
358 Console.WriteLine(e.ToString()); 288 Console.WriteLine(e.ToString());
359 } 289 }
360 } 290 }
361 */ 291
362 292
363 /*
364 private void ReadLinkFromConfig(IConfig config) 293 private void ReadLinkFromConfig(IConfig config)
365 { 294 {
366 RegionInfo regInfo; 295 RegionInfo regInfo;
@@ -390,12 +319,13 @@ namespace OpenSim
390 } 319 }
391 } 320 }
392 } 321 }
393 */ 322
394 323
395 private void LinkRegionCmdUsage() 324 private void LinkRegionCmdUsage()
396 { 325 {
397 Console.WriteLine("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]"); 326 Console.WriteLine("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]");
398 Console.WriteLine("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]"); 327 Console.WriteLine("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
328 Console.WriteLine("Usage: link-region <URI_of_xml> [<exclude>]");
399 } 329 }
400 } 330 }
401} 331}