Example #1
0
 /// <summary>
 /// Writes the body of an object in the output
 /// </summary>
 public override void WriteObjectContent(System.Xml.XmlDictionaryWriter writer, object graph)
 {
     if (writer == null)
     {
         throw new ArgumentNullException(writer.GetType().Name);
     }
     if (graph == null)
     {
         writer.WriteAttributeString("nil", "true");
     }
     else
     {
         using (MemoryStream ms = new MemoryStream())
         {
             if (isList)
             {
                 model.Serialize(ms, graph, null);
             }
             else
             {
                 using (ProtoWriter protoWriter = new ProtoWriter(ms, model, null))
                 {
                     model.Serialize(key, graph, protoWriter);
                 }
             }
             byte[] buffer = ms.GetBuffer();
             writer.WriteBase64(buffer, 0, (int)ms.Length);
         }
     }
 }
Example #2
0
 /// <summary>
 /// Begins an object in the output
 /// </summary>
 public override void WriteStartObject(System.Xml.XmlDictionaryWriter writer, object graph)
 {
     if (writer == null)
     {
         throw new ArgumentNullException(writer.GetType().Name);
     }
     writer.WriteStartElement(PROTO_ELEMENT);
 }
Example #3
0
 /// <summary>
 /// Ends an object in the output
 /// </summary>
 public override void WriteEndObject(System.Xml.XmlDictionaryWriter writer)
 {
     if (writer == null)
     {
         throw new ArgumentNullException(writer.GetType().Name);
     }
     writer.WriteEndElement();
 }