From 1fa8a7ce2934e56c7cc9cb9671ed2e05731b723a Mon Sep 17 00:00:00 2001 From: diva Date: Wed, 18 Feb 2009 16:11:34 +0000 Subject: Restoring method 2 of linking regions in HG, which was commented out for some bizarre reason. Fixes mantis #3141. Thanks Vinc for providing an alternative patch, which wasn't used but served to expose the mix-up. --- OpenSim/Region/Application/HGOpenSimNode.cs | 114 ++++++---------------------- 1 file changed, 22 insertions(+), 92 deletions(-) (limited to 'OpenSim') 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 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IHyperlink HGServices = null; -// private uint m_autoMappingX = 0; -// private uint m_autoMappingY = 0; -// private bool m_enableAutoMapping = false; + private uint m_autoMappingX = 0; + private uint m_autoMappingY = 0; + private bool m_enableAutoMapping = false; public HGOpenSimNode(IConfigSource configSource) : base(configSource) { @@ -70,7 +70,6 @@ namespace OpenSim MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ] ", "Set local coordinate to map HG regions to", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region :[:] ", "Link a hypergrid region", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-URI", "link-URI ", "ok", RunCommand); } @@ -147,47 +146,21 @@ namespace OpenSim string command = cmdparams[0]; cmdparams.RemoveAt(0); - - if (command.Equals("link-URI")) - { - - if (cmdparams.Count > 1 | cmdparams.Count < 1) - { - m_log.Info("Invalid usage"); - m_log.Info("link-URI "); - return; - } - - - m_log.Info(cmdparams[0].ToString()); - - LoadXmlLinkFile(cmdparams[0].ToString()); - } - - - - - - - - - - if (command.Equals("link-mapping")) { if (cmdparams.Count == 2) { try { -// m_autoMappingX = Convert.ToUInt32(cmdparams[0]); -// m_autoMappingY = Convert.ToUInt32(cmdparams[1]); -// m_enableAutoMapping = true; + m_autoMappingX = Convert.ToUInt32(cmdparams[0]); + m_autoMappingY = Convert.ToUInt32(cmdparams[1]); + m_enableAutoMapping = true; } catch (Exception) { -// m_autoMappingX = 0; -// m_autoMappingY = 0; -// m_enableAutoMapping = false; + m_autoMappingX = 0; + m_autoMappingY = 0; + m_enableAutoMapping = false; } } } @@ -195,7 +168,14 @@ namespace OpenSim { if (cmdparams.Count < 3) { - LinkRegionCmdUsage(); + if ((cmdparams.Count == 1) || (cmdparams.Count == 2)) + { + LoadXmlLinkFile(cmdparams); + } + else + { + LinkRegionCmdUsage(); + } return; } @@ -262,66 +242,16 @@ namespace OpenSim } } - private void LoadXmlLinkFile(string URI) + private void LoadXmlLinkFile(List cmdparams) { - - //use http://www.hgurl.com/hypergrid.xml for test - - RegionInfo RegInfo; - - try - { - - - XmlReader r = XmlReader.Create(URI); - XmlConfigSource reader = new XmlConfigSource(r); - - - for (int t = 0; t < reader.Configs.Count; t++) - { - - m_log.Info(reader.Configs[t].Name); - m_log.Info(reader.Configs[t].Get("xloc").ToString()); - string region_Name = reader.Configs[t].Name; - uint xloc = (uint)reader.Configs[t].GetInt("xloc"); - uint yloc = (uint)reader.Configs[t].GetInt("yloc"); - uint externalPort = (uint)reader.Configs[t].GetInt("externalPort"); - string externalHostName = reader.Configs[t].Get("externalHostName"); - - - - HGHyperlink.TryCreateLink(m_sceneManager.CurrentOrFirstScene, null, xloc, yloc, region_Name, externalPort, externalHostName, out RegInfo); - - - } - - r.Close(); - - - - } - - catch (Exception e) - { - m_log.Info(e.ToString()); - } - - - } - - - - /* - private void LoadXmlLinkFile(string[] cmdparams) - { try { XmlReader r = XmlReader.Create(cmdparams[0]); XmlConfigSource cs = new XmlConfigSource(r); string[] excludeSections = null; - if (cmdparams.Length == 2) + if (cmdparams.Count == 2) { if (cmdparams[1].ToLower().StartsWith("excludelist:")) { @@ -358,9 +288,8 @@ namespace OpenSim Console.WriteLine(e.ToString()); } } - */ + - /* private void ReadLinkFromConfig(IConfig config) { RegionInfo regInfo; @@ -390,12 +319,13 @@ namespace OpenSim } } } - */ + private void LinkRegionCmdUsage() { Console.WriteLine("Usage: link-region :[:]"); Console.WriteLine("Usage: link-region []"); + Console.WriteLine("Usage: link-region []"); } } } -- cgit v1.1