当前位置: 首页>>代码示例>>C#>>正文


C# Header.GetRawValue方法代码示例

本文整理汇总了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);
		}
开发者ID:yukine,项目名称:MimeKit,代码行数:8,代码来源:MimeMessage.cs

示例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);
		}
开发者ID:MadRabbitKiller,项目名称:MimeKit,代码行数:18,代码来源:MimeMessage.cs

示例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);
		}
开发者ID:yukine,项目名称:MimeKit,代码行数:56,代码来源:MimeMessage.cs

示例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);
		}
开发者ID:vnexter,项目名称:MimeKit,代码行数:48,代码来源:MimeMessage.cs


注:本文中的MimeKit.Header.GetRawValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。