2008-07-25 08:55:36 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
|
|
namespace OpenMetaverse.TestClient
|
|
|
|
|
{
|
|
|
|
|
public class ParcelPrimOwnersCommand : Command
|
|
|
|
|
{
|
|
|
|
|
public ParcelPrimOwnersCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "primowners";
|
|
|
|
|
Description = "Displays a list of prim owners and prim counts on a parcel. Usage: primowners parcelID";
|
|
|
|
|
Category = CommandCategory.Parcel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
|
|
|
|
{
|
|
|
|
|
if (args.Length < 1)
|
|
|
|
|
return "Usage: primowners parcelID (use parcelinfo to get ID)";
|
|
|
|
|
|
|
|
|
|
int parcelID;
|
|
|
|
|
Parcel parcel;
|
|
|
|
|
StringBuilder result = new StringBuilder();
|
|
|
|
|
// test argument that is is a valid integer, then verify we have that parcel data stored in the dictionary
|
2022-02-25 19:38:11 -06:00
|
|
|
if (int.TryParse(args[0], out parcelID) && Client.Network.CurrentSim.Parcels.TryGetValue(parcelID, out parcel))
|
2008-07-25 08:55:36 +00:00
|
|
|
{
|
|
|
|
|
AutoResetEvent wait = new AutoResetEvent(false);
|
2009-10-17 05:50:51 +00:00
|
|
|
|
|
|
|
|
EventHandler<ParcelObjectOwnersReplyEventArgs> callback = delegate(object sender, ParcelObjectOwnersReplyEventArgs e)
|
2008-07-25 08:55:36 +00:00
|
|
|
{
|
2009-10-17 05:50:51 +00:00
|
|
|
for (int i = 0; i < e.PrimOwners.Count; i++)
|
2008-07-25 08:55:36 +00:00
|
|
|
{
|
2009-10-17 05:50:51 +00:00
|
|
|
result.AppendFormat("Owner: {0} Count: {1}" + System.Environment.NewLine, e.PrimOwners[i].OwnerID, e.PrimOwners[i].Count);
|
2008-07-25 08:55:36 +00:00
|
|
|
wait.Set();
|
|
|
|
|
}
|
|
|
|
|
};
|
2009-10-17 05:50:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Client.Parcels.ParcelObjectOwnersReply += callback;
|
2008-07-25 08:55:36 +00:00
|
|
|
|
2009-10-17 05:50:51 +00:00
|
|
|
Client.Parcels.RequestObjectOwners(Client.Network.CurrentSim, parcelID);
|
2008-07-25 08:55:36 +00:00
|
|
|
if (!wait.WaitOne(10000, false))
|
|
|
|
|
{
|
|
|
|
|
result.AppendLine("Timed out waiting for packet.");
|
|
|
|
|
}
|
2009-10-17 05:50:51 +00:00
|
|
|
Client.Parcels.ParcelObjectOwnersReply -= callback;
|
2008-07-25 08:55:36 +00:00
|
|
|
|
|
|
|
|
return result.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-02-25 19:38:11 -06:00
|
|
|
return
|
|
|
|
|
$"Unable to find Parcel {args[0]} in Parcels Dictionary, Did you run parcelinfo to populate the dictionary first?";
|
2008-07-25 08:55:36 +00:00
|
|
|
}
|
2009-05-08 07:32:49 +00:00
|
|
|
}
|
2008-07-25 08:55:36 +00:00
|
|
|
}
|
|
|
|
|
}
|