From 3436961bb5c01d659d09be134368f4f69460cef9 Mon Sep 17 00:00:00 2001 From: MW Date: Sat, 26 May 2007 13:40:19 +0000 Subject: Start of rewrite 5279! --- Common/OpenSim.Framework/SimProfile.cs | 83 ++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Common/OpenSim.Framework/SimProfile.cs (limited to 'Common/OpenSim.Framework/SimProfile.cs') 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 @@ +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["authkey"] = SendKey; + ArrayList SendParams = new ArrayList(); + SendParams.Add(GridReqParams); + XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); + + XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000); + + Hashtable RespData = (Hashtable)GridResp.Value; + this.UUID = new LLUUID((string)RespData["UUID"]); + this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256)); + this.regionname = (string)RespData["regionname"]; + this.sim_ip = (string)RespData["sim_ip"]; + this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]); + this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/"; + this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]); + this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]); + this.sendkey = SendKey; + this.recvkey = RecvKey; + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + return this; + } + + public SimProfile LoadFromGrid(LLUUID UUID, string GridURL, string SendKey, string RecvKey) + { + try + { + Hashtable GridReqParams = new Hashtable(); + GridReqParams["UUID"] = UUID.ToString(); + GridReqParams["authkey"] = SendKey; + ArrayList SendParams = new ArrayList(); + SendParams.Add(GridReqParams); + XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); + + XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000); + + Hashtable RespData = (Hashtable)GridResp.Value; + this.UUID = new LLUUID((string)RespData["UUID"]); + this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256)); + this.regionname = (string)RespData["regionname"]; + this.sim_ip = (string)RespData["sim_ip"]; + this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]); + this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/"; + this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]); + this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]); + this.sendkey = SendKey; + this.recvkey = RecvKey; + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + return this; + } + + + public SimProfile() + { + } + } + +} -- cgit v1.1