From f95b6081cba084d1b067acea99c0effa2b3bf42c Mon Sep 17 00:00:00 2001
From: MW
Date: Thu, 24 May 2007 12:35:32 +0000
Subject: Renamed the new Directories. (removed the "-Source" from the end of
them)
---
Common/XmlRpcCS/XmlRpcRequestSerializer.cs | 51 ++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
create mode 100644 Common/XmlRpcCS/XmlRpcRequestSerializer.cs
(limited to 'Common/XmlRpcCS/XmlRpcRequestSerializer.cs')
diff --git a/Common/XmlRpcCS/XmlRpcRequestSerializer.cs b/Common/XmlRpcCS/XmlRpcRequestSerializer.cs
new file mode 100644
index 0000000..8099bdb
--- /dev/null
+++ b/Common/XmlRpcCS/XmlRpcRequestSerializer.cs
@@ -0,0 +1,51 @@
+namespace Nwc.XmlRpc
+{
+ using System;
+ using System.Collections;
+ using System.Xml;
+ using System.IO;
+
+ /// Class responsible for serializing an XML-RPC request.
+ /// This class handles the request envelope, depending on XmlRpcSerializer
+ /// to serialize the payload.
+ ///
+ public class XmlRpcRequestSerializer : XmlRpcSerializer
+ {
+ static private XmlRpcRequestSerializer _singleton;
+ /// A static singleton instance of this deserializer.
+ static public XmlRpcRequestSerializer Singleton
+ {
+ get
+ {
+ if (_singleton == null)
+ _singleton = new XmlRpcRequestSerializer();
+
+ return _singleton;
+ }
+ }
+
+ /// Serialize the XmlRpcRequest to the output stream.
+ /// An XmlTextWriter stream to write data to.
+ /// An XmlRpcRequest to serialize.
+ ///
+ override public void Serialize(XmlTextWriter output, Object obj)
+ {
+ XmlRpcRequest request = (XmlRpcRequest)obj;
+ output.WriteStartDocument();
+ output.WriteStartElement(METHOD_CALL);
+ output.WriteElementString(METHOD_NAME, request.MethodName);
+ output.WriteStartElement(PARAMS);
+ foreach (Object param in request.Params)
+ {
+ output.WriteStartElement(PARAM);
+ output.WriteStartElement(VALUE);
+ SerializeObject(output, param);
+ output.WriteEndElement();
+ output.WriteEndElement();
+ }
+
+ output.WriteEndElement();
+ output.WriteEndElement();
+ }
+ }
+}
--
cgit v1.1