Files
libremetaverse/libsecondlife-cs/examples/TestClient/Commands/FindSimCommand.cs
John Hurliman 3a94792761 * Reworked the Login functions, added documentation and (untested) support for login redirects
* Converted _VisualParam_ back to a static array after further analysis
* Rewrote AppearanceManager to work with the VisualParam rewrite
* Cleaned up ImageTool
* Minor cleanup and FIXME note in name2key.exe
* Cleanup and FIXME note in Teleport.exe
* Reorganized the function naming in GridManager to make more sense (not completely done here)
* Added an enum for requesting the object or terrain layer for the map blocks, and more sun properties
* Made some of the MainAvatar properties read-only (eventually they will all be read-only)
* Added try/catch safeties in openjpegnet
* Finally killed the evil SecondLife.Tick()

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@905 52acb1d6-8a22-11de-b505-999d5b087335
2007-01-26 22:01:56 +00:00

56 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using libsecondlife.Packets;
namespace libsecondlife.TestClient
{
public class FindSimCommand : Command
{
Dictionary<SecondLife, bool> GridDataCached = new Dictionary<SecondLife, bool>();
public FindSimCommand(TestClient testClient)
{
Name = "findsim";
Description = "Searches for a simulator and returns information about it. Usage: findsim [Simulator Name]";
}
public override string Execute(string[] args, LLUUID fromAgentID)
{
if (args.Length < 1)
return "Usage: findsim [Simulator Name]";
string simName = string.Empty;
for (int i = 0; i < args.Length; i++)
simName += args[i] + " ";
simName = simName.TrimEnd().ToLower();
if (!GridDataCached.ContainsKey(Client))
{
GridDataCached[Client] = false;
}
if (!GridDataCached[Client])
{
Client.Grid.RequestAllSims(GridManager.MapLayerType.Objects);
System.Threading.Thread.Sleep(5000);
GridDataCached[Client] = true;
}
int attempts = 0;
GridRegion region = null;
while (region == null && attempts++ < 5)
{
region = Client.Grid.GetGridRegion(simName);
}
if (region != null)
return "Found " + region.Name + ": handle=" + region.RegionHandle +
"(" + region.X + "," + region.Y + ")";
else
return "Lookup of " + simName + " failed";
}
}
}