public XmlRpcMember(string name, XmlRpcValue value) { Name = name; _value = value; }
private static byte[] GetRequestBytes(Encoding encoding, string methodName, XmlRpcValue[] parameters, bool logging) { MemoryStream request = new MemoryStream(); XmlTextWriter writer = new XmlTextWriter(request, encoding); // Amazingly, some configs of WordPress complain // about malformed XML when uploading large posts/images (greater than // 100,000 bytes) if we don't indent. More precisely, there needs to be // fewer than 100,000 bytes before the first line break. Let's just // indent and be done with it. writer.Formatting = Formatting.Indented; writer.Indentation = 1; writer.IndentChar = ' '; writer.WriteStartDocument(); using (new WriteXmlElement(writer, "methodCall")) { using (new WriteXmlElement(writer, "methodName")) writer.WriteString(methodName); using (new WriteXmlElement(writer, "params")) { foreach (XmlRpcValue param in parameters) { using (new WriteXmlElement(writer, "param")) param.Write(writer, logging); } } } writer.WriteEndDocument(); writer.Flush(); return request.ToArray(); }
public XmlRpcArray(XmlRpcValue[] values) : base(values) { }
private void LogXmlRpcRequest(Encoding encodingToUse, string methodName, XmlRpcValue[] parameters) { Trace.WriteLine("XML-RPC request:\r\n" + _hostname + "\r\n" + encodingToUse.GetString(GetRequestBytes(encodingToUse, methodName, parameters, true))); }