diff options
Diffstat (limited to 'Common/OpenSim.Framework/SimProfile.cs')
-rw-r--r-- | Common/OpenSim.Framework/SimProfile.cs | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/Common/OpenSim.Framework/SimProfile.cs b/Common/OpenSim.Framework/SimProfile.cs new file mode 100644 index 0000000..8acb20b --- /dev/null +++ b/Common/OpenSim.Framework/SimProfile.cs | |||
@@ -0,0 +1,83 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Collections; | ||
4 | using System.Xml; | ||
5 | using System.Text; | ||
6 | using libsecondlife; | ||
7 | using Nwc.XmlRpc; | ||
8 | |||
9 | namespace OpenSim.Framework.Sims | ||
10 | { | ||
11 | public class SimProfile : SimProfileBase | ||
12 | { | ||
13 | public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey) | ||
14 | { | ||
15 | try | ||
16 | { | ||
17 | Hashtable GridReqParams = new Hashtable(); | ||
18 | GridReqParams["region_handle"] = region_handle.ToString(); | ||
19 | GridReqParams["authkey"] = SendKey; | ||
20 | ArrayList SendParams = new ArrayList(); | ||
21 | SendParams.Add(GridReqParams); | ||
22 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); | ||
23 | |||
24 | XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000); | ||
25 | |||
26 | Hashtable RespData = (Hashtable)GridResp.Value; | ||
27 | this.UUID = new LLUUID((string)RespData["UUID"]); | ||
28 | this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256)); | ||
29 | this.regionname = (string)RespData["regionname"]; | ||
30 | this.sim_ip = (string)RespData["sim_ip"]; | ||
31 | this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]); | ||
32 | this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/"; | ||
33 | this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]); | ||
34 | this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]); | ||
35 | this.sendkey = SendKey; | ||
36 | this.recvkey = RecvKey; | ||
37 | } | ||
38 | catch (Exception e) | ||
39 | { | ||
40 | Console.WriteLine(e.ToString()); | ||
41 | } | ||
42 | return this; | ||
43 | } | ||
44 | |||
45 | public SimProfile LoadFromGrid(LLUUID UUID, string GridURL, string SendKey, string RecvKey) | ||
46 | { | ||
47 | try | ||
48 | { | ||
49 | Hashtable GridReqParams = new Hashtable(); | ||
50 | GridReqParams["UUID"] = UUID.ToString(); | ||
51 | GridReqParams["authkey"] = SendKey; | ||
52 | ArrayList SendParams = new ArrayList(); | ||
53 | SendParams.Add(GridReqParams); | ||
54 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); | ||
55 | |||
56 | XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000); | ||
57 | |||
58 | Hashtable RespData = (Hashtable)GridResp.Value; | ||
59 | this.UUID = new LLUUID((string)RespData["UUID"]); | ||
60 | this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256)); | ||
61 | this.regionname = (string)RespData["regionname"]; | ||
62 | this.sim_ip = (string)RespData["sim_ip"]; | ||
63 | this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]); | ||
64 | this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/"; | ||
65 | this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]); | ||
66 | this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]); | ||
67 | this.sendkey = SendKey; | ||
68 | this.recvkey = RecvKey; | ||
69 | } | ||
70 | catch (Exception e) | ||
71 | { | ||
72 | Console.WriteLine(e.ToString()); | ||
73 | } | ||
74 | return this; | ||
75 | } | ||
76 | |||
77 | |||
78 | public SimProfile() | ||
79 | { | ||
80 | } | ||
81 | } | ||
82 | |||
83 | } | ||