本文整理汇总了C#中MimeKit.Header.GetRawValue方法的典型用法代码示例。如果您正苦于以下问题:C# Header.GetRawValue方法的具体用法?C# Header.GetRawValue怎么用?C# Header.GetRawValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MimeKit.Header
的用法示例。
在下文中一共展示了Header.GetRawValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DkimWriteHeaderSimple
static void DkimWriteHeaderSimple (FormatOptions options, Stream stream, Header header)
{
var rawValue = header.GetRawValue (options);
stream.Write (header.RawField, 0, header.RawField.Length);
stream.Write (new [] { (byte) ':' }, 0, 1);
stream.Write (rawValue, 0, rawValue.Length);
}
示例2: DkimWriteHeaderSimple
static void DkimWriteHeaderSimple (FormatOptions options, Stream stream, Header header, bool isDkimSignature)
{
var rawValue = header.GetRawValue (options);
int rawLength = rawValue.Length;
if (isDkimSignature && rawLength > 0) {
if (rawValue[rawLength - 1] == (byte) '\n') {
rawLength--;
if (rawLength > 0 && rawValue[rawLength - 1] == (byte) '\r')
rawLength--;
}
}
stream.Write (header.RawField, 0, header.RawField.Length);
stream.Write (new [] { (byte) ':' }, 0, 1);
stream.Write (rawValue, 0, rawLength);
}
示例3: DkimWriteHeaderRelaxed
static void DkimWriteHeaderRelaxed (FormatOptions options, Stream stream, Header header)
{
var name = Encoding.ASCII.GetBytes (header.Field.ToLowerInvariant ());
var rawValue = header.GetRawValue (options);
int index = 0;
stream.Write (name, 0, name.Length);
stream.WriteByte ((byte) ':');
// look for the first non-whitespace character
while (index < rawValue.Length && rawValue[index].IsBlank ())
index++;
while (index < rawValue.Length) {
int startIndex = index;
int endIndex, nextLine;
// look for the first non-whitespace character
while (index < rawValue.Length && rawValue[index].IsBlank ())
index++;
// look for the end of the line
endIndex = index;
while (endIndex < rawValue.Length && rawValue[endIndex] != (byte) '\n')
endIndex++;
nextLine = endIndex + 1;
if (endIndex > index && rawValue[endIndex - 1] == (byte) '\r')
endIndex--;
if (index > startIndex)
stream.WriteByte ((byte) ' ');
while (index < endIndex) {
startIndex = index;
while (index < endIndex && !rawValue[index].IsBlank ())
index++;
stream.Write (rawValue, startIndex, index - startIndex);
startIndex = index;
while (index < endIndex && rawValue[index].IsBlank ())
index++;
if (index > startIndex)
stream.WriteByte ((byte) ' ');
}
index = nextLine;
}
stream.Write (options.NewLineBytes, 0, options.NewLineBytes.Length);
}
示例4: DkimWriteHeaderRelaxed
static void DkimWriteHeaderRelaxed (FormatOptions options, Stream stream, Header header, bool isDkimSignature)
{
// o Convert all header field names (not the header field values) to
// lowercase. For example, convert "SUBJect: AbC" to "subject: AbC".
var name = Encoding.ASCII.GetBytes (header.Field.ToLowerInvariant ());
var rawValue = header.GetRawValue (options);
int index = 0;
// o Delete any WSP characters remaining before and after the colon
// separating the header field name from the header field value. The
// colon separator MUST be retained.
stream.Write (name, 0, name.Length);
stream.WriteByte ((byte) ':');
// trim leading whitespace...
while (index < rawValue.Length && rawValue[index].IsWhitespace ())
index++;
while (index < rawValue.Length) {
int startIndex = index;
// look for the first non-whitespace character
while (index < rawValue.Length && rawValue[index].IsWhitespace ())
index++;
// o Delete all WSP characters at the end of each unfolded header field
// value.
if (index >= rawValue.Length)
break;
// o Convert all sequences of one or more WSP characters to a single SP
// character. WSP characters here include those before and after a
// line folding boundary.
if (index > startIndex)
stream.WriteByte ((byte) ' ');
startIndex = index;
while (index < rawValue.Length && !rawValue[index].IsWhitespace ())
index++;
if (index > startIndex)
stream.Write (rawValue, startIndex, index - startIndex);
}
if (!isDkimSignature)
stream.Write (options.NewLineBytes, 0, options.NewLineBytes.Length);
}