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


C# ByteVector.ToStrings方法代码示例

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


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

示例1: CommentsFrameError

        public void CommentsFrameError()
        {
            // http://bugzilla.gnome.org/show_bug.cgi?id=582735
            // Comments data found in the wild
            ByteVector vector = new ByteVector (
                1, 255, 254, 73, 0, 68, 0, 51, 0, 71, 0, 58, 0, 32, 0, 50, 0, 55, 0, 0, 0);

            var encoding = (StringType) vector [0];
            var language = vector.ToString (StringType.Latin1, 1, 3);
            var split = vector.ToStrings (encoding, 4, 3);
            Assert.AreEqual (2, split.Length);
        }
开发者ID:rubenv,项目名称:taglib-sharp,代码行数:12,代码来源:ByteVectorTest.cs

示例2: 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>
		protected override void ParseFields (ByteVector data,
		                                     byte version)
		{
			if (data.Count < 4)
				throw new CorruptFileException (
					"Not enough bytes in field.");
			
			encoding = (StringType) data [0];
			language = data.ToString (StringType.Latin1, 1, 3);
			
			string [] split = data.ToStrings (encoding, 4, 2);
			
			if (split.Length == 1) {
				// Bad lyrics frame. Assume that it lacks a
				// description.
				description = String.Empty;
				text = split [0];
			} else {
				description = split [0];
				text = split [1];
			}
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:34,代码来源:UnsynchronisedLyricsFrame.cs

示例3: 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>
		protected override void ParseFields (ByteVector data,
		                                     byte version)
		{
			if (data.Count < 4)
				throw new CorruptFileException (
					"Not enough bytes in field.");
			
			encoding = (StringType) data [0];
			language = data.ToString (StringType.Latin1, 1, 3);
			
			// Instead of splitting into two string, in the format
			// [{desc}\0{value}], try splitting into three strings
			// in case of a misformatted [{desc}\0{value}\0].
			string [] split = data.ToStrings (encoding, 4, 3);
			
			if (split.Length == 0) {
				// No data in the frame.
				description = String.Empty;
				text        = String.Empty;
			} else if (split.Length == 1) {
				// Bad comment frame. Assume that it lacks a
				// description.
				description = String.Empty;
				text        = split [0];
			} else {
				description = split [0];
				text        = split [1];
			}
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:41,代码来源:CommentsFrame.cs

示例4: ParseFields

 protected override void ParseFields(ByteVector data, byte version)
 {
     if (data.Count < 4)
     {
         throw new CorruptFileException("Not enough bytes in field.");
     }
     this.encoding = (StringType) data[0];
     this.language = data.ToString(StringType.Latin1, 1, 3);
     string[] strArray = data.ToStrings(this.encoding, 4, 2);
     if (strArray.Length == 1)
     {
         this.description = string.Empty;
         this.text = strArray[0];
     }
     else
     {
         this.description = strArray[0];
         this.text = strArray[1];
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:20,代码来源:UnsynchronisedLyricsFrame.cs


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