// Writes a XmlRpc MethodCall from the XmlRpcMethod object public void Serialize( Stream stream, object o ) { if(stream == null) { throw new ArgumentNullException("stream", "Argument must not be null"); } if(o == null) { throw new ArgumentNullException("o", "Argument must not be null"); } if( o is XmlRpcMethod ) { //StringWriter s = new StringWriter(); //XmlRpcWriter w = new XmlRpcWriter( s ); //w.Write( (XmlRpcMethod)o ); //StreamWriter sw = new StreamWriter( stream ); //sw.Write( s.ToString() ); //sw.Flush(); StreamWriter sw = new StreamWriter( stream ); XmlRpcWriter w = new XmlRpcWriter( sw ); w.Write( (XmlRpcMethod)o ); w.Flush(); } else { // TODO This should be an exception Console.Out.WriteLine ( "MethodCallFormatter: Oh No! wrong type given: {0}, expected and object of type {1}", o.GetType(), "DotGNU.XmlRpc.XmlRpcMethod" ); } }
// Writes an object as an XmlRpc response public void Serialize( Stream stream, object o ) { if(stream == null) { throw new ArgumentNullException("stream", "Argument must not be null"); } if(o == null) { throw new ArgumentNullException("o", "Argument must not be null"); } if( o is XmlRpcResponse ){ StreamWriter sw = new StreamWriter( stream ); XmlRpcWriter w = new XmlRpcWriter( sw ); w.Write( (XmlRpcResponse)o ); w.Flush(); } else { // TODO This should be an exception Console.Out.WriteLine ( "iMethodResponseFormatter: On No! Wrong type given: {0}, expected and object of type {1}", o.GetType(), "DotGNU.XmlRpc.XmlRpcResponse" ); } }