#pragma warning disable CS8610 // Nullability of reference types in type of parameter doesn't match overridden member. public override string[]? GetValues(string name) #pragma warning restore CS8610 { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (name == string.Empty) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name)); } MailHeaderID id = MailHeaderInfo.GetID(name); if (id == MailHeaderID.ContentType && _part != null) { _part.ContentType.PersistIfNeeded(this, false); } else if (id == MailHeaderID.ContentDisposition && _part is MimePart) { ((MimePart)_part).ContentDisposition !.PersistIfNeeded(this, false); } return(base.GetValues(name)); }
public override void Remove(string name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (name == string.Empty) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name)); } MailHeaderID id = MailHeaderInfo.GetID(name); if (id == MailHeaderID.ContentType && _part != null) { _part.ContentType = null; } else if (id == MailHeaderID.ContentDisposition && _part is MimePart) { ((MimePart)_part).ContentDisposition = null; } base.Remove(name); }
public override void Remove(string name) { if (Logging.On) { Logging.PrintInfo(Logging.Web, this, "Remove", name); } if (name == null) { throw new ArgumentNullException("name"); } if (name == string.Empty) { throw new ArgumentException(SR.GetString(SR.net_emptystringcall, "name"), "name"); } MailHeaderID id = MailHeaderInfo.GetID(name); if (id == MailHeaderID.ContentType && part != null) { part.ContentType = null; } else if (id == MailHeaderID.ContentDisposition && part is MimePart) { ((MimePart)part).ContentDisposition = null; } base.Remove(name); }
#pragma warning disable CS8765 // Nullability of parameter 'name' doesn't match overridden member public override void Remove(string name) #pragma warning restore CS8765 { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (name.Length == 0) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name)); } MailHeaderID id = MailHeaderInfo.GetID(name); if (id == MailHeaderID.ContentType && _part != null) { _part.ContentType = null !; // this throws ArgumentNullException } else if (id == MailHeaderID.ContentDisposition && _part is MimePart) { ((MimePart)_part).ContentDisposition = null; } base.Remove(name); }
public override string[] GetValues(string name) { if (Logging.On) { Logging.PrintInfo(Logging.Web, this, "Get", name); } if (name == null) { throw new ArgumentNullException("name"); } if (name == string.Empty) { throw new ArgumentException(SR.GetString(SR.net_emptystringcall, "name"), "name"); } MailHeaderID id = MailHeaderInfo.GetID(name); if (id == MailHeaderID.ContentType && part != null) { part.ContentType.PersistIfNeeded(this, false); } else if (id == MailHeaderID.ContentDisposition && part is MimePart) { ((MimePart)part).ContentDisposition.PersistIfNeeded(this, false); } return(base.GetValues(name)); }
public override string Get(string name) { if (Logging.On) { Logging.PrintInfo(Logging.Web, this, "Get", name); } if (name == null) { throw new ArgumentNullException("name"); } if (name == string.Empty) { throw new ArgumentException(SR.GetString("net_emptystringcall", new object[] { "name" }), "name"); } MailHeaderID iD = MailHeaderInfo.GetID(name); if ((iD == MailHeaderID.ContentType) && (this.part != null)) { this.part.ContentType.PersistIfNeeded(this, false); } else if ((iD == MailHeaderID.ContentDisposition) && (this.part is MimePart)) { ((MimePart)this.part).ContentDisposition.PersistIfNeeded(this, false); } return(base.Get(name)); }
public override void Remove(string name) { if (Logging.On) { Logging.PrintInfo(Logging.Web, this, "Remove", name); } if (name == null) { throw new ArgumentNullException("name"); } if (name == string.Empty) { throw new ArgumentException(SR.GetString("net_emptystringcall", new object[] { "name" }), "name"); } MailHeaderID iD = MailHeaderInfo.GetID(name); if ((iD == MailHeaderID.ContentType) && (this.part != null)) { this.part.ContentType = null; } else if ((iD == MailHeaderID.ContentDisposition) && (this.part is MimePart)) { ((MimePart)this.part).ContentDisposition = null; } base.Remove(name); }
public override void Set(string name, string value) { if (Logging.On) { Logging.PrintInfo(Logging.Web, this, "Set", name.ToString() + "=" + value.ToString()); } if (name == null) { throw new ArgumentNullException(nameof(name)); } if (value == null) { throw new ArgumentNullException(nameof(value)); } if (name == string.Empty) { throw new ArgumentException(SR.GetString(SR.net_emptystringcall, nameof(name)), nameof(name)); } if (value == string.Empty) { throw new ArgumentException(SR.GetString(SR.net_emptystringcall, nameof(value)), nameof(value)); } if (!MimeBasePart.IsAscii(name, false)) { throw new FormatException(SR.GetString(SR.InvalidHeaderName)); } // normalize the case of well known headers name = MailHeaderInfo.NormalizeCase(name); MailHeaderID id = MailHeaderInfo.GetID(name); value = value.Normalize(Text.NormalizationForm.FormC); if (id == MailHeaderID.ContentType && part != null) { part.ContentType.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else if (id == MailHeaderID.ContentDisposition && part is MimePart) { ((MimePart)part).ContentDisposition.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else { base.Set(name, value); } }
#pragma warning disable CS8610 // Nullability of reference types in type of parameter doesn't match overridden member. public override void Set(string name, string value) #pragma warning restore CS8610 { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (value == null) { throw new ArgumentNullException(nameof(value)); } if (name == string.Empty) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name)); } if (value == string.Empty) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(value)), nameof(value)); } if (!MimeBasePart.IsAscii(name, false)) { throw new FormatException(SR.InvalidHeaderName); } // normalize the case of well known headers name = MailHeaderInfo.NormalizeCase(name); MailHeaderID id = MailHeaderInfo.GetID(name); value = value.Normalize(NormalizationForm.FormC); if (id == MailHeaderID.ContentType && _part != null) { _part.ContentType.Set(value.ToLowerInvariant(), this); } else if (id == MailHeaderID.ContentDisposition && _part is MimePart) { ((MimePart)_part).ContentDisposition !.Set(value.ToLowerInvariant(), this); } else { base.Set(name, value); } }
public override void Set(string name, string value) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (value == null) { throw new ArgumentNullException(nameof(value)); } if (name == string.Empty) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name)); } if (value == string.Empty) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(value)), nameof(name)); } if (!MimeBasePart.IsAscii(name, false)) { throw new FormatException(SR.Format(SR.InvalidHeaderName)); } // normalize the case of well known headers name = MailHeaderInfo.NormalizeCase(name); MailHeaderID id = MailHeaderInfo.GetID(name); // TODO https://github.com/dotnet/corefx/issues/11747: Uncomment once we can use NormalizationForm //value = value.Normalize(NormalizationForm.FormC); if (id == MailHeaderID.ContentType && _part != null) { _part.ContentType.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else if (id == MailHeaderID.ContentDisposition && _part is MimePart) { ((MimePart)_part).ContentDisposition.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else { base.Set(name, value); } }
public override void Add(string name, string value) { if (Logging.On) { Logging.PrintInfo(Logging.Web, this, "Add", name.ToString() + "=" + value.ToString()); } if (name == null) { throw new ArgumentNullException("name"); } if (value == null) { throw new ArgumentNullException("value"); } if (name == string.Empty) { throw new ArgumentException(SR.GetString(SR.net_emptystringcall, "name"), "name"); } if (value == string.Empty) { throw new ArgumentException(SR.GetString(SR.net_emptystringcall, "value"), "name"); } MailBnfHelper.ValidateHeaderName(name); // normalize the case of well known headers name = MailHeaderInfo.NormalizeCase(name); MailHeaderID id = MailHeaderInfo.GetID(name); value = value.Normalize(Text.NormalizationForm.FormC); if (id == MailHeaderID.ContentType && part != null) { part.ContentType.Set(value.ToLower(), this); } else if (id == MailHeaderID.ContentDisposition && part is MimePart) { ((MimePart)part).ContentDisposition.Set(value.ToLower(), this); } else { InternalAdd(name, value); } }
#pragma warning disable CS8765 // Nullability of parameters 'name' and 'value' don't match overridden member public override void Add(string name, string value) #pragma warning restore CS8765 { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (value == null) { throw new ArgumentNullException(nameof(value)); } if (name.Length == 0) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name)); } if (value.Length == 0) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(value)), nameof(value)); } MailBnfHelper.ValidateHeaderName(name); // normalize the case of well known headers name = MailHeaderInfo.NormalizeCase(name); MailHeaderID id = MailHeaderInfo.GetID(name); value = value.Normalize(NormalizationForm.FormC); if (id == MailHeaderID.ContentType && _part != null) { _part.ContentType.Set(value.ToLowerInvariant(), this); } else if (id == MailHeaderID.ContentDisposition && _part is MimePart) { ((MimePart)_part).ContentDisposition !.Set(value.ToLowerInvariant(), this); } else { InternalAdd(name, value); } }
public override void Set(string name, string value) { if (Logging.On) { Logging.PrintInfo(Logging.Web, this, "Set", name.ToString() + "=" + value.ToString()); } if (name == null) { throw new ArgumentNullException("name"); } if (value == null) { throw new ArgumentNullException("value"); } if (name == string.Empty) { throw new ArgumentException(SR.GetString("net_emptystringcall", new object[] { "name" }), "name"); } if (value == string.Empty) { throw new ArgumentException(SR.GetString("net_emptystringcall", new object[] { "value" }), "name"); } if (!MimeBasePart.IsAscii(name, false)) { throw new FormatException(SR.GetString("InvalidHeaderName")); } name = MailHeaderInfo.NormalizeCase(name); MailHeaderID iD = MailHeaderInfo.GetID(name); if ((iD == MailHeaderID.ContentType) && (this.part != null)) { this.part.ContentType.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else if ((iD == MailHeaderID.ContentDisposition) && (this.part is MimePart)) { ((MimePart)this.part).ContentDisposition.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else { base.Set(name, value); } }
public override void Add(string name, string value) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (value == null) { throw new ArgumentNullException(nameof(value)); } if (name == string.Empty) { throw new ArgumentException(string.Format(Strings.net_emptystringcall, nameof(name)), nameof(name)); } if (value == string.Empty) { throw new ArgumentException(string.Format(Strings.net_emptystringcall, nameof(value)), nameof(name)); } MailBnfHelper.ValidateHeaderName(name); // normalize the case of well known headers name = MailHeaderInfo.NormalizeCase(name); MailHeaderID id = MailHeaderInfo.GetID(name); value = value.Normalize(NormalizationForm.FormC); if (id == MailHeaderID.ContentType && _part != null) { _part.ContentType.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else if (id == MailHeaderID.ContentDisposition && _part is MimePart) { ((MimePart)_part).ContentDisposition.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else { InternalAdd(name, value); } }
public override string Get(string name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (name == string.Empty) { throw new ArgumentException(string.Format(Strings.net_emptystringcall, nameof(name)), nameof(name)); } MailHeaderID id = MailHeaderInfo.GetID(name); if (id == MailHeaderID.ContentType && _part != null) { _part.ContentType.PersistIfNeeded(this, false); } else if (id == MailHeaderID.ContentDisposition && _part is MimePart) { ((MimePart)_part).ContentDisposition.PersistIfNeeded(this, false); } return(base.Get(name)); }