Microsoft.Legal.MatterCenter.Utility.MailMimeReader.ProcessDelimitedBody C# (CSharp) Method

ProcessDelimitedBody() private method

Processes the delimited body of Mail Mime Entity.
private ProcessDelimitedBody ( MailMessageParser message, string boundaryStart, string parentBoundaryStart, string parentBoundaryEnd ) : MimeEntityReturnCode
message MailMessageParser Parsed Mail Message.
boundaryStart string boundary start identifier
parentBoundaryStart string parent boundary start identifier
parentBoundaryEnd string parent boundary end identifier
return MimeEntityReturnCode
        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;
        }