/// <summary>
		///    Populates the current instance by reading in the contents
		///    from a file.
		/// </summary>
		/// <param name="file">
		///    A <see cref="Asf.File" /> object to read the raw ASF
		///    Description Record from.
		/// </param>
		/// <returns>
		///    <see langword="true" /> if the data was read correctly.
		///    Otherwise <see langword="false" />.
		/// </returns>
		protected bool Parse (Asf.File file)
		{
			// Field name          Field type Size (bits)
			// Language List Index WORD       16
			// Stream Number       WORD       16
			// Name Length         WORD       16
			// Data Type           WORD       16
			// Data Length         DWORD      32
			// Name                WCHAR      varies
			// Data                See below  varies
			
			lang_list_index = file.ReadWord ();
			stream_number = file.ReadWord ();
			ushort name_length = file.ReadWord ();
			type = (DataType) file.ReadWord ();
			int data_length = (int) file.ReadDWord ();
			name = file.ReadUnicode (name_length);
			
			switch (type)
			{
			case DataType.Word:
				longValue = file.ReadWord ();
				break;
			case DataType.Bool:
			case DataType.DWord:
				longValue = file.ReadDWord ();
				break;
			case DataType.QWord:
				longValue = file.ReadQWord ();
				break;
			case DataType.Unicode:
				strValue = file.ReadUnicode (data_length);
				break;
			case DataType.Bytes:
				byteValue = file.ReadBlock (data_length);
				break;
			case DataType.Guid:
				guidValue = file.ReadGuid ();
				break;
			default:
				return false;
			}
			
			return true;
		}
        /// <summary>
        ///    Constructs and initializes a new instance of <see
        ///    cref="HeaderObject" /> by reading the contents from a
        ///    specified position in a specified file.
        /// </summary>
        /// <param name="file">
        ///    A <see cref="Asf.File" /> object containing the file from
        ///    which the contents of the new instance are to be read.
        /// </param>
        /// <param name="position">
        ///    A <see cref="long" /> value specify at what position to
        ///    read the object.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///    <paramref name="file" /> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        ///    <paramref name="position" /> is less than zero or greater
        ///    than the size of the file.
        /// </exception>
        /// <exception cref="CorruptFileException">
        ///    The object read from disk does not have the correct GUID
        ///    or smaller than the minimum size.
        /// </exception>
        public HeaderObject(Asf.File file, long position)
            : base(file, position)
        {
            if (!Guid.Equals (Asf.Guid.AsfHeaderObject))
                throw new CorruptFileException (
                    "Object GUID incorrect.");

            if (OriginalSize < 26)
                throw new CorruptFileException (
                    "Object size too small.");

            children = new List<Object> ();

            uint child_count = file.ReadDWord ();

            reserved = file.ReadBlock (2);

            children.AddRange (file.ReadObjects (child_count,
                file.Tell));
        }
		/// <summary>
		///    Populates the current instance by reading in the contents
		///    from a file.
		/// </summary>
		/// <param name="file">
		///    A <see cref="Asf.File" /> object to read the raw ASF
		///    Content Descriptor from.
		/// </param>
		/// <returns>
		///    <see langword="true" /> if the data was read correctly.
		///    Otherwise <see langword="false" />.
		/// </returns>
		protected bool Parse (Asf.File file)
		{
			int name_count = file.ReadWord ();
			name = file.ReadUnicode (name_count);
			
			type = (DataType) file.ReadWord ();
			
			int value_count = file.ReadWord ();
			switch (type)
			{
			case DataType.Word:
				longValue = file.ReadWord ();
				break;
				
			case DataType.Bool:
				longValue = file.ReadDWord ();
				break;
				
			case DataType.DWord:
				longValue = file.ReadDWord ();
				break;
				
			case DataType.QWord:
				longValue = file.ReadQWord ();
				break;
				
			case DataType.Unicode:
				strValue = file.ReadUnicode (value_count);
				break;
				
			case DataType.Bytes:
				byteValue = file.ReadBlock (value_count);
				break;
				
			default:
				return false;
			}
			
			return true;
		}
		/// <summary>
		///    Constructs and initializes a new instance of <see
		///    cref="UnknownObject" /> by reading the contents from a
		///    specified position in a specified file.
		/// </summary>
		/// <param name="file">
		///    A <see cref="Asf.File" /> object containing the file from
		///    which the contents of the new instance are to be read.
		/// </param>
		/// <param name="position">
		///    A <see cref="long" /> value specify at what position to
		///    read the object.
		/// </param>
		/// <exception cref="ArgumentNullException">
		///    <paramref name="file" /> is <see langref="null" />.
		/// </exception>
		/// <exception cref="ArgumentOutOfRangeException">
		///    <paramref name="position" /> is less than zero or greater
		///    than the size of the file.
		/// </exception>
		public UnknownObject (Asf.File file, long position)
			: base (file, position)
		{
			data = file.ReadBlock ((int) (OriginalSize - 24));
		}
		/// <summary>
		///    Constructs and initializes a new instance of <see
		///    cref="PaddingObject" /> by reading the contents from a
		///    specified position in a specified file.
		/// </summary>
		/// <param name="file">
		///    A <see cref="Asf.File" /> object containing the file from
		///    which the contents of the new instance are to be read.
		/// </param>
		/// <param name="position">
		///    A <see cref="long" /> value specify at what position to
		///    read the object.
		/// </param>
		/// <exception cref="ArgumentNullException">
		///    <paramref name="file" /> is <see langref="null" />.
		/// </exception>
		/// <exception cref="ArgumentOutOfRangeException">
		///    <paramref name="position" /> is less than zero or greater
		///    than the size of the file.
		/// </exception>
		/// <exception cref="CorruptFileException">
		///    The object read from disk does not have the correct GUID
		///    or smaller than the minimum size.
		/// </exception>
		public StreamPropertiesObject (Asf.File file, long position)
			: base (file, position)
		{
			if (!Guid.Equals (Asf.Guid.AsfStreamPropertiesObject))
				throw new CorruptFileException (
					"Object GUID incorrect.");
			
			if (OriginalSize < 78)
				throw new CorruptFileException (
					"Object size too small.");
			
			stream_type = file.ReadGuid ();
			error_correction_type = file.ReadGuid ();
			time_offset = file.ReadQWord ();
			
			int type_specific_data_length = (int) file.ReadDWord ();
			int error_correction_data_length = (int)
				file.ReadDWord ();
			
			flags = file.ReadWord ();
			reserved = file.ReadDWord ();
			type_specific_data =
				file.ReadBlock (type_specific_data_length);
			error_correction_data =
				file.ReadBlock (error_correction_data_length);
		}