Ejemplo n.º 1
0
 public XmlRpcMember(string name, XmlRpcValue value)
 {
     Name   = name;
     _value = value;
 }
Ejemplo n.º 2
0
 public XmlRpcMember(string name, XmlRpcValue value)
 {
     Name = name;
     _value = value;
 }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
 public XmlRpcArray(XmlRpcValue[] values)
     : base(values)
 {
 }
Ejemplo n.º 5
0
 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)));
 }