2008-03-12 05:49:07 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
2008-07-21 21:12:59 +00:00
|
|
|
using OpenMetaverse;
|
2008-03-12 05:49:07 +00:00
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2008-03-12 05:49:07 +00:00
|
|
|
{
|
|
|
|
|
public class ParcelDetailsCommand : Command
|
|
|
|
|
{
|
|
|
|
|
public ParcelDetailsCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "parceldetails";
|
|
|
|
|
Description = "Displays parcel details from the ParcelTracker dictionary. Usage: parceldetails parcelID";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.Parcel;
|
2008-03-12 05:49:07 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2008-03-12 05:49:07 +00:00
|
|
|
{
|
|
|
|
|
if (args.Length < 1)
|
|
|
|
|
return "Usage: parceldetails parcelID (use parcelinfo to get ID)";
|
|
|
|
|
|
|
|
|
|
int parcelID;
|
|
|
|
|
Parcel parcel;
|
|
|
|
|
|
|
|
|
|
// test argument that is is a valid integer, then verify we have that parcel data stored in the dictionary
|
|
|
|
|
if (Int32.TryParse(args[0], out parcelID) && Client.Network.CurrentSim.Parcels.TryGetValue(parcelID, out parcel))
|
|
|
|
|
{
|
|
|
|
|
// this request will update the parcels dictionary
|
2009-10-17 05:50:51 +00:00
|
|
|
Client.Parcels.RequestParcelProperties(Client.Network.CurrentSim, parcelID, 0);
|
2008-03-12 05:49:07 +00:00
|
|
|
|
|
|
|
|
// Use reflection to dynamically get the fields from the Parcel struct
|
|
|
|
|
Type t = parcel.GetType();
|
|
|
|
|
System.Reflection.FieldInfo[] fields = t.GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
foreach (System.Reflection.FieldInfo field in fields)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendFormat("{0} = {1}" + System.Environment.NewLine, field.Name, field.GetValue(parcel));
|
|
|
|
|
}
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return String.Format("Unable to find Parcel {0} in Parcels Dictionary, Did you run parcelinfo to populate the dictionary first?", args[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|