Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
        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"}
             */
        }
Exemplo n.º 3
0
 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);
 }