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


C# ByteVector.RemoveRange方法代码示例

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


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

示例1: ParseFields

        /// <summary>
        ///    Populates the values in the current instance by parsing
        ///    its field data in a specified version.
        /// </summary>
        /// <param name="data">
        ///    A <see cref="ByteVector" /> object containing the
        ///    extracted field data.
        /// </param>
        /// <param name="version">
        ///    A <see cref="byte" /> indicating the ID3v2 version the
        ///    field data is encoded in.
        /// </param>
        /// <exception cref="CorruptFileException">
        ///    <paramref name="data" /> contains less than 5 bytes.
        /// </exception>
        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 start = 0;

            encoding =  (StringType) data [start++];

            int end = data.Find (
                ByteVector.TextDelimiter (StringType.Latin1),
                start);

            if (end < start)
                return;

            mime_type = data.ToString (StringType.Latin1, start,
                end - start);

            ByteVector delim = ByteVector.TextDelimiter (
                encoding);
            start = end + 1;
            end = data.Find (delim, start, delim.Count);

            if (end < start)
                return;

            file_name = data.ToString (encoding, start,
                end - start);
            start = end + delim.Count;
            end = data.Find (delim, start, delim.Count);

            if (end < start)
                return;

            description = data.ToString (encoding, start,
                end - start);
            start = end + delim.Count;

            data.RemoveRange (0, start);
            this.data = data;
        }
开发者ID:sanyaade-embedded-systems,项目名称:MPTagThat,代码行数:59,代码来源:GeneralEncapsulatedObjectFrame.cs

示例2: 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

示例3: Parse

		/// <summary>
		///    Populates the current instance by parsing the contents of
		///    a raw AudibleMetadata tag.
		/// </summary>
		/// <param name="data">
		///    	A <see cref="ByteVector" /> object containing the whole tag
		/// 	object
		/// </param>
		/// <exception cref="CorruptFileException">
		///    <paramref name="data" /> is less than 128 bytes or does
		///    not start with <see cref="FileIdentifier" />.
		/// </exception>
		private void Parse (ByteVector data)
		{
			String currentKey, currentValue;
			int keyLen, valueLen;
			
			try
			{
				do
				{
					keyLen = (int) data.ToUInt(true);
					data.RemoveRange (0, 4);
					valueLen = (int) data.ToUInt(true);
					data.RemoveRange (0, 4);
					currentKey = data.ToString ( TagLib.StringType.UTF8, 0, keyLen );
					data.RemoveRange (0, keyLen);
					currentValue = data.ToString ( TagLib.StringType.UTF8, 0, valueLen );
					data.RemoveRange (0, valueLen);
					
					tags.Add( new KeyValuePair<string, string>(currentKey, currentValue) );
					
					//StringHandle (currentKey, currentValue);
					
					// if it is not the last item remove the end byte (null terminated)
					if (data.Count != 0)
						data.RemoveRange(0,1);
				}
				while (data.Count >= 4);
			}
			catch (Exception)
			{
				//
			}
			
			if (data.Count != 0)
				throw new CorruptFileException();
		}
开发者ID:hoeness2,项目名称:mcebuddy2,代码行数:48,代码来源:Tag.cs


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