/// <summary> /// Constructs and initializes a new instance of <see /// cref="MetadataLibraryObject" /> 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 MetadataLibraryObject (Asf.File file, long position) : base (file, position) { if (!Guid.Equals (Asf.Guid.AsfMetadataLibraryObject)) throw new CorruptFileException ( "Object GUID incorrect."); if (OriginalSize < 26) throw new CorruptFileException ( "Object size too small."); ushort count = file.ReadWord (); for (ushort i = 0; i < count; i ++) { DescriptionRecord rec = new DescriptionRecord ( file); AddRecord (rec); } }
/// <summary> /// Adds a record to the current instance. /// </summary> /// <param name="record"> /// A <see cref="DescriptionRecord" /> object to add to the /// current instance. /// </param> public void AddRecord (DescriptionRecord record) { records.Add (record); }