public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
{
reason = string.Empty;
GridRegion regInfo = null;
if (!mapName.StartsWith ("http"))
{
string host = "127.0.0.1";
string portstr;
string regionName = "";
uint port = 0;
string[] parts = mapName.Split (new char[] { ':' });
if (parts.Length >= 1)
{
host = parts[0];
}
if (parts.Length >= 2)
{
portstr = parts[1];
//MainConsole.Instance.Debug("-- port = " + portstr);
if (!UInt32.TryParse (portstr, out port))
regionName = parts[1];
}
// always take the last one
if (parts.Length >= 3)
{
regionName = parts[2];
}
bool success = TryCreateLink (scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
if (success)
{
regInfo.RegionName = mapName;
return regInfo;
}
}
else
{
string[] parts = mapName.Split (new char[] { ' ' });
string regionName = String.Empty;
if (parts.Length > 1)
{
regionName = mapName.Substring (parts[0].Length + 1);
regionName = regionName.Trim (new char[] { '"' });
}
if (TryCreateLink (scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
{
regInfo.RegionName = mapName;
return regInfo;
}
}
return null;
}