private void WaitOnResponse() { Thread.Sleep(100); WebResponse response = request.GetResponse(); XmlRpcRequestEventArgs e = DecodeRequest(response.GetResponseStream()); // yes!! e.message_id = this.guid; if (OnReply != null) { OnReply(this, e); } }
private XmlRpcRequestEventArgs DecodeRequest(System.IO.Stream stream) { XmlRpcRequestEventArgs e = new XmlRpcRequestEventArgs(); e.sender = ""; e.message_id = SecondLife.NULL_KEY; /* * <?xml version="1.0"?> * <methodCall> * <methodName>llRemoteData</methodName> * <params> * <param> * <value> * <struct> * <member> * <name>Channel</name> * <value><string>4a250e12-c02e-94fb-6d2f-13529cbaad63</string></value> * </member> * <member> * <name>IntValue</name> * <value><int>0</int></value> * </member> * <member> * <name>StringValue</name> * <value><string>test</string></value> * </member> * </struct> * </value> * </param> * </params> * </methodCall> */ XmlDocument xml = new XmlDocument(); xml.Load(stream); XmlNode methodCall = xml.SelectSingleNode("/methodCall"); if (methodCall == null) { return(e); } XmlNode methodName = methodCall.SelectSingleNode("./methodName"); if (methodName == null) { return(e); } if (methodName.InnerText != "llRemoteData") { return(e); } foreach (XmlNode xmlMember in methodCall.SelectNodes("./params/param/value/struct/member")) { string strName = xmlMember.SelectSingleNode("./name").InnerText; string strValue = xmlMember.SelectSingleNode("./value").InnerText; switch (strName) { case "Channel": e.channel = new SecondLife.key(strValue); break; case "StringValue": e.sData = strValue; break; case "IntValue": int iData; int.TryParse(strValue, out iData); e.iData = iData; break; default: break; } } return(e); }