/// 行の文字列を解析し、フィールドのインスタンスを生成します。 /// <summary> /// 行の文字列を解析し、フィールドのインスタンスを生成します。 /// </summary> /// <param name="line"></param> /// <param name="lines"></param> /// <returns></returns> private void ParseHeaderField(String line, List <String> lines) { Match m = RegexList.HeaderParse.Match(line); Match m1 = null; Regex rx = RegexList.HeaderParse1; Field f = null; List <String> l = lines; Int32 size = 0; for (int i = 0; i < lines.Count; i++) { size += line.Length; } StringBuilder sb = new StringBuilder(size); if (String.IsNullOrEmpty(m.Groups["key"].Value) == false) { m1 = rx.Match(m.Groups["value"].Value); if (m.Groups["key"].Value.ToLower() == "content-type" || m.Groups["key"].Value.ToLower() == "content-disposition") { sb.Append(line); for (int i = 0; i < l.Count; i++) { sb.Append(l[i].TrimStart('\t')); } this.ParseContentEncoding(sb.ToString()); if (m.Groups["key"].Value.ToLower() == "content-type") { MailParser.ParseContentType(this.ContentType, sb.ToString()); this.ContentType.Value = m1.Groups["value"].Value; } else if (m.Groups["key"].Value.ToLower() == "content-disposition") { MailParser.ParseContentDisposition(this.ContentDisposition, sb.ToString()); this.ContentDisposition.Value = m1.Groups["value"].Value; } } else { f = Field.FindField(this._Header, m.Groups["key"].Value); if (f == null) { f = new Field(m.Groups["key"].Value, m.Groups["value"].Value); this.Header.Add(f); } else { f.Value = m.Groups["value"].Value; } for (int i = 0; i < l.Count; i++) { f.Value += l[i].TrimStart('\t'); } } } }