• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MimeKit.ParserOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MimeKit.ParserOptions的典型用法代码示例。如果您正苦于以下问题:C# ParserOptions类的具体用法?C# ParserOptions怎么用?C# ParserOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParserOptions类属于MimeKit命名空间,在下文中一共展示了ParserOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: MimeEntityConstructorArgs

		internal MimeEntityConstructorArgs (ParserOptions options, ContentType ctype, IEnumerable<Header> headers, bool toplevel)
		{
			ParserOptions = options;
			IsTopLevel = toplevel;
			ContentType = ctype;
			Headers = headers;
		}
开发者ID:ruffin--,项目名称:MimeKit,代码行数:7,代码来源:MimeEntityConstructorArgs.cs


示例2: ParserOptions

 static ParserOptions()
 {
     Default = new ParserOptions ();
     Default.EnableRfc2047Workarounds = true;
     Default.RespectContentLength = false;
     Default.CharsetEncoding = Encoding.Default;
 }
开发者ID:princeoffoods,项目名称:MimeKit,代码行数:7,代码来源:ParserOptions.cs


示例3: MimeMessage

		internal MimeMessage (ParserOptions options, IEnumerable<Header> headers)
		{
			addresses = new Dictionary<string, InternetAddressList> (StringComparer.OrdinalIgnoreCase);
			Headers = new HeaderList (options);

			// initialize our address lists
			foreach (var name in StandardAddressHeaders) {
				var list = new InternetAddressList ();
				list.Changed += InternetAddressListChanged;
				addresses.Add (name, list);
			}

			references = new MessageIdList ();
			references.Changed += ReferencesChanged;
			inreplyto = null;

			Headers.Changed += HeadersChanged;

			// add all of our message headers...
			foreach (var header in headers) {
				if (header.Field.StartsWith ("Content-", StringComparison.OrdinalIgnoreCase))
					continue;

				Headers.Add (header);
			}
		}
开发者ID:yukine,项目名称:MimeKit,代码行数:26,代码来源:MimeMessage.cs


示例4: Header

		/// <summary>
		/// Initializes a new instance of the <see cref="MimeKit.Header"/> class.
		/// </summary>
		/// <remarks>
		/// Creates a new message or entity header for the specified field and
		/// value pair. The encoding is used to determine which charset to use
		/// when encoding the value according to the rules of rfc2047.
		/// </remarks>
		/// <param name="charset">The charset that should be used to encode the
		/// header value.</param>
		/// <param name="id">The header identifier.</param>
		/// <param name="value">The value of the header.</param>
		/// <exception cref="System.ArgumentNullException">
		/// <para><paramref name="charset"/> is <c>null</c>.</para>
		/// <para>-or-</para>
		/// <para><paramref name="value"/> is <c>null</c>.</para>
		/// </exception>
		/// <exception cref="System.ArgumentOutOfRangeException">
		/// <paramref name="id"/> is not a valid <see cref="HeaderId"/>.
		/// </exception>
		public Header (Encoding charset, HeaderId id, string value)
		{
			if (charset == null)
				throw new ArgumentNullException ("charset");

			if (id == HeaderId.Unknown)
				throw new ArgumentOutOfRangeException ("id");

			if (value == null)
				throw new ArgumentNullException ("value");

			Options = ParserOptions.Default.Clone ();
			Field = id.ToHeaderName ();
			Id = id;

			SetValue (charset, value);
		}
开发者ID:gphummer,项目名称:MimeKit,代码行数:37,代码来源:Header.cs


示例5: Header

		/// <summary>
		/// Initializes a new instance of the <see cref="MimeKit.Header"/> class.
		/// </summary>
		/// <remarks>
		/// Creates a new message or entity header for the specified field and
		/// value pair. The encoding is used to determine which charset to use
		/// when encoding the value according to the rules of rfc2047.
		/// </remarks>
		/// <param name="encoding">The character encoding that should be used to
		/// encode the header value.</param>
		/// <param name="id">The header identifier.</param>
		/// <param name="value">The value of the header.</param>
		/// <exception cref="System.ArgumentNullException">
		/// <para><paramref name="encoding"/> is <c>null</c>.</para>
		/// <para>-or-</para>
		/// <para><paramref name="value"/> is <c>null</c>.</para>
		/// </exception>
		/// <exception cref="System.ArgumentOutOfRangeException">
		/// <paramref name="id"/> is not a valid <see cref="HeaderId"/>.
		/// </exception>
		public Header (Encoding encoding, HeaderId id, string value)
		{
			if (encoding == null)
				throw new ArgumentNullException ("encoding");

			if (id == HeaderId.Unknown)
				throw new ArgumentOutOfRangeException ("id");

			if (value == null)
				throw new ArgumentNullException ("value");

			Options = ParserOptions.Default.Clone ();
			Field = id.ToHeaderName ();
			Id = id;

			rawField = Encoding.ASCII.GetBytes (Field);
			SetValue (encoding, value);
		}
