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


C# ByteVector类代码示例

本文整理汇总了C#中ByteVector的典型用法代码示例。如果您正苦于以下问题:C# ByteVector类的具体用法?C# ByteVector怎么用?C# ByteVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ByteVector类属于命名空间,在下文中一共展示了ByteVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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