public string ParseSubject(string header) { if (header == null) { throw new ArgumentNullException("header"); } StringBuilder builder = new StringBuilder(""); Match match = regSubject.Match(header); if (match.Success && (match.Groups.Count > 0)) { MatchCollection matchs = regSubjectItem.Matches(match.Groups[1].Value); if (matchs.Count == 0) { builder = new StringBuilder(match.Groups[1].Value); } else { foreach (Match match2 in matchs) { builder.Append(MailMessageRFCDecoder.ParseBase64Item(match2.Value)); } } } return(builder.ToString()); }
public string DecodeParameterValue(string source) { bool flag = false; bool flag2 = true; StringBuilder builder = new StringBuilder(); foreach (string str in source.Replace("\\\"", "").Split(new char[] { ' ' })) { bool flag3 = flag; string str2 = MailMessageRFCDecoder.ParseBase64Item(str); if (str2 != "") { flag = true; } else { flag = false; str2 = str; } if ((!flag || !flag3) && !flag2) { builder.Append(' '); } flag2 = false; builder.Append(str2); } return(builder.ToString()); }
public EmailAddress ParseEmail(string text) { string str; EmailAddress address; if (text == null) { throw new ArgumentNullException("text"); } string input = ""; Match match = regAddressDifDisplayName.Match(text); if (match.Success && (match.Groups.Count > 1)) { input = match.Groups[1].Value; str = match.Groups[2].Value; } else { match = regAddressDisplayName.Match(text); if (match.Success && (match.Groups.Count > 1)) { input = match.Groups[1].Value; str = match.Groups[2].Value; } else { match = regAddressEasy.Match(text); if (match.Success && (match.Groups.Count > 1)) { str = match.Groups[1].Value; } else { return(null); } } } if (regSubjectItem.IsMatch(input)) { input = MailMessageRFCDecoder.ParseBase64Item(input); } try { address = new EmailAddress(str, input.Trim()); } catch { return(null); } return(address); }
public IList <string> ParseKeywords(string text) { if (text == null) { throw new ArgumentNullException("text"); } List <string> list = new List <string>(); Match match = regKeywords.Match(text); if (match.Success && (match.Groups.Count > 1)) { foreach (Match match2 in regKeyword.Matches(match.Groups[1].Value)) { list.Add(regSubjectItem.IsMatch(match2.Groups[1].Value) ? MailMessageRFCDecoder.ParseBase64Item(match2.Groups[1].Value) : match2.Groups[1].Value); } } return(list); }
public string ParseComments(string text) { if (text == null) { throw new ArgumentNullException("text"); } Match match = regComments.Match(text); if (!match.Success || (match.Groups.Count <= 1)) { return(null); } if (!regSubjectItem.IsMatch(match.Groups[1].Value)) { return(match.Groups[1].Value); } return(MailMessageRFCDecoder.ParseBase64Item(match.Groups[1].Value)); }