Example #1
0
        public static void ParseContentType(ContentType contentType, String line)
        {
            Match m = null;


            foreach (Regex rx in MailParser.RegexList.ContentTypeName)
            {
                m = rx.Match(line);
                if (String.IsNullOrEmpty(m.Groups["Value"].Value) == false)
                {
                    contentType.Name = m.Groups["Value"].Value;
                    break;
                }
            }
            if (String.IsNullOrEmpty(contentType.Name) == true)
            {
                contentType.Name = MailParser.ParseHeaderParameterValue("name", line);
            }


            foreach (Regex rx in MailParser.RegexList.ContentTypeBoundary)
            {
                m = rx.Match(line);
                if (String.IsNullOrEmpty(m.Groups["Value"].Value) == false)
                {
                    contentType.Boundary = m.Groups["Value"].Value;
                    break;
                }
            }
            if (String.IsNullOrEmpty(contentType.Boundary) == true)
            {
                contentType.Boundary = MailParser.ParseHeaderParameterValue("boundary", line);
            }
        }
Example #2
0
        public static void ParseContentDisposition(ContentDisposition contentDisposition, String line)
        {
            Match m = null;


            foreach (Regex rx in MailParser.RegexList.ContentDispositionFileName)
            {
                m = rx.Match(line);
                if (String.IsNullOrEmpty(m.Groups["Value"].Value) == false)
                {
                    contentDisposition.FileName = m.Groups["Value"].Value;
                    return;
                }
            }
            contentDisposition.FileName = MailParser.ParseHeaderParameterValue("filename", line);
        }