2008-07-25 08:55:36 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
|
|
namespace OpenMetaverse.TestClient
|
|
|
|
|
{
|
|
|
|
|
public class ParcelSelectObjectsCommand : Command
|
|
|
|
|
{
|
|
|
|
|
public ParcelSelectObjectsCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "selectobjects";
|
|
|
|
|
Description = "Displays a list of prim localIDs on a given parcel with a specific owner. Usage: selectobjects parcelID OwnerUUID";
|
|
|
|
|
Category = CommandCategory.Parcel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
|
|
|
|
{
|
|
|
|
|
if (args.Length < 2)
|
|
|
|
|
return "Usage: selectobjects parcelID OwnerUUID (use parcelinfo to get ID, use parcelprimowners to get ownerUUID)";
|
|
|
|
|
|
|
|
|
|
int parcelID;
|
|
|
|
|
UUID ownerUUID;
|
|
|
|
|
|
|
|
|
|
int counter = 0;
|
|
|
|
|
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)
|
2008-07-25 08:55:36 +00:00
|
|
|
&& UUID.TryParse(args[1], out ownerUUID))
|
|
|
|
|
{
|
|
|
|
|
AutoResetEvent wait = new AutoResetEvent(false);
|
2009-10-17 05:50:51 +00:00
|
|
|
EventHandler<ForceSelectObjectsReplyEventArgs> callback = delegate(object sender, ForceSelectObjectsReplyEventArgs e)
|
2008-07-25 08:55:36 +00:00
|
|
|
{
|
2021-07-25 11:10:52 -05:00
|
|
|
foreach (var id in e.ObjectIDs)
|
2008-07-25 08:55:36 +00:00
|
|
|
{
|
2021-07-25 11:10:52 -05:00
|
|
|
result.Append(id + " ");
|
2008-07-25 08:55:36 +00:00
|
|
|
counter++;
|
|
|
|
|
}
|
2021-07-25 11:10:52 -05:00
|
|
|
|
2009-10-17 05:50:51 +00:00
|
|
|
if (e.ObjectIDs.Count < 251)
|
2008-07-25 08:55:36 +00:00
|
|
|
wait.Set();
|
|
|
|
|
};
|
2009-10-17 05:50:51 +00:00
|
|
|
|
2008-07-25 08:55:36 +00:00
|
|
|
|
2009-10-17 05:50:51 +00:00
|
|
|
Client.Parcels.ForceSelectObjectsReply += callback;
|
|
|
|
|
Client.Parcels.RequestSelectObjects(parcelID, (ObjectReturnType)16, ownerUUID);
|
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(30000, false))
|
|
|
|
|
{
|
|
|
|
|
result.AppendLine("Timed out waiting for packet.");
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-17 05:50:51 +00:00
|
|
|
Client.Parcels.ForceSelectObjectsReply -= callback;
|
2008-07-25 08:55:36 +00:00
|
|
|
result.AppendLine("Found a total of " + counter + " Objects");
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|