From e93869c7a785a4f375685ffa33c913033ed1c85a Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 21 Jun 2007 17:08:21 +0000 Subject: * Importing Ming's mass test client --- .../Commands/Land/FindSimCommand.cs | 43 +++++++++++++++ .../Commands/Land/ParcelInfoCommand.cs | 62 ++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 tools/mass test client/Commands/Land/FindSimCommand.cs create mode 100644 tools/mass test client/Commands/Land/ParcelInfoCommand.cs (limited to 'tools/mass test client/Commands/Land') diff --git a/tools/mass test client/Commands/Land/FindSimCommand.cs b/tools/mass test client/Commands/Land/FindSimCommand.cs new file mode 100644 index 0000000..4fcd35c --- /dev/null +++ b/tools/mass test client/Commands/Land/FindSimCommand.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; + +namespace libsecondlife.TestClient +{ + public class FindSimCommand : Command + { + public FindSimCommand(TestClient testClient) + { + Name = "findsim"; + Description = "Searches for a simulator and returns information about it. Usage: findsim [Simulator Name]"; + } + + public override string Execute(string[] args, LLUUID fromAgentID) + { + if (args.Length < 1) + return "Usage: findsim [Simulator Name]"; + + // Build the simulator name from the args list + string simName = string.Empty; + for (int i = 0; i < args.Length; i++) + simName += args[i] + " "; + simName = simName.TrimEnd().ToLower(); + + //if (!GridDataCached[Client]) + //{ + // Client.Grid.RequestAllSims(GridManager.MapLayerType.Objects); + // System.Threading.Thread.Sleep(5000); + // GridDataCached[Client] = true; + //} + + GridRegion region; + + if (Client.Grid.GetGridRegion(simName, out region)) + return String.Format("{0}: handle={1} ({2},{3})", region.Name, region.RegionHandle, region.X, region.Y); + else + return "Lookup of " + simName + " failed"; + } + } +} diff --git a/tools/mass test client/Commands/Land/ParcelInfoCommand.cs b/tools/mass test client/Commands/Land/ParcelInfoCommand.cs new file mode 100644 index 0000000..7119a47 --- /dev/null +++ b/tools/mass test client/Commands/Land/ParcelInfoCommand.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using libsecondlife; +using libsecondlife.Utilities; + +namespace libsecondlife.TestClient +{ + public class ParcelInfoCommand : Command + { + private ParcelDownloader ParcelDownloader; + 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"; + + ParcelDownloader = new ParcelDownloader(testClient); + ParcelDownloader.OnParcelsDownloaded += new ParcelDownloader.ParcelsDownloadedCallback(Parcels_OnParcelsDownloaded); + testClient.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(Network_OnDisconnected); + } + + public override string Execute(string[] args, LLUUID fromAgentID) + { + ParcelDownloader.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 Parcels, int[,] map) + { + foreach (KeyValuePair parcel in Parcels) + { + WaterType type = ParcelDownloader.GetWaterType(map, parcel.Value.LocalID); + float delta = ParcelDownloader.GetHeightRange(map, parcel.Value.LocalID); + int deviation = ParcelDownloader.GetRectangularDeviation(parcel.Value.AABBMin, parcel.Value.AABBMax, + parcel.Value.Area); + + Console.WriteLine("Parcels[{0}]: Name: \"{1}\", Description: \"{2}\" ACL Count: {3}, " + + "Location: {4}, Height Range: {5}, Shape Deviation: {6}", parcel.Key, parcel.Value.Name, + parcel.Value.Desc, parcel.Value.AccessList.Count, type.ToString(), delta, deviation); + } + + ParcelCount = Parcels.Count; + + ParcelsDownloaded.Set(); + } + + void Network_OnDisconnected(NetworkManager.DisconnectType reason, string message) + { + ParcelsDownloaded.Set(); + } + } +} -- cgit v1.1