Exemple #1
0
        /// <summary>
        /// Updates this entity with the multipart body parts and content type provided.
        /// using a custom serializer
        /// </summary>
        /// <param name="entities">The mulitpart bodyparts to update.</param>
        /// <param name="contentType">The main body part to use</param>
        /// <param name="serializer">The custom serializer to use.</param>
        public virtual void SetParts(IEnumerable <MimeEntity> entities, string contentType, MimeSerializer serializer)
        {
            if (entities == null)
            {
                throw new ArgumentNullException("entities");
            }
            if (serializer == null)
            {
                throw new ArgumentNullException("serializer");
            }

            if (string.IsNullOrEmpty(contentType))
            {
                contentType = MimeStandard.MediaType.MultipartMixed;
            }

            this.ContentType = contentType;
            this.Body        = new Body(serializer.Serialize(entities, this.ParsedContentType.Boundary));
        }
Exemple #2
0
 /// <summary>
 /// Updates this entity with the multipart entity, updating headers and body as appropriate,
 /// using a custom serializer
 /// </summary>
 /// <param name="entities">The mulitpart entity to update.</param>
 /// <param name="serializer">The serializer to use</param>
 public void SetParts(MultipartEntity entities, MimeSerializer serializer)
 {
     this.SetParts(entities, entities.ContentType.ToString(), serializer);
 }