aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Framework/SimProfile.cs
blob: ac4cf9e32710a330581d0b1a9e7f52b274edbca7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Collections;
using System.Xml;
using System.Text;
using libsecondlife;
using Nwc.XmlRpc;

namespace OpenSim.Framework.Sims
{
    public class SimProfile : SimProfileBase
    {
        public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey)
        {
            try
            {
                Hashtable GridReqParams = new Hashtable();
                GridReqParams["region_handle"] = region_handle.ToString();
                GridReqParams["caller"] = "userserver";
                GridReqParams["authkey"] = SendKey;
                ArrayList SendParams = new ArrayList();
                SendParams.Add(GridReqParams);
                XmlRpcRequest GridReq = new XmlRpcRequest("get_sim_info", SendParams);

                XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);

                Hashtable RespData = (Hashtable)GridResp.Value;
                this.UUID = new LLUUID((string)RespData["UUID"]);
                this.regionhandle = (ulong)Convert.ToUInt64(RespData["regionhandle"]);
                this.regionname = (string)RespData["regionname"];
                this.sim_ip = (string)RespData["sim_ip"];
                this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
                this.caps_url = (string)RespData["caps_url"];
                this.RegionLocX = (uint)Convert.ToUInt32(RespData["RegionLocX"]);
                this.RegionLocY = (uint)Convert.ToUInt32(RespData["RegionLocY"]);
                this.sendkey = (string)RespData["sendkey"];
                this.recvkey = (string)RespData["recvkey"];
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            return this;
        }

        public SimProfile()
        {
        }
    }

}