예제 #1
0
 private void GetEntities(IMAP_BODY_Entity[] entities, List <IMAP_BODY_Entity> allEntries)
 {
     if (entities != null)
     {
         for (int i = 0; i < entities.Length; i++)
         {
             IMAP_BODY_Entity iMAP_BODY_Entity = entities[i];
             allEntries.Add(iMAP_BODY_Entity);
             if (iMAP_BODY_Entity.ChildEntities.Length > 0)
             {
                 this.GetEntities(iMAP_BODY_Entity.ChildEntities, allEntries);
             }
         }
     }
 }
        internal void Parse(string text)
        {
            StringReader stringReader = new StringReader(text);

            stringReader.ReadToFirstChar();
            if (stringReader.StartsWith("("))
            {
                while (stringReader.StartsWith("("))
                {
                    IMAP_BODY_Entity iMAP_BODY_Entity = new IMAP_BODY_Entity();
                    iMAP_BODY_Entity.Parse(stringReader.ReadParenthesized());
                    iMAP_BODY_Entity.m_pParentEntity = this;
                    this.m_pChildEntities.Add(iMAP_BODY_Entity);
                    stringReader.ReadToFirstChar();
                }
                string str = stringReader.ReadWord();
                this.m_pContentType = new MIME_h_ContentType("multipart/" + str);
                return;
            }
            string text2 = stringReader.ReadWord();
            string text3 = stringReader.ReadWord();

            if (text2.ToUpper() != "NIL" && text3.ToUpper() != "NIL")
            {
                this.m_pContentType = new MIME_h_ContentType(text2 + "/" + text3);
            }
            stringReader.ReadToFirstChar();
            if (stringReader.StartsWith("("))
            {
                string       source        = stringReader.ReadParenthesized();
                StringReader stringReader2 = new StringReader(source);
                while (stringReader2.Available > 0L)
                {
                    string name  = stringReader2.ReadWord();
                    string value = MIME_Encoding_EncodedWord.DecodeS(stringReader2.ReadWord());
                    this.m_pContentType.Parameters[name] = value;
                }
            }
            else
            {
                stringReader.ReadWord();
            }
            string text4 = stringReader.ReadWord();

            if (text4.ToUpper() != "NIL")
            {
                this.m_ContentID = text4;
            }
            string text5 = stringReader.ReadWord();

            if (text5.ToUpper() != "NIL")
            {
                this.m_ContentDescription = text5;
            }
            string text6 = stringReader.ReadWord();

            if (text6.ToUpper() != "NIL")
            {
                this.m_ContentEncoding = text6;
            }
            string text7 = stringReader.ReadWord();

            if (text7.ToUpper() != "NIL")
            {
                this.m_ContentSize = Convert.ToInt32(text7);
            }
            if (string.Equals(this.ContentType.TypeWithSubype, MIME_MediaTypes.Message.rfc822, StringComparison.InvariantCultureIgnoreCase))
            {
                stringReader.ReadToFirstChar();
                if (stringReader.StartsWith("("))
                {
                    stringReader.ReadParenthesized();
                }
                else
                {
                    stringReader.ReadWord();
                }
            }
            if (text2.ToLower() == "text")
            {
                string text8 = stringReader.ReadWord();
                if (text8.ToUpper() != "NIL")
                {
                    this.m_ContentLines = Convert.ToInt32(text8);
                }
            }
        }
예제 #3
0
 public IMAP_BODY()
 {
     this.m_pMainEntity = new IMAP_BODY_Entity();
 }
예제 #4
0
 public void Parse(string bodyStructureString)
 {
     this.m_pMainEntity = new IMAP_BODY_Entity();
     this.m_pMainEntity.Parse(bodyStructureString);
 }