开发者ID:ALange,项目名称:OutlookPrivacyPlugin,代码行数:38,代码来源:Header.cs


示例6: TryParse

        /// <summary>
        /// Tries to parse the given input buffer into a new <see cref="MimeKit.ContentType"/> instance.
        /// </summary>
        /// <returns><c>true</c>, if the content type was successfully parsed, <c>false</c> otherwise.</returns>
        /// <param name="options">The parser options.</param>
        /// <param name="buffer">The input buffer.</param>
        /// <param name="startIndex">The starting index of the input buffer.</param>
        /// <param name="type">The parsed content type.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <para><paramref name="options"/> is <c>null</c>.</para>
        /// <para>-or-</para>
        /// <para><paramref name="buffer"/> is <c>null</c>.</para>
        /// </exception>
        /// <exception cref="System.ArgumentOutOfRangeException">
        /// <paramref name="startIndex"/> is out of range.
        /// </exception>
        public static bool TryParse(ParserOptions options, byte[] buffer, int startIndex, out ContentType type)
        {
            if (options == null)
                throw new ArgumentNullException ("options");

            if (buffer == null)
                throw new ArgumentNullException ("buffer");

            if (startIndex < 0 || startIndex >= buffer.Length)
                throw new ArgumentOutOfRangeException ("startIndex");

            int index = startIndex;

            return TryParse (options, buffer, ref index, buffer.Length, false, out type);
        }
开发者ID:princeoffoods,项目名称:MimeKit,代码行数:31,代码来源:ContentType.cs


示例7: TryParseGroup

        static bool TryParseGroup(ParserOptions options, byte[] text, int startIndex, ref int index, int endIndex, string name, int codepage, bool throwOnError, out InternetAddress address)
        {
            Encoding encoding = Encoding.GetEncoding (codepage);
            List<InternetAddress> members;

            address = null;

            // skip over the ':'
            index++;
            if (index >= endIndex) {
                if (throwOnError)
                    throw new ParseException (string.Format ("Incomplete address group at offset {0}", startIndex), startIndex, index);

                return false;
            }

            if (InternetAddressList.TryParse (options, text, ref index, endIndex, true, throwOnError, out members))
                address = new GroupAddress (encoding, name, members);
            else
                address = new GroupAddress (encoding, name);

            if (index >= endIndex || text[index] != (byte) ';') {
                if (throwOnError)
                    throw new ParseException (string.Format ("Expected to find ';' at offset {0}", index), startIndex, index);

                while (index < endIndex && text[index] != (byte) ';')
                    index++;
            } else {
                index++;
            }

            return true;
        }
开发者ID:richard2753,项目名称:MimeKit,代码行数:33,代码来源:InternetAddress.cs


示例8: EncodeDkimSignatureHeader

		static byte[] EncodeDkimSignatureHeader (ParserOptions options, FormatOptions format, Encoding charset, string field, string value)
		{
			var encoded = new StringBuilder ();
			int lineLength = field.Length + 1;
			var token = new StringBuilder ();
			int index = 0;

			while (index < value.Length) {
				while (index < value.Length && IsWhiteSpace (value[index]))
					index++;

				int startIndex = index;
				string name;

				while (index < value.Length && value[index] != '=') {
					if (!IsWhiteSpace (value[index]))
						token.Append (value[index]);
					index++;
				}

				name = value.Substring (startIndex, index - startIndex);

				while (index < value.Length && value[index] != ';') {
					if (!IsWhiteSpace (value[index]))
						token.Append (value[index]);
					index++;
				}

				if (index < value.Length && value[index] == ';') {
					token.Append (';');
					index++;
				}

				if (lineLength + token.Length + 1 > format.MaxLineLength || name == "bh" || name == "b") {
					encoded.Append (format.NewLine);
					encoded.Append ('\t');
					lineLength = 1;
				} else {
					encoded.Append (' ');
					lineLength++;
				}

				if (token.Length > format.MaxLineLength) {
					switch (name) {
					case "z":
						EncodeDkimHeaderList (format, encoded, ref lineLength, token.ToString (), '|');
						break;
					case "h":
						EncodeDkimHeaderList (format, encoded, ref lineLength, token.ToString (), ':');
						break;
					default:
						EncodeDkimLongValue (format, encoded, ref lineLength, token.ToString ());
						break;
					}
				} else {
					encoded.Append (token.ToString ());
					lineLength += token.Length;
				}

				token.Length = 0;
			}

			encoded.Append (format.NewLine);

			return charset.GetBytes (encoded.ToString ());
		}
