/// <inheritdoc />
 protected override void AttachImpl(Attachment attachment)
 {
     if (!primary.IsClosed)
     {
         primary.Attach(attachment);
     }
 }
Example #2
0
        /// <summary>
        /// Writes the contents of the document to a markup document writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="writer"/> is null.</exception>
        public void WriteTo(MarkupDocumentWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            foreach (AttachmentData attachment in attachments)
            {
                writer.Attach(Attachment.FromAttachmentData(attachment));
            }

            foreach (StructuredStream stream in streams)
            {
                stream.WriteTo(writer[stream.Name]);
            }
        }
        /// <summary>
        /// Writes the contents of the document to a markup document writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="writer"/> is null.</exception>
        public void WriteTo(MarkupDocumentWriter writer)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");

            foreach (AttachmentData attachment in attachments)
                writer.Attach(Attachment.FromAttachmentData(attachment));

            foreach (StructuredStream stream in streams)
                stream.WriteTo(writer[stream.Name]);
        }