This class is responsible for parsing a string array of lines containing a MIME message.
コード例 #1
0
        /// <summary>
        /// Create MimeEntity from the given bytes
        /// </summary>
        /// <param name="bytes">The bytes to read</param>
        /// <returns>The parsed MimeEntity</returns>
        public static MimeEntity CreateFrom(byte[] bytes, bool throwOnInvalidContentType)
        {
            MimeReader reader = new MimeReader(bytes, throwOnInvalidContentType);
            MimeEntity entity = reader.CreateMimeEntity();

            return(entity);
        }
コード例 #2
0
 /// <summary>
 /// Sets the type of the content.
 /// </summary>
 /// <param name="contentType">Type of the content.</param>
 internal void SetContentType(ContentType contentType)
 {
     ContentType           = contentType;
     ContentType.MediaType = MimeReader.GetMediaType(contentType.MediaType);
     MediaMainType         = MimeReader.GetMediaMainType(contentType.MediaType);
     MediaSubType          = MimeReader.GetMediaSubType(contentType.MediaType);
 }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MimeEntity"/> class.
        /// </summary>
        public MimeEntity()
        {
            Children      = new List <MimeEntity>();
            Headers       = new NameValueCollection();
            ContentType   = MimeReader.GetContentType(string.Empty);
            Parent        = null;
            _contentBytes = new List <byte[]>();
            RawContent    = new MemoryStream();

            ContentTransferEncoding = System.Net.Mime.TransferEncoding.SevenBit; // RFC 2045 -- "Content-Transfer-Encoding: 7BIT" is assumed if the Content-Transfer-Encoding header field is not present.
        }
コード例 #4
0
        /// <summary>
        /// Adds the child entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        private void AddChildEntity(MimeEntity entity, Queue <byte[]> lines)
        {
            /*if (entity == null)
             * {
             *  return;
             * }
             *
             * if (lines == null)
             * {
             *  return;
             * }*/

            MimeReader reader      = new MimeReader(entity, lines, _throwOnInvalidContentType);
            MimeEntity childEntity = reader.CreateMimeEntity();

            entity.Children.Add(childEntity);

            byte[] innerBytes = childEntity.RawContent.ToArray();
            entity.RawContent.Write(innerBytes, 0, innerBytes.Length);
        }
コード例 #5
0
ファイル: MimeReader.cs プロジェクト: telefunkenvf14/sidepop
        /// <summary>
        /// Adds the child entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        private void AddChildEntity(MimeEntity entity, Queue<byte[]> lines)
        {
            /*if (entity == null)
            {
                return;
            }

            if (lines == null)
            {
                return;
            }*/

            MimeReader reader = new MimeReader(entity, lines, _throwOnInvalidContentType);
            MimeEntity childEntity = reader.CreateMimeEntity();
            entity.Children.Add(childEntity);

            byte[] innerBytes = childEntity.RawContent.ToArray();
            entity.RawContent.Write(innerBytes, 0, innerBytes.Length);
        }
コード例 #6
0
ファイル: MimeEntity.cs プロジェクト: Octopus-ITSM/sidepop
 /// <summary>
 /// Create MimeEntity from the given bytes
 /// </summary>
 /// <param name="bytes">The bytes to read</param>
 /// <returns>The parsed MimeEntity</returns>
 public static MimeEntity CreateFrom(byte[] bytes, bool throwOnInvalidContentType)
 {
     MimeReader reader = new MimeReader(bytes, throwOnInvalidContentType);
     MimeEntity entity = reader.CreateMimeEntity();
     return entity;
 }
コード例 #7
0
ファイル: MimeReader.cs プロジェクト: Termit1975/sidepop
        /// <summary>
        /// Adds the child entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        private void AddChildEntity(MimeEntity entity, Queue<string> lines)
        {
            /*if (entity == null)
            {
                return;
            }

            if (lines == null)
            {
                return;
            }*/

            MimeReader reader = new MimeReader(entity, lines);
            entity.Children.Add(reader.CreateMimeEntity());
        }