本文整理汇总了C#中TagLib.Seek方法的典型用法代码示例。如果您正苦于以下问题:C# TagLib.Seek方法的具体用法?C# TagLib.Seek怎么用?C# TagLib.Seek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagLib
的用法示例。
在下文中一共展示了TagLib.Seek方法的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);
}
示例2: 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));
}
示例3: 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));
}
}
示例4: 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));
}
示例5: 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();
}
示例6: 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);
}
}
}
示例7: 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();
}
示例8: 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 ();
}
示例9: IsoVisualSampleEntry
/*
/// <summary>
/// Contains the children of the box.
/// </summary>
private BoxList children;
*/
#endregion
#region Constructors
/// <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);
*/
}
示例10: Object
protected Object(TagLib.Asf.File file, long position)
{
if (file == null)
{
throw new ArgumentNullException("file");
}
if ((position < 0L) || (position > (file.Length - 0x18L)))
{
throw new ArgumentOutOfRangeException("position");
}
file.Seek(position);
this.id = file.ReadGuid();
this.size = file.ReadQWord();
}
示例11: IsoHandlerBox
/// <summary>
/// Constructs and initializes a new instance of <see
/// cref="IsoHandlerBox" /> 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 IsoHandlerBox(BoxHeader header, TagLib.File file,
IsoHandlerBox handler)
: base(header, file, handler)
{
if (file == null)
throw new System.ArgumentNullException ("file");
file.Seek (DataPosition + 4);
ByteVector box_data = file.ReadBlock (DataSize - 4);
handler_type = box_data.Mid (0, 4);
int end = box_data.Find ((byte) 0, 16);
if (end < 16)
end = box_data.Count;
name = box_data.ToString (StringType.UTF8, 16, end - 16);
}
示例12: IsoHandlerBox
public IsoHandlerBox(BoxHeader header, TagLib.File file, IsoHandlerBox handler) : base(header, file, handler)
{
if (file == null)
{
throw new ArgumentNullException("file");
}
file.Seek(this.DataPosition + 4L);
ByteVector vector = file.ReadBlock(base.DataSize - 4);
this.handler_type = vector.Mid(0, 4);
int count = vector.Find(0, 0x10);
if (count < 0x10)
{
count = vector.Count;
}
this.name = vector.ToString(StringType.UTF8, 0x10, count - 0x10);
}
示例13: 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);
}
}
示例14: VideoHeader
public VideoHeader(TagLib.File file, long position)
{
if (file == null)
{
throw new ArgumentNullException("file");
}
file.Seek(position);
ByteVector vector = file.ReadBlock(7);
if (vector.Count < 7)
{
throw new CorruptFileException("Insufficient data in header.");
}
this.width = vector.Mid(0, 2).ToUShort() >> 4;
this.height = vector.Mid(1, 2).ToUShort() & 0xfff;
this.frame_rate_index = vector[3] & 15;
this.bitrate = ((int) (vector.Mid(4, 3).ToUInt() >> 6)) & 0x3ffff;
}
示例15: BoxHeader
public BoxHeader(TagLib.File file, long position)
{
if (file == null)
{
throw new ArgumentNullException("file");
}
this.box = null;
this.from_disk = true;
this.position = position;
file.Seek(position);
ByteVector vector = file.ReadBlock(0x20);
int startIndex = 0;
if (vector.Count < (8 + startIndex))
{
throw new CorruptFileException("Not enough data in box header.");
}
this.header_size = 8;
this.box_size = vector.Mid(startIndex, 4).ToUInt();
this.box_type = vector.Mid(startIndex + 4, 4);
if (this.box_size == 1L)
{
if (vector.Count < (8 + startIndex))
{
throw new CorruptFileException("Not enough data in box header.");
}
this.header_size += 8;
this.box_size = vector.Mid(startIndex, 8).ToULong();
startIndex += 8;
}
if (this.box_type == TagLib.Mpeg4.BoxType.Uuid)
{
if (vector.Count < (0x10 + startIndex))
{
throw new CorruptFileException("Not enough data in box header.");
}
this.header_size += 0x10;
this.extended_type = vector.Mid(startIndex, 0x10);
}
else
{
this.extended_type = null;
}
}