Moved programs into the Programs folder
git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1958 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
51
Programs/SLProxy/XmlRpcCS/XmlRpcRequestSerializer.cs
Normal file
51
Programs/SLProxy/XmlRpcCS/XmlRpcRequestSerializer.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
namespace Nwc.XmlRpc
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
|
||||
/// <summary>Class responsible for serializing an XML-RPC request.</summary>
|
||||
/// <remarks>This class handles the request envelope, depending on <c>XmlRpcSerializer</c>
|
||||
/// to serialize the payload.</remarks>
|
||||
/// <seealso cref="XmlRpcSerializer"/>
|
||||
public class XmlRpcRequestSerializer : XmlRpcSerializer
|
||||
{
|
||||
static private XmlRpcRequestSerializer _singleton;
|
||||
/// <summary>A static singleton instance of this deserializer.</summary>
|
||||
static public XmlRpcRequestSerializer Singleton
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_singleton == null)
|
||||
_singleton = new XmlRpcRequestSerializer();
|
||||
|
||||
return _singleton;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Serialize the <c>XmlRpcRequest</c> to the output stream.</summary>
|
||||
/// <param name="output">An <c>XmlTextWriter</c> stream to write data to.</param>
|
||||
/// <param name="obj">An <c>XmlRpcRequest</c> to serialize.</param>
|
||||
/// <seealso cref="XmlRpcRequest"/>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user