diff options
author | Adam Frisby | 2007-06-21 17:08:21 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-21 17:08:21 +0000 |
commit | e93869c7a785a4f375685ffa33c913033ed1c85a (patch) | |
tree | abb5e2c58f8750a1bc05acf58716b6b025da4d15 /tools/mass test client/Commands/Land | |
parent | Fixed the struct and null compare bug. (diff) | |
download | opensim-SC-e93869c7a785a4f375685ffa33c913033ed1c85a.zip opensim-SC-e93869c7a785a4f375685ffa33c913033ed1c85a.tar.gz opensim-SC-e93869c7a785a4f375685ffa33c913033ed1c85a.tar.bz2 opensim-SC-e93869c7a785a4f375685ffa33c913033ed1c85a.tar.xz |
* Importing Ming's mass test client
Diffstat (limited to 'tools/mass test client/Commands/Land')
-rw-r--r-- | tools/mass test client/Commands/Land/FindSimCommand.cs | 43 | ||||
-rw-r--r-- | tools/mass test client/Commands/Land/ParcelInfoCommand.cs | 62 |
2 files changed, 105 insertions, 0 deletions
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 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | |||
7 | namespace libsecondlife.TestClient | ||
8 | { | ||
9 | public class FindSimCommand : Command | ||
10 | { | ||
11 | public FindSimCommand(TestClient testClient) | ||
12 | { | ||
13 | Name = "findsim"; | ||
14 | Description = "Searches for a simulator and returns information about it. Usage: findsim [Simulator Name]"; | ||
15 | } | ||
16 | |||
17 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
18 | { | ||
19 | if (args.Length < 1) | ||
20 | return "Usage: findsim [Simulator Name]"; | ||
21 | |||
22 | // Build the simulator name from the args list | ||
23 | string simName = string.Empty; | ||
24 | for (int i = 0; i < args.Length; i++) | ||
25 | simName += args[i] + " "; | ||
26 | simName = simName.TrimEnd().ToLower(); | ||
27 | |||
28 | //if (!GridDataCached[Client]) | ||
29 | //{ | ||
30 | // Client.Grid.RequestAllSims(GridManager.MapLayerType.Objects); | ||
31 | // System.Threading.Thread.Sleep(5000); | ||
32 | // GridDataCached[Client] = true; | ||
33 | //} | ||
34 | |||
35 | GridRegion region; | ||
36 | |||
37 | if (Client.Grid.GetGridRegion(simName, out region)) | ||
38 | return String.Format("{0}: handle={1} ({2},{3})", region.Name, region.RegionHandle, region.X, region.Y); | ||
39 | else | ||
40 | return "Lookup of " + simName + " failed"; | ||
41 | } | ||
42 | } | ||
43 | } | ||
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 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Threading; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Utilities; | ||
6 | |||
7 | namespace libsecondlife.TestClient | ||
8 | { | ||
9 | public class ParcelInfoCommand : Command | ||
10 | { | ||
11 | private ParcelDownloader ParcelDownloader; | ||
12 | private ManualResetEvent ParcelsDownloaded = new ManualResetEvent(false); | ||
13 | private int ParcelCount = 0; | ||
14 | |||
15 | public ParcelInfoCommand(TestClient testClient) | ||
16 | { | ||
17 | Name = "parcelinfo"; | ||
18 | Description = "Prints out info about all the parcels in this simulator"; | ||
19 | |||
20 | ParcelDownloader = new ParcelDownloader(testClient); | ||
21 | ParcelDownloader.OnParcelsDownloaded += new ParcelDownloader.ParcelsDownloadedCallback(Parcels_OnParcelsDownloaded); | ||
22 | testClient.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(Network_OnDisconnected); | ||
23 | } | ||
24 | |||
25 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
26 | { | ||
27 | ParcelDownloader.DownloadSimParcels(Client.Network.CurrentSim); | ||
28 | |||
29 | ParcelsDownloaded.Reset(); | ||
30 | ParcelsDownloaded.WaitOne(20000, false); | ||
31 | |||
32 | if (Client.Network.CurrentSim != null) | ||
33 | return "Downloaded information for " + ParcelCount + " parcels in " + Client.Network.CurrentSim.Name; | ||
34 | else | ||
35 | return String.Empty; | ||
36 | } | ||
37 | |||
38 | void Parcels_OnParcelsDownloaded(Simulator simulator, Dictionary<int, Parcel> Parcels, int[,] map) | ||
39 | { | ||
40 | foreach (KeyValuePair<int, Parcel> parcel in Parcels) | ||
41 | { | ||
42 | WaterType type = ParcelDownloader.GetWaterType(map, parcel.Value.LocalID); | ||
43 | float delta = ParcelDownloader.GetHeightRange(map, parcel.Value.LocalID); | ||
44 | int deviation = ParcelDownloader.GetRectangularDeviation(parcel.Value.AABBMin, parcel.Value.AABBMax, | ||
45 | parcel.Value.Area); | ||
46 | |||
47 | Console.WriteLine("Parcels[{0}]: Name: \"{1}\", Description: \"{2}\" ACL Count: {3}, " + | ||
48 | "Location: {4}, Height Range: {5}, Shape Deviation: {6}", parcel.Key, parcel.Value.Name, | ||
49 | parcel.Value.Desc, parcel.Value.AccessList.Count, type.ToString(), delta, deviation); | ||
50 | } | ||
51 | |||
52 | ParcelCount = Parcels.Count; | ||
53 | |||
54 | ParcelsDownloaded.Set(); | ||
55 | } | ||
56 | |||
57 | void Network_OnDisconnected(NetworkManager.DisconnectType reason, string message) | ||
58 | { | ||
59 | ParcelsDownloaded.Set(); | ||
60 | } | ||
61 | } | ||
62 | } | ||