SimProfile.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. namespace OpenSim.Framework.Sims
  9. {
  10. public class SimProfile : SimProfileBase
  11. {
  12. public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey)
  13. {
  14. try
  15. {
  16. Hashtable GridReqParams = new Hashtable();
  17. GridReqParams["region_handle"] = region_handle.ToString();
  18. GridReqParams["caller"] = "userserver";
  19. GridReqParams["authkey"] = SendKey;
  20. ArrayList SendParams = new ArrayList();
  21. SendParams.Add(GridReqParams);
  22. XmlRpcRequest GridReq = new XmlRpcRequest("get_sim_info", SendParams);
  23. XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
  24. Hashtable RespData = (Hashtable)GridResp.Value;
  25. this.UUID = new LLUUID((string)RespData["UUID"]);
  26. this.regionhandle = (ulong)Convert.ToUInt64(RespData["regionhandle"]);
  27. this.regionname = (string)RespData["regionname"];
  28. this.sim_ip = (string)RespData["sim_ip"];
  29. this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
  30. this.caps_url = (string)RespData["caps_url"];
  31. this.RegionLocX = (uint)Convert.ToUInt32(RespData["RegionLocX"]);
  32. this.RegionLocY = (uint)Convert.ToUInt32(RespData["RegionLocY"]);
  33. this.sendkey = (string)RespData["sendkey"];
  34. this.recvkey = (string)RespData["recvkey"];
  35. }
  36. catch (Exception e)
  37. {
  38. Console.WriteLine(e.ToString());
  39. }
  40. return this;
  41. }
  42. public SimProfile()
  43. {
  44. }
  45. }
  46. }