开发者ID:naeemkhedarun,项目名称:MimeKit,代码行数:66,代码来源:Header.cs


示例9: TryParse

        /// <summary>
        /// Tries to parse the given input buffer into a new <see cref="MimeKit.InternetAddress"/> instance.
        /// </summary>
        /// <remarks>
        /// Parses a single <see cref="MailboxAddress"/> or <see cref="GroupAddress"/>. If the buffer contains
        /// more data, then parsing will fail.
        /// </remarks>
        /// <returns><c>true</c>, if the address was successfully parsed, <c>false</c> otherwise.</returns>
        /// <param name="options">The parser options to use.</param>
        /// <param name="buffer">The input buffer.</param>
        /// <param name="address">The parsed address.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <para><paramref name="options"/> is <c>null</c>.</para>
        /// <para>-or-</para>
        /// <para><paramref name="buffer"/> is <c>null</c>.</para>
        /// </exception>
        public static bool TryParse(ParserOptions options, byte[] buffer, out InternetAddress address)
        {
            if (options == null)
                throw new ArgumentNullException ("options");

            if (buffer == null)
                throw new ArgumentNullException ("buffer");

            int endIndex = buffer.Length;
            int index = 0;

            if (!TryParse (options, buffer, ref index, endIndex, false, out address))
                return false;

            if (!ParseUtils.SkipCommentsAndWhiteSpace (buffer, ref index, endIndex, false)) {
                address = null;
                return false;
            }

            if (index != endIndex) {
                address = null;
                return false;
            }

            return true;
        }
开发者ID:richard2753,项目名称:MimeKit,代码行数:42,代码来源:InternetAddress.cs


示例10: Load

		/// <summary>
		/// Load a <see cref="MimeMessage"/> from the specified stream.
		/// </summary>
		/// <remarks>
		/// <para>Loads a <see cref="MimeMessage"/> from the given stream, using the
		/// specified <see cref="ParserOptions"/>.</para>
		/// <para>If <paramref name="persistent"/> is <c>true</c> and <paramref name="stream"/> is seekable, then
		/// the <see cref="MimeParser"/> will not copy the content of <see cref="MimePart"/>s into memory. Instead,
		/// it will use a <see cref="MimeKit.IO.BoundStream"/> to reference a substream of <paramref name="stream"/>.
		/// This has the potential to not only save mmeory usage, but also improve <see cref="MimeParser"/>
		/// performance.</para>
		/// </remarks>
		/// <returns>The parsed message.</returns>
		/// <param name="options">The parser options.</param>
		/// <param name="stream">The stream.</param>
		/// <param name="persistent"><c>true</c> if the stream is persistent; otherwise <c>false</c>.</param>
		/// <param name="cancellationToken">A cancellation token.</param>
		/// <exception cref="System.ArgumentNullException">
		/// <para><paramref name="options"/> is <c>null</c>.</para>
		/// <para>-or-</para>
		/// <para><paramref name="stream"/> is <c>null</c>.</para>
		/// </exception>
		/// <exception cref="System.OperationCanceledException">
		/// The operation was canceled via the cancellation token.
		/// </exception>
		/// <exception cref="System.FormatException">
		/// There was an error parsing the entity.
		/// </exception>
		/// <exception cref="System.IO.IOException">
		/// An I/O error occurred.
		/// </exception>
		public static MimeMessage Load (ParserOptions options, Stream stream, bool persistent, CancellationToken cancellationToken = default (CancellationToken))
		{
			if (options == null)
				throw new ArgumentNullException ("options");

			if (stream == null)
				throw new ArgumentNullException ("stream");

			var parser = new MimeParser (options, stream, MimeFormat.Entity, persistent);

			return parser.ParseMessage (cancellationToken);
		}
