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.
parent
8ed631307b
commit
1fa8a7ce29
|
@ -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 [<x> <y>] <cr>", "Set local coordinate to map HG regions to", RunCommand);
|
||||
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", "Link a hypergrid region", RunCommand);
|
||||
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-URI", "link-URI <URL of xml files>", "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 <URL of xml files>");
|
||||
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<string> 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 <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]");
|
||||
Console.WriteLine("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
|
||||
Console.WriteLine("Usage: link-region <URI_of_xml> [<exclude>]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue