/[dgee]/dgee/cslib/DotGNU/XmlRpc/Serialization/MethodResponseFormatter.cs
ViewVC logotype

Diff of /dgee/cslib/DotGNU/XmlRpc/Serialization/MethodResponseFormatter.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.2 by npg, Sun Jul 27 13:03:26 2003 UTC revision 1.1.2.3 by npg, Mon Jul 28 19:02:25 2003 UTC
# Line 23  Line 23 
23   */   */
24  using System.Runtime.Serialization;  using System.Runtime.Serialization;
25  using System.IO;  using System.IO;
26    using System.Xml;
27    using DotGNU.XmlRpc;
28    
29  namespace DotGNU.XmlRpc.Serialization  namespace DotGNU.XmlRpc.Serialization.Formatters
30  {  {
31    public sealed class MethodResponseFormatter : IFormatter    public sealed class MethodResponseFormatter : IFormatter
32    {    {
33        private SerializationBinder binder;
34        private StreamingContext context;
35        private ISurrogateSelector surrogateSelector;
36    
37        public MethodResponseFormatter()
38        {
39          context = new StreamingContext( StreamingContextStates.All );
40        }
41    
42        // Returns the object wrapped in the XmlRpc response
43      public object Deserialize( Stream stream )      public object Deserialize( Stream stream )
44      {      {
45        return null;        StreamReader reader = new StreamReader( stream );
46          XmlTextReader tr = new XmlTextReader( stream );
47          XmlRpcResponse response = new XmlRpcResponse();
48          response.Read( tr );
49    
50          return response;
51      }      }
52    
53        // Writes an object as an XmlRpc response
54      public void Serialize( Stream stream, object o )      public void Serialize( Stream stream, object o )
55      {      {
56          if( o is XmlRpcResponse ){
57            StreamWriter sw = new StreamWriter( stream );
58            StringWriter s = new StringWriter();
59            XmlRpcWriter w = new XmlRpcWriter( sw );
60            w.Write( (XmlRpcResponse)o );
61            sw.Write( s.ToString() );
62            sw.Flush();
63          }
64          else {
65            Console.Out.WriteLine
66              ( "BUMMER: wrong type given: {0}, expected and object of type {1}",
67                o.GetType(), "DotGNU.XmlRpc.XmlRpcResponse" );
68          }
69      }      }
70    
71      public SerializationBinder Binder      public SerializationBinder Binder
72      {      {
73        get{        get{
74          return null;          return this.binder;
75        }        }
76        set{        set{
77            this.binder = value;
78        }        }
79      }      }
80    
# Line 58  namespace DotGNU.XmlRpc.Serialization Line 90  namespace DotGNU.XmlRpc.Serialization
90      public ISurrogateSelector SurrogateSelector      public ISurrogateSelector SurrogateSelector
91      {      {
92        get {        get {
93          return null;          return this.surrogateSelector;
           
94        }        }
95        set {        set {
96            this.surrogateSelector = value;
97        }        }
98      }      }
       
99    }    }
100  }  }
101    

Legend:
Removed from v.1.1.2.2  
changed lines
  Added in v.1.1.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26