开发者ID:yukine,项目名称:MimeKit,代码行数:43,代码来源:MimeMessage.cs


示例11: Parse

        /// <summary>
        /// Parses the given text into a new <see cref="MimeKit.InternetAddress"/> instance.
        /// </summary>
        /// <remarks>
        /// Parses a single <see cref="MailboxAddress"/> or <see cref="GroupAddress"/>. If the text contains
        /// more data, then parsing will fail.
        /// </remarks>
        /// <returns>The parsed <see cref="MimeKit.InternetAddress"/>.</returns>
        /// <param name="options">The parser options to use.</param>
        /// <param name="text">The text.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <para><paramref name="options"/> is <c>null</c>.</para>
        /// <para>-or-</para>
        /// <para><paramref name="text"/> is <c>null</c>.</para>
        /// </exception>
        /// <exception cref="MimeKit.ParseException">
        /// <paramref name="text"/> could not be parsed.
        /// </exception>
        public static InternetAddress Parse(ParserOptions options, string text)
        {
            if (options == null)
                throw new ArgumentNullException ("options");

            if (text == null)
                throw new ArgumentNullException ("text");

            var buffer = Encoding.UTF8.GetBytes (text);
            int endIndex = buffer.Length;
            InternetAddress address;
            int index = 0;

            TryParse (options, buffer, ref index, endIndex, true, out address);

            ParseUtils.SkipCommentsAndWhiteSpace (buffer, ref index, endIndex, true);

            if (index != endIndex)
                throw new ParseException (string.Format ("Unexpected token at offset {0}", index), index, index);

            return address;
        }
开发者ID:richard2753,项目名称:MimeKit,代码行数:40,代码来源:InternetAddress.cs


示例12: EncodeUnstructuredHeader

		static byte[] EncodeUnstructuredHeader (ParserOptions options, FormatOptions format, Encoding charset, string field, string value)
		{
			if (format.International) {
				var folded = Fold (format, field, value);

				return Encoding.UTF8.GetBytes (folded);
			}

			var encoded = Rfc2047.EncodeText (format, charset, value);

			return Rfc2047.FoldUnstructuredHeader (format, field, encoded);
		}
开发者ID:naeemkhedarun,项目名称:MimeKit,代码行数:12,代码来源:Header.cs


示例13: EncodeContentType

		static byte[] EncodeContentType (ParserOptions options, FormatOptions format, Encoding charset, string field, string value)
		{
			var contentType = ContentType.Parse (options, value);
			var encoded = contentType.Encode (format, charset);

			return Encoding.UTF8.GetBytes (encoded);
		}
开发者ID:naeemkhedarun,项目名称:MimeKit,代码行数:7,代码来源:Header.cs


示例14: EncodeContentDisposition

		static byte[] EncodeContentDisposition (ParserOptions options, FormatOptions format, Encoding charset, string field, string value)
		{
			var disposition = ContentDisposition.Parse (options, value);
			var encoded = disposition.Encode (format, charset);

			return Encoding.UTF8.GetBytes (encoded);
		}
开发者ID:naeemkhedarun,项目名称:MimeKit,代码行数:7,代码来源:Header.cs


示例15: EncodeReferencesHeader

		static byte[] EncodeReferencesHeader (ParserOptions options, FormatOptions format, Encoding charset, string field, string value)
		{
			var encoded = new StringBuilder ();
			int lineLength = field.Length + 1;
			int count = 0;

			foreach (var reference in MimeUtils.EnumerateReferences (value)) {
				if (count > 0 && lineLength + reference.Length + 3 > format.MaxLineLength) {
					encoded.Append (format.NewLine);
					encoded.Append ('\t');
					lineLength = 1;
					count = 0;
				} else {
					encoded.Append (' ');
					lineLength++;
				}

				encoded.Append ('<').Append (reference).Append ('>');
				lineLength += reference.Length + 2;
				count++;
			}

			encoded.Append (format.NewLine);

			return charset.GetBytes (encoded.ToString ());
		}
开发者ID:naeemkhedarun,项目名称:MimeKit,代码行数:26,代码来源:Header.cs


