2007-04-28 20:54:02 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2008-03-06 21:28:52 +00:00
|
|
|
using System.Text;
|
2007-04-28 20:54:02 +00:00
|
|
|
using System.Threading;
|
2008-07-21 21:12:59 +00:00
|
|
|
using OpenMetaverse;
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
public class ParcelInfoCommand : Command
|
|
|
|
|
{
|
2007-11-29 19:38:32 +00:00
|
|
|
private AutoResetEvent ParcelsDownloaded = new AutoResetEvent(false);
|
2007-04-28 20:54:02 +00:00
|
|
|
|
|
|
|
|
public ParcelInfoCommand(TestClient testClient)
|
2008-03-06 21:28:52 +00:00
|
|
|
{
|
|
|
|
|
Name = "parcelinfo";
|
|
|
|
|
Description = "Prints out info about all the parcels in this simulator";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.Parcel;
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2009-10-28 08:01:52 +00:00
|
|
|
testClient.Network.Disconnected += Network_OnDisconnected;
|
2008-03-06 21:28:52 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
2008-03-06 21:28:52 +00:00
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
string result;
|
2009-10-17 05:50:51 +00:00
|
|
|
EventHandler<SimParcelsDownloadedEventArgs> del = delegate(object sender, SimParcelsDownloadedEventArgs e)
|
2008-03-06 21:28:52 +00:00
|
|
|
{
|
|
|
|
|
ParcelsDownloaded.Set();
|
|
|
|
|
};
|
2009-10-17 05:50:51 +00:00
|
|
|
|
2008-03-06 21:28:52 +00:00
|
|
|
|
|
|
|
|
ParcelsDownloaded.Reset();
|
2009-10-17 05:50:51 +00:00
|
|
|
Client.Parcels.SimParcelsDownloaded += del;
|
2008-03-06 21:28:52 +00:00
|
|
|
Client.Parcels.RequestAllSimParcels(Client.Network.CurrentSim);
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2008-03-07 17:43:51 +00:00
|
|
|
if (Client.Network.CurrentSim.IsParcelMapFull())
|
|
|
|
|
ParcelsDownloaded.Set();
|
|
|
|
|
|
2008-08-02 01:49:20 +00:00
|
|
|
if (ParcelsDownloaded.WaitOne(30000, false) && Client.Network.Connected)
|
2008-03-07 17:43:51 +00:00
|
|
|
{
|
2008-03-07 18:36:45 +00:00
|
|
|
sb.AppendFormat("Downloaded {0} Parcels in {1} " + System.Environment.NewLine,
|
2008-03-07 17:43:51 +00:00
|
|
|
Client.Network.CurrentSim.Parcels.Count, Client.Network.CurrentSim.Name);
|
|
|
|
|
|
|
|
|
|
Client.Network.CurrentSim.Parcels.ForEach(delegate(Parcel parcel)
|
|
|
|
|
{
|
2008-10-18 23:53:30 +00:00
|
|
|
sb.AppendFormat("Parcel[{0}]: Name: \"{1}\", Description: \"{2}\" ACLBlacklist Count: {3}, ACLWhiteList Count: {5} Traffic: {4}" + System.Environment.NewLine,
|
|
|
|
|
parcel.LocalID, parcel.Name, parcel.Desc, parcel.AccessBlackList.Count, parcel.Dwell, parcel.AccessWhiteList.Count);
|
2008-03-07 17:43:51 +00:00
|
|
|
});
|
|
|
|
|
|
2008-03-06 21:28:52 +00:00
|
|
|
result = sb.ToString();
|
2008-03-07 17:43:51 +00:00
|
|
|
}
|
2008-03-06 21:28:52 +00:00
|
|
|
else
|
2008-03-07 17:43:51 +00:00
|
|
|
result = "Failed to retrieve information on all the simulator parcels";
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2009-10-17 05:50:51 +00:00
|
|
|
Client.Parcels.SimParcelsDownloaded -= del;
|
2008-03-06 21:28:52 +00:00
|
|
|
return result;
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
|
2009-10-28 08:01:52 +00:00
|
|
|
void Network_OnDisconnected(object sender, DisconnectedEventArgs e)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
ParcelsDownloaded.Set();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|