diff options
author | gareth | 2007-05-08 00:10:04 +0000 |
---|---|---|
committer | gareth | 2007-05-08 00:10:04 +0000 |
commit | 5b6afeafbc249ba88dcc20d1fbc98ce12418b21b (patch) | |
tree | 78861e5f6ae871d63c83b4ab1cc4c55ea184ed6d /ExportBot/Commands/ParcelInfoCommand.cs | |
parent | ZOMG! (diff) | |
download | opensim-SC_OLD-5b6afeafbc249ba88dcc20d1fbc98ce12418b21b.zip opensim-SC_OLD-5b6afeafbc249ba88dcc20d1fbc98ce12418b21b.tar.gz opensim-SC_OLD-5b6afeafbc249ba88dcc20d1fbc98ce12418b21b.tar.bz2 opensim-SC_OLD-5b6afeafbc249ba88dcc20d1fbc98ce12418b21b.tar.xz |
Brought in TestClient code for teh fork
Diffstat (limited to 'ExportBot/Commands/ParcelInfoCommand.cs')
-rw-r--r-- | ExportBot/Commands/ParcelInfoCommand.cs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/ExportBot/Commands/ParcelInfoCommand.cs b/ExportBot/Commands/ParcelInfoCommand.cs new file mode 100644 index 0000000..e4108a9 --- /dev/null +++ b/ExportBot/Commands/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 | } | ||