示例16: EncodeMessageIdHeader

		static byte[] EncodeMessageIdHeader (ParserOptions options, FormatOptions format, Encoding charset, string field, string value)
		{
			return charset.GetBytes (" " + value + format.NewLine);
		}
开发者ID:naeemkhedarun,项目名称:MimeKit,代码行数:4,代码来源:Header.cs


示例17: Parse

        /// <summary>
        /// Parse the specified input buffer into a new instance of the <see cref="MimeKit.ContentType"/> class.
        /// </summary>
        /// <returns>The parsed <see cref="MimeKit.ContentType"/>.</returns>
        /// <param name="options">The parser options.</param>
        /// <param name="buffer">The input buffer.</param>
        /// <param name="startIndex">The start index of the buffer.</param>
        /// <param name="length">The length of the buffer.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <para><paramref name="options"/> is <c>null</c>.</para>
        /// <para>-or-</para>
        /// <para><paramref name="buffer"/> is <c>null</c>.</para>
        /// </exception>
        /// <exception cref="System.ArgumentOutOfRangeException">
        /// <paramref name="startIndex"/> and <paramref name="length"/> do not specify
        /// a valid range in the byte array.
        /// </exception>
        /// <exception cref="MimeKit.ParseException">
        /// The <paramref name="buffer"/> could not be parsed.
        /// </exception>
        public static ContentType Parse(ParserOptions options, byte[] buffer, int startIndex, int length)
        {
            if (options == null)
                throw new ArgumentNullException ("options");

            if (buffer == null)
                throw new ArgumentNullException ("buffer");

            if (startIndex < 0 || startIndex > buffer.Length)
                throw new ArgumentOutOfRangeException ("startIndex");

            if (length < 0 || startIndex + length > buffer.Length)
                throw new ArgumentOutOfRangeException ("length");

            int index = startIndex;
            ContentType type;

            TryParse (options, buffer, ref index, startIndex + length, true, out type);

            return type;
        }
开发者ID:princeoffoods,项目名称:MimeKit,代码行数:41,代码来源:ContentType.cs


示例18: TryParseMailbox

        internal static bool TryParseMailbox(ParserOptions options, byte[] text, int startIndex, ref int index, int endIndex, string name, int codepage, bool throwOnError, out InternetAddress address)
        {
            Encoding encoding = Encoding.GetEncoding (codepage);
            DomainList route = null;

            address = null;

            // skip over the '<'
            index++;
            if (index >= endIndex) {
                if (throwOnError)
                    throw new ParseException (string.Format ("Incomplete mailbox at offset {0}", startIndex), startIndex, index);

                return false;
            }

            if (text[index] == (byte) '@') {
                if (!DomainList.TryParse (text, ref index, endIndex, throwOnError, out route)) {
                    if (throwOnError)
                        throw new ParseException (string.Format ("Invalid route in mailbox at offset {0}", startIndex), startIndex, index);

                    return false;
                }

                if (index + 1 >= endIndex || text[index] != (byte) ':') {
                    if (throwOnError)
                        throw new ParseException (string.Format ("Incomplete route in mailbox at offset {0}", startIndex), startIndex, index);

                    return false;
                }

                index++;
            }

            string addrspec;
            if (!TryParseAddrspec (text, ref index, endIndex, (byte) '>', throwOnError, out addrspec))
                return false;

            if (!ParseUtils.SkipCommentsAndWhiteSpace (text, ref index, endIndex, throwOnError))
                return false;

            if (index >= endIndex || text[index] != (byte) '>') {
                if (options.AddressParserComplianceMode == RfcComplianceMode.Strict) {
                    if (throwOnError)
                        throw new ParseException (string.Format ("Unexpected end of mailbox at offset {0}", startIndex), startIndex, index);

                    return false;
                }
            } else {
                index++;
            }

            if (route != null)
                address = new MailboxAddress (encoding, name, route, addrspec);
            else
                address = new MailboxAddress (encoding, name, addrspec);

            return true;
        }
开发者ID:richard2753,项目名称:MimeKit,代码行数:59,代码来源:InternetAddress.cs


