/// <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); } } }
/// <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); }
/// <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(); }