コード例 #1
0
ファイル: Email.cs プロジェクト: disordinary/MIMEParser
 public MIME walk(MIME mimePart, MimeWalker headerMatch)
 {
     for (int i = 0; i < mimePart.body.Count; i++)
     {
         for (int h = 0; h < mimePart.header.Count; h++)
         {
             if (headerMatch(mimePart.header[h].key, mimePart.header[h].value))
             {
                 return(mimePart);
             }
         }
         return(walk(mimePart.body[i], headerMatch));
     }
     return(null);
 }
コード例 #2
0
ファイル: Attachment.cs プロジェクト: disordinary/MIMEParser
        public Attachment(MIME attachment = null)
        {
            if (attachment == null)
            {
                return;
            }

            foreach (HeaderField header in attachment.header)
            {
                if (header.key == "Content-Type")
                {
                    String _name = lookup_header_val(header.value, "name");
                    if (!String.IsNullOrWhiteSpace(_name))
                    {
                        name = _name;
                        if (String.IsNullOrWhiteSpace(filename))
                        {
                            filename = name;
                        }
                    }
                }

                if (header.key == "Content-Transfer-Encoding")
                {
                    encoding = header.value;
                }

                if (header.key == "Content-Disposition")
                {
                    String _filename = lookup_header_val(header.value, "filename");
                    if (!String.IsNullOrWhiteSpace(_filename))
                    {
                        filename = _filename;
                        if (String.IsNullOrWhiteSpace(name))
                        {
                            name = _filename;
                        }
                    }
                }

                content = attachment;
            }

            /* {Content-Type : application/pdf; name="attachment_inv_7180452.pdf"}
             * [1]: {Content-Transfer-Encoding : base64}
             * [2]: {Content-Disposition : attachment; filename="attachment_inv_7180452.pdf"}
             */
        }
コード例 #3
0
ファイル: Email.cs プロジェクト: disordinary/MIMEParser
 public List <MIME> walkMatch(MIME mimePart, MimeWalker headerMatch, ref List <MIME> matchArray)
 {
     if (matchArray == null)
     {
         matchArray = new List <MIME>();
     }
     for (int i = 0; i < mimePart.body.Count; i++)
     {
         for (int h = 0; h < mimePart.header.Count; h++)
         {
             if (headerMatch(mimePart.header[h].key, mimePart.header[h].value))
             {
                 matchArray.Add(mimePart);
             }
         }
         walkMatch(mimePart.body[i], headerMatch, ref matchArray);
     }
     return(matchArray);
 }