A TNEF property tag.
A TNEF property tag.
        internal TnefPropertyReader(TnefReader tnef)
        {
            propertyTag = TnefPropertyTag.Null;
            propertyName = new TnefNameId ();
            rawValueOffset = 0;
            rawValueLength = 0;
            propertyIndex = 0;
            propertyCount = 0;
            valueIndex = 0;
            valueCount = 0;
            rowIndex = 0;
            rowCount = 0;

            reader = tnef;
        }
		/// <summary>
		/// Advances to the next MAPI property.
		/// </summary>
		/// <remarks>
		/// Advances to the next MAPI property.
		/// </remarks>
		/// <returns><c>true</c> if there is another property available to be read; otherwise <c>false</c>.</returns>
		/// <exception cref="TnefException">
		/// The TNEF data is corrupt or invalid.
		/// </exception>
		public bool ReadNextProperty ()
		{
			if (propertyIndex >= propertyCount)
				return false;

			while (ReadNextValue ()) {
				// skip over the value...
			}

			try {
				var type = (TnefPropertyType) ReadInt16 ();
				var id = (TnefPropertyId) ReadInt16 ();

				propertyTag = new TnefPropertyTag (id, type);

				if (propertyTag.IsNamed)
					LoadPropertyName ();

				LoadValueCount ();
				propertyIndex++;

				if (!TryGetPropertyValueLength (out rawValueLength))
					return false;

				rawValueOffset = reader.StreamOffset;
			} catch (EndOfStreamException) {
				return false;
			}

			return CheckRawValueLength ();
		}
		internal void Load ()
		{
			propertyTag = TnefPropertyTag.Null;
			rawValueOffset = 0;
			rawValueLength = 0;
			propertyCount = 0;
			propertyIndex = 0;
			valueCount = 0;
			valueIndex = 0;
			decoder = null;
			rowCount = 0;
			rowIndex = 0;

			switch (reader.AttributeTag) {
			case TnefAttributeTag.MapiProperties:
			case TnefAttributeTag.Attachment:
				LoadPropertyCount ();
				break;
			case TnefAttributeTag.RecipientTable:
				LoadRowCount ();
				break;
			default:
				rawValueLength = reader.AttributeRawValueLength;
				rawValueOffset = reader.StreamOffset;
				valueCount = 1;
				break;
			}
		}