public MimeHeader(string name, string @value, MimeFormat format, MimeEncodingMethod encoding, Encoding charset) { if (name == null) throw new ArgumentNullException("name"); else if (name.Length == 0) throw new ArgumentException("length of name is zero", "name"); // TODO: check name // field-name = 1*<any CHAR, excluding CTLs, SPACE, and ":"> this.name = name; this.Index = 0; this.Format = format; this.Value = @value; this.Encoding = encoding; this.Charset = charset; }
public void SetValue(MimeFormat format, IEnumerable<MimeHeaderFragment> headerFragments) { if (headerFragments == null) throw new ArgumentNullException("headerFragments"); Format = format; Encoding = MimeEncodingMethod.None; Charset = null; Value = EncodeFragments(headerFragments); }
public MimeHeader(string name, string @value, MimeFormat format, MimeEncodingMethod encoding) : this(name, @value, format, encoding, null) { }
public static MimeHeader CreateContentType(MimeFormat format, MimeType mimeType, Encoding charset, string boundary, string name) { const string headerName = "Content-Type"; if (mimeType == null) throw new ArgumentNullException("mimeType"); var fragments = new List<MimeHeaderFragment>(); fragments.Add(new MimeHeaderFragment(mimeType.ToString())); if (charset != null) fragments.Add(new MimeHeaderParameterFragment("charset", Charsets.ToString(charset))); if (boundary != null) fragments.Add(new MimeHeaderParameterFragment("boundary", boundary)); if (name != null) // TODO: name*n* fragments.Add(new MimeHeaderParameterFragment("name", MimeEncoding.Encode(name, MimeEncodingMethod.Base64, Charsets.UTF8))); return new MimeHeader(headerName, format, fragments); }
public static MimeHeader CreateContentType(MimeFormat format, MimeType mimeType, Encoding charset, string boundary) { return CreateContentType(format, mimeType, charset, boundary, null); }
public static MimeHeader CreateContentType(MimeFormat format, MimeType mimeType, Encoding charset) { return CreateContentType(format, mimeType, charset, null, null); }
public static MimeHeader CreateContentTransferEncoding(MimeFormat format, ContentTransferEncodingMethod transferEncoding) { return new MimeHeader(ContentTransferEncoding.HeaderName, format, new[] {new MimeHeaderFragment(ContentTransferEncoding.GetEncodingName(transferEncoding))}); }
public MimeHeader(string name, MimeFormat format, IEnumerable<MimeHeaderFragment> headerFragments) : this(name, string.Empty, format, MimeEncodingMethod.None, null) { SetValue(format, headerFragments); }