public GridRegion GetRegionForGrid(string regionName, string url)
{
int xloc = random.Next (0, Int16.MaxValue) * (int)Constants.RegionSize;
int yloc = random.Next (0, Int16.MaxValue) * (int)Constants.RegionSize;
string host = "127.0.0.1";
string portstr;
uint port = 0;
string[] parts = url.Split (new char[] { ':' });
if (parts.Length >= 1)
host = parts[0];
if (parts.Length >= 2)
{
portstr = parts[1];
UInt32.TryParse (portstr, out port);
}
GridRegion r;
string reason;
if (TryCreateLink (UUID.Zero, xloc, yloc, regionName, port, host, UUID.Zero, out r, out reason))
return r;
return null;
}