コード例 #1
0
ファイル: File.cs プロジェクト: JohnThomson/taglib-sharp
		/// <summary>
		///    Constructs and initializes a new instance of <see
		///    cref="File" /> for a specified file abstraction and
		///    specified read style.
		/// </summary>
		/// <param name="abstraction">
		///    A <see cref="IFileAbstraction" /> object to use when
		///    reading from and writing to the file.
		/// </param>
		/// <param name="propertiesStyle">
		///    A <see cref="ReadStyle" /> value specifying at what level
		///    of accuracy to read the media properties, or <see
		///    cref="ReadStyle.None" /> to ignore the properties.
		/// </param>
		/// <exception cref="ArgumentNullException">
		///    <paramref name="abstraction" /> is <see langword="null"
		///    />.
		/// </exception>
		/// <exception cref="CorruptFileException">
		///    The file is not the write length.
		/// </exception>
		public File (File.IFileAbstraction abstraction,
		             ReadStyle propertiesStyle) : base (abstraction)
		{			
			
			Mode = AccessMode.Read;
			
			try {
				// get the pointer to the end of the tag block
				// and calculate the tag block length
				Seek (OffsetToEndTagPointer);
				int tagLen = ( (int) ReadBlock(4).ToUInt(true) ) - TagBlockOffset;
				
				// read the whole tag and send to Tag class
				Seek (TagBlockOffset);
				ByteVector bv = ReadBlock(tagLen);
				
				tag = new  TagLib.Audible.Tag( bv );
				
			} finally {
				Mode = AccessMode.Closed;
			}
			
			// ??
			TagTypesOnDisk = TagTypes;
			
		}
コード例 #2
0
ファイル: File.cs プロジェクト: JohnThomson/taglib-sharp
		/// <summary>
		///    Constructs and initializes a new instance of <see
		///    cref="File" /> for a specified file abstraction with an
		///    average read style.
		/// </summary>
		/// <param name="abstraction">
		///    A <see cref="IFileAbstraction" /> object to use when
		///    reading from and writing to the file.
		/// </param>
		/// <exception cref="ArgumentNullException">
		///    <paramref name="abstraction" /> is <see langword="null"
		///    />.
		/// </exception>
		public File (File.IFileAbstraction abstraction)
			: this (abstraction, ReadStyle.Average)
		{
		}
コード例 #3
0
ファイル: Tag.cs プロジェクト: hoeness2/mcebuddy2
		/// <summary>
		///    Constructs and initializes a new instance of <see
		///    cref="Tag" /> by reading the contents from a specified
		///    position in a specified file.
		/// </summary>
		/// <param name="file">
		///    A <see cref="File" /> object containing the file from
		///    which the contents of the new instance is to be read.
		/// </param>
		/// <param name="position">
		///    A <see cref="long" /> value specify at what position to
		///    read the tag.
		/// </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 file does not contain <see cref="FileIdentifier" />
		///    at the given position.
		/// </exception>
		public Tag (File file, long position)
		{
			// TODO: can we read from file
		}