コード例 #1
0
        /// <summary>
        /// Advances to the next attribute in the TNEF stream.
        /// </summary>
        /// <remarks>
        /// Advances to the next attribute in the TNEF stream.
        /// </remarks>
        /// <returns><c>true</c> if there is another attribute available to be read; otherwise <c>false</c>.</returns>
        /// <exception cref="TnefException">
        /// The TNEF stream is corrupted or invalid.
        /// </exception>
        public bool ReadNextAttribute()
        {
            CheckDisposed();

            if (AttributeRawValueStreamOffset != 0 && !SkipAttributeRawValue())
            {
                return(false);
            }

            try {
                AttributeLevel = (TnefAttributeLevel)ReadByte();
            } catch (EndOfStreamException) {
                return(false);
            }

            CheckAttributeLevel();

            try {
                AttributeTag                  = (TnefAttributeTag)ReadInt32();
                AttributeRawValueLength       = ReadInt32();
                AttributeRawValueStreamOffset = StreamOffset;
                checksum = 0;
            } catch (EndOfStreamException) {
                SetComplianceError(TnefComplianceStatus.StreamTruncated);
                return(false);
            }

            CheckAttributeTag();

            if (AttributeRawValueLength < 0)
            {
                SetComplianceError(TnefComplianceStatus.InvalidAttributeLength);
                return(false);
            }

            try {
                TnefPropertyReader.Load();
            } catch (EndOfStreamException) {
                SetComplianceError(TnefComplianceStatus.StreamTruncated);
                return(false);
            }

            return(true);
        }