private void ReadLinkFromConfig(IConfig config)
{
GridRegion regInfo;
int xloc, yloc;
uint externalPort;
string externalHostName;
uint realXLoc, realYLoc;
xloc = Convert.ToInt32 (config.GetString ("xloc", "0"));
yloc = Convert.ToInt32 (config.GetString ("yloc", "0"));
externalPort = Convert.ToUInt32 (config.GetString ("externalPort", "0"));
externalHostName = config.GetString ("externalHostName", "");
realXLoc = Convert.ToUInt32 (config.GetString ("real-xloc", "0"));
realYLoc = Convert.ToUInt32 (config.GetString ("real-yloc", "0"));
if (m_enableAutoMapping)
{
xloc = (int)((xloc % 100) + m_autoMappingX);
yloc = (int)((yloc % 100) + m_autoMappingY);
}
if (((realXLoc == 0) && (realYLoc == 0)) ||
(((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) &&
((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
{
xloc = xloc * (int)Constants.RegionSize;
yloc = yloc * (int)Constants.RegionSize;
string reason = string.Empty;
if (TryCreateLink (UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
{
regInfo.RegionName = config.GetString ("localName", "");
}
else
MainConsole.Instance.Output ("Unable to link " + externalHostName + ": " + reason);
}
}