CreateChildEntity() public méthode

Creates an empty child MIME entity from the parent MIME entity. An email can consist of several MIME entities. A entity has the same structure of email.
public CreateChildEntity ( ) : MailMessageParser
Résultat MailMessageParser
Exemple #1
0
        /// <summary>
        /// Processes the delimited body of Mail Mime Entity.
        /// </summary>
        /// <param name="message">Parsed Mail Message.</param>
        /// <param name="boundaryStart">boundary start identifier</param>
        /// <param name="parentBoundaryStart">parent boundary start identifier</param>
        /// <param name="parentBoundaryEnd">parent boundary end identifier</param>
        /// <returns>MimeEntity process result code</returns>
        private MimeEntityReturnCode ProcessDelimitedBody(MailMessageParser message, string boundaryStart, string parentBoundaryStart, string parentBoundaryEnd)
        {
            string response;

            if (boundaryStart.Trim() == parentBoundaryStart.Trim())
            {
                while (this.ReadMultipleLine(out response))
                {
                    continue;
                }

                return(MimeEntityReturnCode.problem);
            }

            MimeEntityReturnCode returnCode;

            do
            {
                this.mimeEntitySB.Length = 0;
                MailMessageParser childPart = message.CreateChildEntity();

                ////recursively call MIME part processing
                returnCode = this.ProcessMimeEntity(childPart, boundaryStart);

                if (returnCode == MimeEntityReturnCode.problem)
                {
                    return(MimeEntityReturnCode.problem);
                }

                ////add the newly found child MIME part to the parent
                AddChildPartsToParent(childPart, message);
            }while (returnCode != MimeEntityReturnCode.parentBoundaryEndFound);

            MimeEntityReturnCode boundaryMimeReturnCode;
            bool hasParentBoundary = parentBoundaryStart.Length > 0;

            while (this.ReadMultipleLine(out response))
            {
                if (hasParentBoundary && ParentBoundaryFound(response, parentBoundaryStart, parentBoundaryEnd, out boundaryMimeReturnCode))
                {
                    return(boundaryMimeReturnCode);
                }
            }

            return(MimeEntityReturnCode.bodyComplete);
        }
Exemple #2
0
        /// <summary>
        /// Processes the delimited body of Mail Mime Entity.
        /// </summary>
        /// <param name="message">Parsed Mail Message.</param>
        /// <param name="boundaryStart">boundary start identifier</param>
        /// <param name="parentBoundaryStart">parent boundary start identifier</param>
        /// <param name="parentBoundaryEnd">parent boundary end identifier</param>
        /// <returns>MimeEntity process result code</returns>
        private MimeEntityReturnCode ProcessDelimitedBody(MailMessageParser message, string boundaryStart, string parentBoundaryStart, string parentBoundaryEnd)
        {
            string response;

            if (boundaryStart.Trim() == parentBoundaryStart.Trim())
            {
                while (this.ReadMultipleLine(out response))
                {
                    continue;
                }

                return MimeEntityReturnCode.problem;
            }

            MimeEntityReturnCode returnCode;
            do
            {
                this.mimeEntitySB.Length = 0;
                MailMessageParser childPart = message.CreateChildEntity();

                ////recursively call MIME part processing
                returnCode = this.ProcessMimeEntity(childPart, boundaryStart);

                if (returnCode == MimeEntityReturnCode.problem)
                {
                    return MimeEntityReturnCode.problem;
                }

                ////add the newly found child MIME part to the parent
                AddChildPartsToParent(childPart, message);
            }
            while (returnCode != MimeEntityReturnCode.parentBoundaryEndFound);

            MimeEntityReturnCode boundaryMimeReturnCode;
            bool hasParentBoundary = parentBoundaryStart.Length > 0;
            while (this.ReadMultipleLine(out response))
            {
                if (hasParentBoundary && ParentBoundaryFound(response, parentBoundaryStart, parentBoundaryEnd, out boundaryMimeReturnCode))
                {
                    return boundaryMimeReturnCode;
                }
            }

            return MimeEntityReturnCode.bodyComplete;
        }