From 9ed0a8dbad121b64ca8baca78f28ca58602c47ca Mon Sep 17 00:00:00 2001
From: MW
Date: Wed, 25 Apr 2007 18:12:06 +0000
Subject: updated to use lastest version of libsl but is currently broke when
using SL viewer 1.15.02, due to big changes in the message templates.
---
XmlRpcCS/XmlRpcResponseSerializer.cs | 57 ++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 XmlRpcCS/XmlRpcResponseSerializer.cs
(limited to 'XmlRpcCS/XmlRpcResponseSerializer.cs')
diff --git a/XmlRpcCS/XmlRpcResponseSerializer.cs b/XmlRpcCS/XmlRpcResponseSerializer.cs
new file mode 100644
index 0000000..72ca568
--- /dev/null
+++ b/XmlRpcCS/XmlRpcResponseSerializer.cs
@@ -0,0 +1,57 @@
+namespace Nwc.XmlRpc
+{
+ using System;
+ using System.Collections;
+ using System.Xml;
+
+ /// Class responsible for serializing an XML-RPC response.
+ /// This class handles the response envelope, depending on XmlRpcSerializer
+ /// to serialize the payload.
+ ///
+ public class XmlRpcResponseSerializer : XmlRpcSerializer
+ {
+ static private XmlRpcResponseSerializer _singleton;
+ /// A static singleton instance of this deserializer.
+ static public XmlRpcResponseSerializer Singleton
+ {
+ get
+ {
+ if (_singleton == null)
+ _singleton = new XmlRpcResponseSerializer();
+
+ return _singleton;
+ }
+ }
+
+ /// Serialize the XmlRpcResponse to the output stream.
+ /// An XmlTextWriter stream to write data to.
+ /// An Object to serialize.
+ ///
+ override public void Serialize(XmlTextWriter output, Object obj)
+ {
+ XmlRpcResponse response = (XmlRpcResponse)obj;
+
+ output.WriteStartDocument();
+ output.WriteStartElement(METHOD_RESPONSE);
+
+ if (response.IsFault)
+ output.WriteStartElement(FAULT);
+ else
+ {
+ output.WriteStartElement(PARAMS);
+ output.WriteStartElement(PARAM);
+ }
+
+ output.WriteStartElement(VALUE);
+
+ SerializeObject(output, response.Value);
+
+ output.WriteEndElement();
+
+ output.WriteEndElement();
+ if (!response.IsFault)
+ output.WriteEndElement();
+ output.WriteEndElement();
+ }
+ }
+}
--
cgit v1.1