当前位置: 首页>>代码示例>>C#>>正文


C# TagLib.ReadBlock方法代码示例

本文整理汇总了C#中TagLib.ReadBlock方法的典型用法代码示例。如果您正苦于以下问题:C# TagLib.ReadBlock方法的具体用法?C# TagLib.ReadBlock怎么用?C# TagLib.ReadBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TagLib的用法示例。


在下文中一共展示了TagLib.ReadBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsoAudioSampleEntry

 public IsoAudioSampleEntry(BoxHeader header, TagLib.File file, IsoHandlerBox handler) : base(header, file, handler)
 {
     if (file == null)
     {
         throw new ArgumentNullException("file");
     }
     file.Seek(base.DataPosition + 8L);
     this.channel_count = file.ReadBlock(2).ToUShort();
     this.sample_size = file.ReadBlock(2).ToUShort();
     file.Seek(base.DataPosition + 0x10L);
     this.sample_rate = file.ReadBlock(4).ToUInt();
     this.children = base.LoadChildren(file);
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:13,代码来源:IsoAudioSampleEntry.cs

示例2: IsoVisualSampleEntry

        /// <summary>
        ///    Constructs and initializes a new instance of <see
        ///    cref="IsoVisualSampleEntry" /> with a provided header and
        ///    handler by reading the contents from a specified file.
        /// </summary>
        /// <param name="header">
        ///    A <see cref="BoxHeader" /> object containing the header
        ///    to use for the new instance.
        /// </param>
        /// <param name="file">
        ///    A <see cref="TagLib.File" /> object to read the contents
        ///    of the box from.
        /// </param>
        /// <param name="handler">
        ///    A <see cref="IsoHandlerBox" /> object containing the
        ///    handler that applies to the new instance.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///    <paramref name="file" /> is <see langword="null" />.
        /// </exception>
        public IsoVisualSampleEntry(BoxHeader header, TagLib.File file,
            IsoHandlerBox handler)
            : base(header, file, handler)
        {
            file.Seek (base.DataPosition + 16);
            width = file.ReadBlock (2).ToUShort ();
            height = file.ReadBlock (2).ToUShort ();

            /*
            TODO: What are the children anyway?
            children = LoadChildren (file);
            */
        }
开发者ID:sanyaade-embedded-systems,项目名称:MPTagThat,代码行数:33,代码来源:IsoVisualSampleEntry.cs

示例3: AppleAdditionalInfoBox

 /// <summary>
 ///    Constructs and initializes a new instance of <see
 ///    cref="AppleAdditionalInfoBox" /> with a provided header
 ///    and handler by reading the contents from a specified
 ///    file.
 /// </summary>
 /// <param name="header">
 ///    A <see cref="BoxHeader" /> object containing the header
 ///    to use for the new instance.
 /// </param>
 /// <param name="file">
 ///    A <see cref="TagLib.File" /> object to read the contents
 ///    of the box from.
 /// </param>
 /// <param name="handler">
 ///    A <see cref="IsoHandlerBox" /> object containing the
 ///    handler that applies to the new instance.
 /// </param>
 /// <exception cref="ArgumentNullException">
 ///    <paramref name="file" /> is <see langword="null" />.
 /// </exception>
 public AppleAdditionalInfoBox(BoxHeader header, TagLib.File file, IsoHandlerBox handler)
     : base(header, file, handler)
 {
     // We do not care what is in this custom data section
     // see: https://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap2/qtff2.html
     Data = file.ReadBlock(DataSize > 0 ? DataSize : 0); ;
 }
开发者ID:samueldjack,项目名称:taglib-sharp,代码行数:28,代码来源:AppleAdditionalInfoBox.cs

示例4: Read

		protected void Read(TagLib.File file)
		{
			if (file == null)
				return;

			try
			{
				file.Mode = FileAccessMode.Read;
			}
			catch (TagLibException)
			{
				return;
			}

			file.Seek(tagOffset);
			header.SetData(file.ReadBlock((int)Id3v2Header.Size));

			// if the tag size is 0, then this is an invalid tag (tags must contain
			// at least one frame)

			if (header.TagSize == 0)
				return;

			Parse(file.ReadBlock((int)header.TagSize));
		}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:25,代码来源:Id3v2Tag.cs

示例5: PageHeader

 public PageHeader(TagLib.Ogg.File file, long position)
 {
     if (file == null)
     {
         throw new ArgumentNullException("file");
     }
     if ((position < 0L) || (position > (file.Length - 0x1bL)))
     {
         throw new ArgumentOutOfRangeException("position");
     }
     file.Seek(position);
     ByteVector vector = file.ReadBlock(0x1b);
     if ((vector.Count < 0x1b) || !vector.StartsWith("OggS"))
     {
         throw new CorruptFileException("Error reading page header");
     }
     this.version = vector[4];
     this.flags = (PageFlags) vector[5];
     this.absolute_granular_position = vector.Mid(6, 8).ToULong(false);
     this.stream_serial_number = vector.Mid(14, 4).ToUInt(false);
     this.page_sequence_number = vector.Mid(0x12, 4).ToUInt(false);
     int length = vector[0x1a];
     ByteVector vector2 = file.ReadBlock(length);
     if ((length < 1) || (vector2.Count != length))
     {
         throw new CorruptFileException("Incorrect number of page segments");
     }
     this.size = (uint) (0x1b + length);
     this.packet_sizes = new List<int>();
     int item = 0;
     this.data_size = 0;
     for (int i = 0; i < length; i++)
     {
         this.data_size += vector2[i];
         item += vector2[i];
         if (vector2[i] < 0xff)
         {
             this.packet_sizes.Add(item);
             item = 0;
         }
     }
     if (item > 0)
     {
         this.packet_sizes.Add(item);
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:46,代码来源:PageHeader.cs

示例6: Page

 public Page(TagLib.Ogg.File file, long position) : this(new PageHeader(file, position))
 {
     file.Seek(position + this.header.Size);
     foreach (int num in this.header.PacketSizes)
     {
         this.packets.Add(file.ReadBlock(num));
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:8,代码来源:Page.cs

示例7: ListTag

 protected ListTag (TagLib.File file, long position, int length)
 {
    if (file == null)
       throw new System.ArgumentNullException ("file");
    
    file.Seek (position);
    fields = new List (file.ReadBlock (length));
 }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:8,代码来源:ListTag.cs

示例8: IsoSampleEntry

 public IsoSampleEntry(BoxHeader header, TagLib.File file, IsoHandlerBox handler) : base(header, handler)
 {
     if (file == null)
     {
         throw new ArgumentNullException("file");
     }
     file.Seek(base.DataPosition + 6L);
     this.data_reference_index = file.ReadBlock(2).ToUShort();
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:9,代码来源:IsoSampleEntry.cs

示例9: IsoSampleDescriptionBox

 public IsoSampleDescriptionBox(BoxHeader header, TagLib.File file, IsoHandlerBox handler) : base(header, file, handler)
 {
     if (file == null)
     {
         throw new ArgumentNullException("file");
     }
     this.entry_count = file.ReadBlock(4).ToUInt();
     this.children = base.LoadChildren(file);
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:9,代码来源:IsoSampleDescriptionBox.cs

示例10: IsoChunkOffsetBox

 public IsoChunkOffsetBox(BoxHeader header, TagLib.File file, IsoHandlerBox handler) : base(header, file, handler)
 {
     ByteVector vector = file.ReadBlock(base.DataSize);
     this.offsets = new uint[vector.Mid(0, 4).ToUInt()];
     for (int i = 0; i < this.offsets.Length; i++)
     {
         this.offsets[i] = vector.Mid(4 + (i * 4), 4).ToUInt();
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:9,代码来源:IsoChunkOffsetBox.cs

示例11: AudioHeader

 private AudioHeader(ByteVector data, TagLib.File file, long position)
 {
     this.duration = TimeSpan.Zero;
     this.stream_length = 0L;
     if (data.Count < 4)
     {
         throw new CorruptFileException("Insufficient header length.");
     }
     if (data[0] != 0xff)
     {
         throw new CorruptFileException("First byte did not match MPEG synch.");
     }
     if (((data[1] & 230) <= 0xe0) || ((data[1] & 0x18) == 8))
     {
         throw new CorruptFileException("Second byte did not match MPEG synch.");
     }
     this.flags = data.ToUInt();
     if (((this.flags >> 12) & 15) == 15)
     {
         throw new CorruptFileException("Header uses invalid bitrate index.");
     }
     if (((this.flags >> 10) & 3) == 3)
     {
         throw new CorruptFileException("Invalid sample rate.");
     }
     this.xing_header = TagLib.Mpeg.XingHeader.Unknown;
     this.vbri_header = TagLib.Mpeg.VBRIHeader.Unknown;
     file.Seek(position + TagLib.Mpeg.XingHeader.XingHeaderOffset(this.Version, this.ChannelMode));
     ByteVector vector = file.ReadBlock(0x10);
     if ((vector.Count == 0x10) && vector.StartsWith(TagLib.Mpeg.XingHeader.FileIdentifier))
     {
         this.xing_header = new TagLib.Mpeg.XingHeader(vector);
     }
     if (!this.xing_header.Present)
     {
         file.Seek(position + TagLib.Mpeg.VBRIHeader.VBRIHeaderOffset());
         ByteVector vector2 = file.ReadBlock(0x18);
         if ((vector2.Count == 0x18) && vector2.StartsWith(TagLib.Mpeg.VBRIHeader.FileIdentifier))
         {
             this.vbri_header = new TagLib.Mpeg.VBRIHeader(vector2);
         }
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:43,代码来源:AudioHeader.cs

示例12: StreamPropertiesObject

 public StreamPropertiesObject(TagLib.Asf.File file, long position) : base(file, position)
 {
     if (!base.Guid.Equals(TagLib.Asf.Guid.AsfStreamPropertiesObject))
     {
         throw new CorruptFileException("Object GUID incorrect.");
     }
     if (base.OriginalSize < 0x4eL)
     {
         throw new CorruptFileException("Object size too small.");
     }
     this.stream_type = file.ReadGuid();
     this.error_correction_type = file.ReadGuid();
     this.time_offset = file.ReadQWord();
     int length = (int) file.ReadDWord();
     int num2 = (int) file.ReadDWord();
     this.flags = file.ReadWord();
     this.reserved = file.ReadDWord();
     this.type_specific_data = file.ReadBlock(length);
     this.error_correction_data = file.ReadBlock(num2);
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:20,代码来源:StreamPropertiesObject.cs

示例13: FullBox

 protected FullBox(BoxHeader header, TagLib.File file, IsoHandlerBox handler) : base(header, handler)
 {
     if (file == null)
     {
         throw new ArgumentNullException("file");
     }
     file.Seek(base.DataPosition);
     ByteVector vector = file.ReadBlock(4);
     this.version = vector[0];
     this.flags = vector.Mid(1, 3).ToUInt();
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:11,代码来源:FullBox.cs

示例14: FullBox

        /// <summary>
        ///    Constructs and initializes a new instance of <see
        ///    cref="FullBox" /> with a provided header and handler by
        ///    reading the contents from a specified file.
        /// </summary>
        /// <param name="header">
        ///    A <see cref="BoxHeader" /> object containing the header
        ///    to use for the new instance.
        /// </param>
        /// <param name="file">
        ///    A <see cref="TagLib.File" /> object to read the contents
        ///    of the box from.
        /// </param>
        /// <param name="handler">
        ///    A <see cref="IsoHandlerBox" /> object containing the
        ///    handler that applies to the new instance.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///    <paramref name="file" /> is <see langword="null" />.
        /// </exception>
        protected FullBox(BoxHeader header, TagLib.File file,
            IsoHandlerBox handler)
            : base(header, handler)
        {
            if (file == null)
                throw new ArgumentNullException ("file");

            file.Seek (base.DataPosition);
            ByteVector header_data = file.ReadBlock (4);
            version = header_data [0];
            flags = header_data.Mid (1, 3).ToUInt ();
        }
开发者ID:sanyaade-embedded-systems,项目名称:MPTagThat,代码行数:32,代码来源:FullBox.cs

示例15: IsoChunkOffsetBox

		/// <summary>
		///    Constructs and initializes a new instance of <see
		///    cref="IsoChunkOffsetBox" /> with a provided header and
		///    handler by reading the contents from a specified file.
		/// </summary>
		/// <param name="header">
		///    A <see cref="BoxHeader" /> object containing the header
		///    to use for the new instance.
		/// </param>
		/// <param name="file">
		///    A <see cref="TagLib.File" /> object to read the contents
		///    of the box from.
		/// </param>
		/// <param name="handler">
		///    A <see cref="IsoHandlerBox" /> object containing the
		///    handler that applies to the new instance.
		/// </param>
		public IsoChunkOffsetBox (BoxHeader header, TagLib.File file,
		                          IsoHandlerBox handler)
			: base (header, file, handler)
		{
			ByteVector box_data = file.ReadBlock (DataSize);
			
			offsets = new uint [(int)
				box_data.Mid (0, 4).ToUInt ()];
			
			for (int i = 0; i < offsets.Length; i ++)
				offsets [i] = box_data.Mid (4 + i * 4,
					4).ToUInt ();
		}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:30,代码来源:IsoChunkOffsetBox.cs


注:本文中的TagLib.ReadBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。