diff options
Switched in NameSpaceChanges
Diffstat (limited to 'OpenSim/Framework/General/SimProfile.cs')
-rw-r--r-- | OpenSim/Framework/General/SimProfile.cs | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/OpenSim/Framework/General/SimProfile.cs b/OpenSim/Framework/General/SimProfile.cs new file mode 100644 index 0000000..cfa5e50 --- /dev/null +++ b/OpenSim/Framework/General/SimProfile.cs | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Collections; | ||
31 | using System.Xml; | ||
32 | using System.Text; | ||
33 | using libsecondlife; | ||
34 | using Nwc.XmlRpc; | ||
35 | |||
36 | namespace OpenSim.Framework.Sims | ||
37 | { | ||
38 | public class SimProfile | ||
39 | { | ||
40 | public LLUUID UUID; | ||
41 | public ulong regionhandle; | ||
42 | public string regionname; | ||
43 | public string sim_ip; | ||
44 | public uint sim_port; | ||
45 | public string caps_url; | ||
46 | public uint RegionLocX; | ||
47 | public uint RegionLocY; | ||
48 | public string sendkey; | ||
49 | public string recvkey; | ||
50 | public bool online; | ||
51 | |||
52 | public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey) | ||
53 | { | ||
54 | try | ||
55 | { | ||
56 | Hashtable GridReqParams = new Hashtable(); | ||
57 | GridReqParams["region_handle"] = region_handle.ToString(); | ||
58 | GridReqParams["authkey"] = SendKey; | ||
59 | ArrayList SendParams = new ArrayList(); | ||
60 | SendParams.Add(GridReqParams); | ||
61 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); | ||
62 | |||
63 | XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000); | ||
64 | |||
65 | Hashtable RespData = (Hashtable)GridResp.Value; | ||
66 | this.UUID = new LLUUID((string)RespData["UUID"]); | ||
67 | this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256)); | ||
68 | this.regionname = (string)RespData["regionname"]; | ||
69 | this.sim_ip = (string)RespData["sim_ip"]; | ||
70 | this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]); | ||
71 | this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/"; | ||
72 | this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]); | ||
73 | this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]); | ||
74 | this.sendkey = SendKey; | ||
75 | this.recvkey = RecvKey; | ||
76 | } | ||
77 | catch (Exception e) | ||
78 | { | ||
79 | System.Console.WriteLine(e.ToString()); | ||
80 | } | ||
81 | return this; | ||
82 | } | ||
83 | |||
84 | public SimProfile LoadFromGrid(LLUUID UUID, string GridURL, string SendKey, string RecvKey) | ||
85 | { | ||
86 | try | ||
87 | { | ||
88 | Hashtable GridReqParams = new Hashtable(); | ||
89 | GridReqParams["UUID"] = UUID.ToString(); | ||
90 | GridReqParams["authkey"] = SendKey; | ||
91 | ArrayList SendParams = new ArrayList(); | ||
92 | SendParams.Add(GridReqParams); | ||
93 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); | ||
94 | |||
95 | XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000); | ||
96 | |||
97 | Hashtable RespData = (Hashtable)GridResp.Value; | ||
98 | this.UUID = new LLUUID((string)RespData["UUID"]); | ||
99 | this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256)); | ||
100 | this.regionname = (string)RespData["regionname"]; | ||
101 | this.sim_ip = (string)RespData["sim_ip"]; | ||
102 | this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]); | ||
103 | this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/"; | ||
104 | this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]); | ||
105 | this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]); | ||
106 | this.sendkey = SendKey; | ||
107 | this.recvkey = RecvKey; | ||
108 | } | ||
109 | catch (Exception e) | ||
110 | { | ||
111 | System.Console.WriteLine(e.ToString()); | ||
112 | } | ||
113 | return this; | ||
114 | } | ||
115 | |||
116 | |||
117 | public SimProfile() | ||
118 | { | ||
119 | } | ||
120 | } | ||
121 | |||
122 | } | ||