コード例 #1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="contentType">Content type.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>contentType</b> is null reference.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception>
        public MIME_b_Multipart(MIME_h_ContentType contentType)
            : base(contentType)
        {
            if(contentType == null){
                throw new ArgumentNullException("contentType");
            }
            if(string.IsNullOrEmpty(contentType.Param_Boundary)){
                throw new ArgumentException("Argument 'contentType' doesn't contain required boundary parameter.");
            }

            m_pBodyParts = new MIME_EntityCollection();
        }
コード例 #2
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="contentType">Content type.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>contentType</b> is null reference.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception>
        public MIME_b_Multipart(MIME_h_ContentType contentType) : base(contentType)
        {
            if (contentType == null)
            {
                throw new ArgumentNullException("contentType");
            }
            if (string.IsNullOrEmpty(contentType.Param_Boundary))
            {
                throw new ArgumentException("Argument 'contentType' doesn't contain required boundary parameter.");
            }

            m_pBodyParts = new MIME_EntityCollection();
        }
コード例 #3
0
        /// <summary>
        /// Gets all MIME entities as list.
        /// </summary>
        /// <param name="includeEmbbedMessage">If true, then embbed RFC822 message child entities are included.</param>
        /// <returns>Returns all MIME entities as list.</returns>
        /// <exception cref="ObjectDisposedException">Is raised when this class is disposed and this method is accessed.</exception>
        public MIME_Entity[] GetAllEntities(bool includeEmbbedMessage)
        {
            if (m_IsDisposed)
            {
                throw new ObjectDisposedException(this.GetType().Name);
            }

            List <MIME_Entity> retVal        = new List <MIME_Entity>();
            List <MIME_Entity> entitiesQueue = new List <MIME_Entity>();

            entitiesQueue.Add(this);

            while (entitiesQueue.Count > 0)
            {
                MIME_Entity currentEntity = entitiesQueue[0];
                entitiesQueue.RemoveAt(0);

                retVal.Add(currentEntity);

                // Current entity is multipart entity, add it's body-parts for processing.

                if (this.Body != null
                    &&
                    System.Reflection.IntrospectionExtensions.GetTypeInfo(currentEntity.Body.GetType())
                    .IsSubclassOf(typeof(MIME_b_Multipart)))
                {
                    MIME_EntityCollection bodyParts = ((MIME_b_Multipart)currentEntity.Body).BodyParts;
                    for (int i = 0; i < bodyParts.Count; i++)
                    {
                        entitiesQueue.Insert(i, bodyParts[i]);
                    }
                }
                // Add embbed message for processing (Embbed message entities will be included).
                else if (includeEmbbedMessage && this.Body != null && currentEntity.Body is MIME_b_MessageRfc822)
                {
                    entitiesQueue.Add(((MIME_b_MessageRfc822)currentEntity.Body).Message);
                }
            }

            return(retVal.ToArray());
        }
コード例 #4
0
 /// <summary>
 /// Internal constructor. No Content-Type is created, user must do it manually.
 /// </summary>
 internal MIME_b_Multipart() 
 {
     m_pBodyParts = new MIME_EntityCollection();
 }
コード例 #5
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="owner">Owner MIME entity.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>owner</b> is null.</exception>
        internal MIME_MultipartBody(MIME_Entity owner) : base(owner)
        {
            m_Boundary = owner.ContentType.Param_Boundary;

            m_pParts = new MIME_EntityCollection();
        }
コード例 #6
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="owner">Owner MIME entity.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>owner</b> is null.</exception>
        internal MIME_MultipartBody(MIME_Entity owner) : base(owner)
        {
            m_Boundary = owner.ContentType.Param_Boundary;

            m_pParts = new MIME_EntityCollection();
        }
コード例 #7
0
 /// <summary>
 /// Internal constructor. No Content-Type is created, user must do it manually.
 /// </summary>
 internal MIME_b_Multipart()
 {
     m_pBodyParts = new MIME_EntityCollection();
 }