internal static void SetParameterValue(MimePart part, HeaderId headerId, string parameterName, string value) { ComplexHeader complexHeader = part.Headers.FindFirst(headerId) as ComplexHeader; if (complexHeader == null) { complexHeader = (Header.Create(headerId) as ComplexHeader); complexHeader.AppendChild(new MimeParameter(parameterName, value)); part.Headers.AppendChild(complexHeader); return; } MimeParameter mimeParameter = complexHeader[parameterName]; if (mimeParameter != null) { mimeParameter.Value = value; return; } complexHeader.AppendChild(new MimeParameter(parameterName, value)); }
internal void WriteHeaderParameter(string parameterName, string parameterValue) { if (this.hasAllHeaders) { return; } ComplexHeader complexHeader = (ComplexHeader)this.currentHeader; MimeParameter mimeParameter = complexHeader[parameterName]; if (mimeParameter == null) { mimeParameter = new MimeParameter(parameterName); complexHeader.AppendChild(mimeParameter); } mimeParameter.Value = parameterValue; }
internal static void StoreFileNameInHeader(MimePart attachmentPart, HeaderId headerId, GetDefaultValue getDefaultValue, string parameterName, string value) { ComplexHeader complexHeader = attachmentPart.Headers.FindFirst(headerId) as ComplexHeader; if (complexHeader == null) { complexHeader = (Header.Create(headerId) as ComplexHeader); complexHeader.Value = getDefaultValue(); attachmentPart.Headers.AppendChild(complexHeader); } MimeParameter mimeParameter = complexHeader[parameterName]; if (mimeParameter == null) { mimeParameter = new MimeParameter(parameterName); complexHeader.AppendChild(mimeParameter); } mimeParameter.Value = value; }