Пример #1
0
        /// <summary>
        /// Store MIME enity to the specified stream.
        /// </summary>
        /// <param name="stream">Stream where to store MIME entity. Storing starts form stream current position.</param>
        /// <param name="headerWordEncoder">Header 8-bit words ecnoder. Value null means that words are not encoded.</param>
        /// <param name="headerParmetersCharset">Charset to use to encode 8-bit header parameters. Value null means parameters not encoded.</param>
        /// <param name="headerReencode">If true always specified encoding is used for header. If false and header field value not modified,
        /// original encoding is kept.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>stream</b> is null.</exception>
        public void ToStream(Stream stream, MIME_Encoding_EncodedWord headerWordEncoder, Encoding headerParmetersCharset, bool headerReencode)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            m_pHeader.ToStream(stream, headerWordEncoder, headerParmetersCharset, headerReencode);
            stream.Write(new byte[] { (int)'\r', (int)'\n' }, 0, 2);
            m_pBody.ToStream(stream, headerWordEncoder, headerParmetersCharset, headerReencode);
        }
        /// <summary>
        /// Stores MIME entity body to the specified stream.
        /// </summary>
        /// <param name="stream">Stream where to store body data.</param>
        /// <param name="headerWordEncoder">Header 8-bit words ecnoder. Value null means that words are not encoded.</param>
        /// <param name="headerParmetersCharset">Charset to use to encode 8-bit header parameters. Value null means parameters not encoded.</param>
        /// <param name="headerReencode">If true always specified encoding is used for header. If false and header field value not modified,
        /// original encoding is kept.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>stream</b> is null reference.</exception>
        internal protected override void ToStream(Stream stream, MIME_Encoding_EncodedWord headerWordEncoder, Encoding headerParmetersCharset, bool headerReencode)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            m_pMessageFields.ToStream(stream, headerWordEncoder, headerParmetersCharset, headerReencode);
            stream.Write(new byte[] { (byte)'\r', (byte)'\n' }, 0, 2);
            foreach (MIME_h_Collection recipientBlock in m_pRecipientBlocks)
            {
                recipientBlock.ToStream(stream, headerWordEncoder, headerParmetersCharset, headerReencode);
                stream.Write(new byte[] { (byte)'\r', (byte)'\n' }, 0, 2);
            }
        }