示例19: Join

        /// <summary>
        /// Join the specified message/partial parts into the complete message.
        /// </summary>
        /// <param name="options">The parser options to use.</param>
        /// <param name="partials">The list of partial message parts.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <para><paramref name="options"/> is <c>null</c>.</para>
        /// <para>-or-</para>
        /// <para><paramref name="partials"/>is <c>null</c>.</para>
        /// </exception>
        public static MimeMessage Join(ParserOptions options, IEnumerable<MessagePartial> partials)
        {
            if (options == null)
                throw new ArgumentNullException ("options");

            if (partials == null)
                throw new ArgumentNullException ("partials");

            var parts = partials.ToList ();

            if (parts.Count == 0)
                return null;

            parts.Sort (PartialCompare);

            if (!parts[parts.Count - 1].Total.HasValue)
                throw new ArgumentException ("partials");

            int total = parts[parts.Count - 1].Total.Value;
            if (parts.Count != total)
                throw new ArgumentException ("partials");

            string id = parts[0].Id;

            using (var chained = new ChainedStream ()) {
                // chain all of the partial content streams...
                for (int i = 0; i < parts.Count; i++) {
                    int number = parts[i].Number.Value;

                    if (number != i + 1)
                        throw new ArgumentException ("partials");

                    var content = parts[i].ContentObject;
                    content.Stream.Seek (0, SeekOrigin.Begin);
                    var filtered = new FilteredStream (content.Stream);
                    filtered.Add (DecoderFilter.Create (content.Encoding));
                    chained.Add (filtered);
                }

                var parser = new MimeParser (options, chained);

                return parser.ParseMessage ();
            }
        }
开发者ID:vdaron,项目名称:MimeKit,代码行数:54,代码来源:MessagePartial.cs


示例20: EncodeReceivedHeader

		static byte[] EncodeReceivedHeader (ParserOptions options, FormatOptions format, Encoding charset, string field, string value)
		{
			var tokens = new List<ReceivedTokenValue> ();
			var rawValue = charset.GetBytes (value);
			var encoded = new StringBuilder ();
			int lineLength = field.Length + 1;
			bool date = false;
			int index = 0;
			int count = 0;

			while (index < rawValue.Length) {
				ReceivedTokenValue token = null;
				int startIndex = index;

				if (!ParseUtils.SkipCommentsAndWhiteSpace (rawValue, ref index, rawValue.Length, false) || index >= rawValue.Length) {
					tokens.Add (new ReceivedTokenValue (startIndex, index - startIndex));
					break;
				}

				while (index < rawValue.Length && !rawValue[index].IsWhitespace ())
					index++;

				var atom = charset.GetString (rawValue, startIndex, index - startIndex);

				for (int i = 0; i < ReceivedTokens.Length; i++) {
					if (atom == ReceivedTokens[i].Atom) {
						ReceivedTokens[i].Skip (rawValue, ref index);

						if (ParseUtils.SkipCommentsAndWhiteSpace (rawValue, ref index, rawValue.Length, false)) {
							if (index < rawValue.Length && rawValue[index] == (byte) ';') {
								date = true;
								index++;
							}
						}

						token = new ReceivedTokenValue (startIndex, index - startIndex);
						break;
					}
				}

				if (token == null) {
					if (ParseUtils.SkipCommentsAndWhiteSpace (rawValue, ref index, rawValue.Length, false)) {
						while (index < rawValue.Length && !rawValue[index].IsWhitespace ())
							index++;
					}

					token = new ReceivedTokenValue (startIndex, index - startIndex);
				}

				tokens.Add (token);

				ParseUtils.SkipWhiteSpace (rawValue, ref index, rawValue.Length);

				if (date && index < rawValue.Length) {
					// slurp up the date (the final token)
					tokens.Add (new ReceivedTokenValue (index, rawValue.Length - index));
					break;
				}
			}

			foreach (var token in tokens) {
				var text = charset.GetString (rawValue, token.StartIndex, token.Length).TrimEnd ();

				if (count > 0 && lineLength + text.Length + 1 > format.MaxLineLength) {
					encoded.Append (format.NewLine);
					encoded.Append ('\t');
					lineLength = 1;
					count = 0;
				} else {
					encoded.Append (' ');
					lineLength++;
				}

				lineLength += text.Length;
				encoded.Append (text);
				count++;
			}

			encoded.Append (format.NewLine);

			return charset.GetBytes (encoded.ToString ());
		}
开发者ID:naeemkhedarun,项目名称:MimeKit,代码行数:82,代码来源:Header.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IO.FilteredStream类代码示例发布时间:2022-05-26
下一篇:
C# MimeKit.MimeMessage类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap