Files
libremetaverse/libsecondlife/examples/TestClient/Commands/ParcelInfoCommand.cs
John Hurliman 3b6bfbc1ce * Caps initial connection is now asynchronous. This will fix the last remaining occasional lockup on program exit
* Fixed a lockup on exit and NullReferenceException when using ParcelInfoCommand in TestClient
* Basic (but incomplete) support for decoding foliage in CompressedUpdateHandler
* More exception handling in Login.cs
* Housekeeping in MainAvatar.cs
* Increased teleport and caps timeouts
* Added an LLVector3 * LLVector3 operator overload

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1115 52acb1d6-8a22-11de-b505-999d5b087335
2007-04-13 20:02:21 +00:00

57 lines
1.9 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 Parcels;
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";
Parcels = new ParcelDownloader(testClient);
Parcels.OnParcelsDownloaded += new ParcelDownloader.ParcelsDownloadedCallback(Parcels_OnParcelsDownloaded);
testClient.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(Network_OnDisconnected);
}
public override string Execute(string[] args, LLUUID fromAgentID)
{
Parcels.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)
{
Console.WriteLine("Parcels[{0}]: Name: \"{1}\", Description: \"{2}\"", parcel.Key, parcel.Value.Name,
parcel.Value.Desc);
}
ParcelCount = Parcels.Count;
ParcelsDownloaded.Set();
}
void Network_OnDisconnected(NetworkManager.DisconnectType reason, string message)
{
ParcelsDownloaded.Set();
}
}
}