예제 #1
0
        /// <summary>
        /// Clone the <see cref="QuotedPrintableEncoder"/> with its current state.
        /// </summary>
        /// <remarks>
        /// Creates a new <see cref="QuotedPrintableEncoder"/> with exactly the same state as the current encoder.
        /// </remarks>
        /// <returns>A new <see cref="QuotedPrintableEncoder"/> with identical state.</returns>
        public IMimeEncoder Clone()
        {
            var encoder = new QuotedPrintableEncoder();

            encoder.currentLineLength = currentLineLength;
            encoder.saved             = saved;

            return(encoder);
        }
예제 #2
0
		/// <summary>
		/// Clone the <see cref="QuotedPrintableEncoder"/> with its current state.
		/// </summary>
		/// <remarks>
		/// Creates a new <see cref="QuotedPrintableEncoder"/> with exactly the same state as the current encoder.
		/// </remarks>
		/// <returns>A new <see cref="QuotedPrintableEncoder"/> with identical state.</returns>
		public IMimeEncoder Clone ()
		{
			var encoder = new QuotedPrintableEncoder ();

			encoder.currentLineLength = currentLineLength;
			encoder.saved = saved;

			return encoder;
		}
예제 #3
0
		public void TestQuotedPrintableEncode ()
		{
			const string expected = "This is an ordinary text message in which my name (=ED=E5=EC=F9 =EF=E1=\n =E9=EC=E8=F4=F0)\nis in Hebrew (=FA=E9=F8=E1=F2).\n";
			const string input = "This is an ordinary text message in which my name (םולש ןב ילטפנ)\nis in Hebrew (תירבע).\n";
			var encoding = Encoding.GetEncoding ("iso-8859-8");
			var encoder = new QuotedPrintableEncoder ();
			var output = new byte[4096];

			Assert.AreEqual (ContentEncoding.QuotedPrintable, encoder.Encoding);

			var buf = encoding.GetBytes (input);
			int n = encoder.Flush (buf, 0, buf.Length, output);
			var actual = Encoding.ASCII.GetString (output, 0, n);

			Assert.AreEqual (expected, actual);
		}