本文整理汇总了C#中ByteVector类的典型用法代码示例。如果您正苦于以下问题:C# ByteVector类的具体用法?C# ByteVector怎么用?C# ByteVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ByteVector类属于命名空间,在下文中一共展示了ByteVector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ParseRelativeVolumeFields
private void ParseRelativeVolumeFields(ByteVector data)
{
int pos = data.Find(TextDelimiter(StringType.Latin1));
if (pos < 0)
return;
identification = data.Mid(0, pos).ToString(StringType.Latin1);
pos += 1;
// Each channel is at least 4 buffer.
while (pos <= data.Count - 4)
{
Id3v2ChannelType type = (Id3v2ChannelType)data[pos];
pos += 1;
SetVolumeAdjustmentIndex(data.Mid(pos, 2).ToShort(), type);
pos += 2;
int bytes = BitsToBytes(data[pos]);
pos += 1;
SetPeakVolumeIndex(ParsePeakVolume(data.Mid(pos, bytes)), type);
pos += bytes;
}
}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:26,代码来源:Id3v2RelativeVolumeFrame.cs
示例2: ParseStreamList
public static AviStream ParseStreamList (ByteVector data)
{
if (data == null)
throw new ArgumentNullException ("data");
AviStream stream = null;
int pos = 4;
if (data.StartsWith ("strl"))
while (pos + 8 < data.Count)
{
ByteVector id = data.Mid (pos, 4);
int block_length = (int) data.Mid (pos + 4, 4).ToUInt (false);
if (id == "strh" && stream == null)
{
AviStreamHeader stream_header = new AviStreamHeader (data, pos + 8);
if (stream_header.Type == "vids")
stream = new AviVideoStream (stream_header);
else if (stream_header.Type == "auds")
stream = new AviAudioStream (stream_header);
}
else if (stream != null)
stream.ParseItem (id, data, pos + 8, block_length);
pos += block_length + 8;
}
return stream;
}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:30,代码来源:AviStream.cs
示例3: ParseHeader
protected void ParseHeader(ByteVector data)
{
if (header != null)
header.SetData(data);
else
header = new Id3v2FrameHeader(data);
}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:Id3v2Frame.cs
示例4: ParseFields
protected override void ParseFields(ByteVector data, byte version)
{
if (data.Count < 4)
{
throw new CorruptFileException("An object frame must contain at least 4 bytes.");
}
int offset = 0;
this.encoding = (StringType) data[offset++];
int num2 = data.Find(ByteVector.TextDelimiter(StringType.Latin1), offset);
if (num2 >= offset)
{
this.mime_type = data.ToString(StringType.Latin1, offset, num2 - offset);
ByteVector pattern = ByteVector.TextDelimiter(this.encoding);
offset = num2 + 1;
num2 = data.Find(pattern, offset, pattern.Count);
if (num2 >= offset)
{
this.file_name = data.ToString(this.encoding, offset, num2 - offset);
offset = num2 + pattern.Count;
num2 = data.Find(pattern, offset, pattern.Count);
if (num2 >= offset)
{
this.description = data.ToString(this.encoding, offset, num2 - offset);
offset = num2 + pattern.Count;
data.RemoveRange(0, offset);
this.data = data;
}
}
}
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:30,代码来源:GeneralEncapsulatedObjectFrame.cs
示例5: AviStreamHeader
public AviStreamHeader(ByteVector data, int offset)
{
if (data == null)
{
throw new ArgumentNullException("data");
}
if (offset < 0)
{
throw new ArgumentOutOfRangeException("offset");
}
if ((offset + 0x38) > data.Count)
{
throw new CorruptFileException("Expected 56 bytes.");
}
this.type = data.Mid(offset, 4);
this.handler = data.Mid(offset + 4, 4);
this.flags = data.Mid(offset + 8, 4).ToUInt(false);
this.priority = data.Mid(offset + 12, 4).ToUInt(false);
this.initial_frames = data.Mid(offset + 0x10, 4).ToUInt(false);
this.scale = data.Mid(offset + 20, 4).ToUInt(false);
this.rate = data.Mid(offset + 0x18, 4).ToUInt(false);
this.start = data.Mid(offset + 0x1c, 4).ToUInt(false);
this.length = data.Mid(offset + 0x20, 4).ToUInt(false);
this.suggested_buffer_size = data.Mid(offset + 0x24, 4).ToUInt(false);
this.quality = data.Mid(offset + 40, 4).ToUInt(false);
this.sample_size = data.Mid(offset + 0x2c, 4).ToUInt(false);
this.left = data.Mid(offset + 0x30, 2).ToUShort(false);
this.top = data.Mid(offset + 50, 2).ToUShort(false);
this.right = data.Mid(offset + 0x34, 2).ToUShort(false);
this.bottom = data.Mid(offset + 0x36, 2).ToUShort(false);
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:31,代码来源:AviStreamHeader.cs
示例6: RenderTextIdentifierFields
private ByteVector RenderTextIdentifierFields()
{
ByteVector vector = new ByteVector();
if (fieldList.Count > 0)
{
vector.Add((byte)textEncoding);
bool first = true;
foreach (string field in fieldList)
{
// Since the field text is null delimited, if this is not the
// first element in the text, append the appropriate delimiter
// for this encoding.
if (!first)
vector.Add(TextDelimiter(textEncoding));
first = false;
vector.Add(ByteVector.FromString(field, textEncoding));
}
}
return vector;
}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:25,代码来源:Id3v2TextIdentificationFrame.cs
示例7: Parse
protected void Parse(ByteVector data)
{
if (data != null)
{
if (data.Count < Size)
return;
// The first eight buffer, data[0..7], are the File Identifier, "APETAGEX".
// Read the version number
version = data.Mid(8, 4).ToUInt(false);
// Read the tag size
tagSize = data.Mid(12, 4).ToUInt(false);
// Read the item count
itemCount = data.Mid(16, 4).ToUInt(false);
// Read the flags
uint flags = data.Mid(20, 4).ToUInt(false);
headerPresent = (flags >> 31) == 1;
footerPresent = (flags >> 30) != 1;
isHeader = (flags >> 29) == 1;
}
else throw new ArgumentNullException("data");
}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:28,代码来源:ApeFooter.cs
示例8: Footer
public Footer (ByteVector data)
{
if (data.Count < Size)
throw new CorruptFileException ("Provided data is smaller than object size.");
if (!data.StartsWith (FileIdentifier))
throw new CorruptFileException ("Provided data does not start with File Identifier");
major_version = data [3];
revision_number = data [4];
flags = (HeaderFlags) data [5];
if (major_version == 2 && (flags & (HeaderFlags) 127) != 0)
throw new CorruptFileException ("Invalid flags set on version 2 tag.");
if (major_version == 3 && (flags & (HeaderFlags) 15) != 0)
throw new CorruptFileException ("Invalid flags set on version 3 tag.");
if (major_version == 4 && (flags & (HeaderFlags) 7) != 0)
throw new CorruptFileException ("Invalid flags set on version 4 tag.");
ByteVector size_data = data.Mid (6, 4);
foreach (byte b in size_data)
if (b >= 128)
throw new CorruptFileException ("One of the bytes in the header was greater than the allowed 128.");
tag_size = SynchData.ToUInt (size_data);
}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:31,代码来源:Footer.cs
示例9: ParseItem
public override void ParseItem(ByteVector id, ByteVector data, int start, int length)
{
if (id == "strf")
{
base.Codec = new BitmapInfoHeader(data, start);
}
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:7,代码来源:AviVideoStream.cs
示例10: ParseCommentsFields
private void ParseCommentsFields(ByteVector data)
{
if (data.Count < 5)
{
TagLibDebugger.Debug("A comment frame must contain at least 5 bytes.");
return;
}
textEncoding = (StringType)data[0];
language = data.Mid(1, 3);
int byte_align = textEncoding == StringType.Latin1 || textEncoding == StringType.UTF8 ? 1 : 2;
ByteVectorCollection l = ByteVectorCollection.Split(data.Mid(4), TextDelimiter(textEncoding), byte_align, 2);
if (l.Count == 2)
{
if (l[0].Data != null && l[0].Data.Count > 0)
description = l[0].ToString(textEncoding);
else description = string.Empty;
if (l[1].Data != null && l[1].Data.Count > 0)
text = l[1].ToString(textEncoding);
else text = string.Empty;
}
}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:26,代码来源:Id3v2CommentsFrame.cs
示例11: Parse
private void Parse(ByteVector data)
{
// Check to see if a valid Xing header is available.
if (!data.StartsWith("Xing"))
return;
// If the XingHeader doesn'type contain the number of frames and the total stream
// info it'field invalid.
if ((data[7] & 0x02) == 0)
{
TagLibDebugger.Debug("MPEG::XingHeader::parse() -- Xing header doesn't contain the total number of frames.");
return;
}
if ((data[7] & 0x04) == 0)
{
TagLibDebugger.Debug("MPEG::XingHeader::parse() -- Xing header doesn't contain the total stream size.");
return;
}
frames = data.Mid(8, 4).ToUInt();
size = data.Mid(12, 4).ToUInt();
valid = true;
}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:27,代码来源:MpegXingHeader.cs
示例12: MpegXingHeader
public MpegXingHeader(ByteVector data)
{
//frames = 0;
//size = 0;
//valid = false;
Parse(data);
}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:MpegXingHeader.cs
示例13: GetChild
public Box GetChild(ByteVector type)
{
if (this.Children != null)
{
IEnumerator<Box> enumerator = this.Children.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Box current = enumerator.Current;
if (current.BoxType == type)
{
return current;
}
}
}
finally
{
if (enumerator == null)
{
}
enumerator.Dispose();
}
}
return null;
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:26,代码来源:Box.cs
示例14: ParseItem
public override void ParseItem(ByteVector id, ByteVector data, int start, int length)
{
if (id == "strf")
{
base.Codec = new WaveFormatEx(data, start);
}
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:7,代码来源:AviAudioStream.cs
示例15: XingHeader
public XingHeader(ByteVector data)
{
if (data == null)
{
throw new ArgumentNullException("data");
}
if (!data.StartsWith(FileIdentifier))
{
throw new CorruptFileException("Not a valid Xing header");
}
int startIndex = 8;
if ((data[7] & 1) != 0)
{
this.frames = data.Mid(startIndex, 4).ToUInt();
startIndex += 4;
}
else
{
this.frames = 0;
}
if ((data[7] & 2) != 0)
{
this.size = data.Mid(startIndex, 4).ToUInt();
startIndex += 4;
}
else
{
this.size = 0;
}
this.present = true;
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:31,代码来源:XingHeader.cs
示例16: Render
public new ByteVector Render()
{
ByteVector output = new ByteVector();
output = _data;
output.Insert(0, Header.Render());
return output;
}
开发者ID:leetreveil,项目名称:Zune-Social-Tagger,代码行数:7,代码来源:XtraBox.cs
示例17: StreamHeader
public StreamHeader(ByteVector data, long streamLength)
{
if (data == null)
{
throw new ArgumentNullException("data");
}
if (!data.StartsWith(FileIdentifier))
{
throw new CorruptFileException("Data does not begin with identifier.");
}
if (data.Count < 0x38L)
{
throw new CorruptFileException("Insufficient data in stream header");
}
this.stream_length = streamLength;
this.version = data[3] & 15;
if (this.version >= 7)
{
this.frames = data.Mid(4, 4).ToUInt(false);
uint num = data.Mid(8, 4).ToUInt(false);
this.sample_rate = sftable[(((num >> 0x11) & 1) * 2) + ((num >> 0x10) & 1)];
this.header_data = 0;
}
else
{
this.header_data = data.Mid(0, 4).ToUInt(false);
this.version = ((int) (this.header_data >> 11)) & 0x3ff;
this.sample_rate = 0xac44;
this.frames = data.Mid(4, (this.version < 5) ? 2 : 4).ToUInt(false);
}
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:31,代码来源:StreamHeader.cs
示例18: ParseStreamList
public static AviStream ParseStreamList(ByteVector data)
{
int num2;
if (data == null)
{
throw new ArgumentNullException("data");
}
if (!data.StartsWith("strl"))
{
return null;
}
AviStream stream = null;
for (int i = 4; (i + 8) < data.Count; i += num2 + 8)
{
ByteVector id = data.Mid(i, 4);
num2 = (int) data.Mid(i + 4, 4).ToUInt(false);
if ((id == "strh") && (stream == null))
{
AviStreamHeader header = new AviStreamHeader(data, i + 8);
if (header.Type == "vids")
{
stream = new AviVideoStream(header);
}
else if (header.Type == "auds")
{
stream = new AviAudioStream(header);
}
}
else if (stream != null)
{
stream.ParseItem(id, data, i + 8, num2);
}
}
return stream;
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:35,代码来源:AviStream.cs
示例19: ReadPage
public bool ReadPage(Page page)
{
if (page == null)
{
throw new ArgumentNullException("page");
}
ByteVector[] packets = page.Packets;
for (int i = 0; i < packets.Length; i++)
{
if ((((byte) (page.Header.Flags & PageFlags.FirstPacketContinued)) == 0) && (this.previous_packet != null))
{
if (this.ReadPacket(this.previous_packet))
{
return true;
}
this.previous_packet = null;
}
ByteVector data = packets[i];
if (((i == 0) && (((byte) (page.Header.Flags & PageFlags.FirstPacketContinued)) != 0)) && (this.previous_packet != null))
{
this.previous_packet.Add(data);
data = this.previous_packet;
}
this.previous_packet = null;
if (i == (packets.Length - 1))
{
this.previous_packet = new ByteVector(data);
}
else if (this.ReadPacket(data))
{
return true;
}
}
return false;
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:35,代码来源:Bitstream.cs
示例20: ReadPacket
public override bool ReadPacket(ByteVector packet, int index)
{
if (packet == null)
{
throw new ArgumentNullException("packet");
}
if (index < 0)
{
throw new ArgumentOutOfRangeException("index", "index must be at least zero.");
}
int num = PacketType(packet);
if ((num != 0x80) && (index == 0))
{
throw new CorruptFileException("Stream does not begin with theora header.");
}
if (this.comment_data == null)
{
switch (num)
{
case 0x80:
this.header = new HeaderPacket(packet);
goto Label_009D;
case 0x81:
this.comment_data = packet.Mid(7);
goto Label_009D;
}
return true;
}
Label_009D:
return (this.comment_data != null);
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:32,代码来源:Theora.cs
注:本文中的ByteVector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论