/// Content-Typeの解析を行います。 /// <summary> /// Parse content-type. /// Content-Typeの解析を行います。 /// </summary> /// <param name="contentType"></param> /// <param name="line"></param> public static void ParseContentType(ContentType contentType, String line) { Match m = null; //name=???; 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); } //boundary 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); } }
/// Content-Dispositionの解析を行います。 /// <summary> /// Parse content-disposision. /// Content-Dispositionの解析を行います。 /// </summary> /// <param name="contentDisposition"></param> /// <param name="line"></param> public static void ParseContentDisposition(ContentDisposition contentDisposition, String line) { Match m = null; //filename=???; 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); }