Files
libremetaverse/libsecondlife/examples/TestClient/Commands/ParcelInfoCommand.cs
John Hurliman df3990e074 * Fixed a bug in Terrain.TerrainHeightAtPoint() for the top-left edges
* Added Utilities.ParcelDownloader.GetWaterType()
* Added the start parameter to Utilities.PersistentLogin()
* Simplified the Heightmap example
* Optimized the TestClient throttle
* ParcelInfoCommand prints out whether each parcel is underwater/waterfront/dry
* Added RegionInfoCommand to print out current region info
* Added Self.Status.UpdateFromHeading() to send an AgentUpdate packet from a rotation

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1132 52acb1d6-8a22-11de-b505-999d5b087335
2007-04-18 08:18:32 +00:00

59 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading;
using libsecondlife;
using libsecondlife.Utilities;
namespace libsecondlife.TestClient
{
public class ParcelInfoCommand : Command
{
private ParcelDownloader ParcelDownloader;
private ManualResetEvent ParcelsDownloaded = new ManualResetEvent(false);
private int ParcelCount = 0;
public ParcelInfoCommand(TestClient testClient)
{
Name = "parcelinfo";
Description = "Prints out info about all the parcels in this simulator";
ParcelDownloader = new ParcelDownloader(testClient);
ParcelDownloader.OnParcelsDownloaded += new ParcelDownloader.ParcelsDownloadedCallback(Parcels_OnParcelsDownloaded);
testClient.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(Network_OnDisconnected);
}
public override string Execute(string[] args, LLUUID fromAgentID)
{
ParcelDownloader.DownloadSimParcels(Client.Network.CurrentSim);
ParcelsDownloaded.Reset();
ParcelsDownloaded.WaitOne(20000, false);
if (Client.Network.CurrentSim != null)
return "Downloaded information for " + ParcelCount + " parcels in " + Client.Network.CurrentSim.Name;
else
return String.Empty;
}
void Parcels_OnParcelsDownloaded(Simulator simulator, Dictionary<int, Parcel> Parcels, int[,] map)
{
foreach (KeyValuePair<int, Parcel> parcel in Parcels)
{
WaterType type = ParcelDownloader.GetWaterType(map, parcel.Value.LocalID);
Console.WriteLine("Parcels[{0}]: Name: \"{1}\", Description: \"{2}\" ACL Count: {3}, Location: {4}",
parcel.Key, parcel.Value.Name, parcel.Value.Desc, parcel.Value.AccessList.Count, type.ToString());
}
ParcelCount = Parcels.Count;
ParcelsDownloaded.Set();
}
void Network_OnDisconnected(NetworkManager.DisconnectType reason, string message)
{
ParcelsDownloaded.Set();
}
}
}