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


C# ByteVector.Insert方法代码示例

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


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

示例1: Render

 public override ByteVector Render()
 {
     ByteVector data = new ByteVector();
     foreach (TagLib.Asf.Object obj2 in this.children)
     {
         data.Add(obj2.Render());
     }
     data.Insert(0, TagLib.Asf.Object.RenderDWord((uint) data.Count));
     data.Insert(0, TagLib.Asf.Object.RenderWord(6));
     data.Insert(0, TagLib.Asf.Guid.AsfReserved1.ToByteArray());
     return base.Render(data);
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:12,代码来源:HeaderExtensionObject.cs

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

示例3: Render

 public override ByteVector Render()
 {
     ByteVector data = new ByteVector();
     uint num = 0;
     foreach (TagLib.Asf.Object obj2 in this.children)
     {
         if (obj2.Guid != TagLib.Asf.Guid.AsfPaddingObject)
         {
             data.Add(obj2.Render());
             num++;
         }
     }
     long num2 = (data.Count + 30L) - ((long) base.OriginalSize);
     if (num2 != 0)
     {
         data.Add(new PaddingObject((num2 <= 0L) ? ((uint) -num2) : ((uint) 0x1000L)).Render());
         num++;
     }
     data.Insert(0, this.reserved);
     data.Insert(0, TagLib.Asf.Object.RenderDWord(num));
     return base.Render(data);
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:22,代码来源:HeaderObject.cs

示例4: UnsynchByteVector

 public static void UnsynchByteVector(ByteVector data)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     for (int i = data.Count - 2; i >= 0; i--)
     {
         if ((data[i] == 0xff) && ((data[i + 1] == 0) || ((data[i + 1] & 0xe0) != 0)))
         {
             data.Insert(i + 1, (byte) 0);
         }
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:14,代码来源:SynchData.cs

示例5: Render

		/// <summary>
		///    Renders the current instance, including its children, to
		///    a new <see cref="ByteVector" /> object, preceeding the
		///    contents with a specified block of data.
		/// </summary>
		/// <param name="topData">
		///    A <see cref="ByteVector" /> object containing box
		///    specific header data to preceed the content.
		/// </param>
		/// <returns>
		///    A <see cref="ByteVector" /> object containing the
		///    rendered version of the current instance.
		/// </returns>
		protected virtual ByteVector Render (ByteVector topData)
		{
			bool free_found = false;
			ByteVector output = new ByteVector ();
			
			if (Children != null)
				foreach (Box box in Children)
					if (box.GetType () == typeof (
						IsoFreeSpaceBox))
						free_found = true;
					else
						output.Add (box.Render ());
			else if (Data != null)
				output.Add (Data);
			
			// If there was a free, don't take it away, and let meta
			// be a special case.
			if (free_found || BoxType == Mpeg4.BoxType.Meta) {
				long size_difference = DataSize - output.Count;
				
				// If we have room for free space, add it so we
				// don't have to resize the file.
				if (header.DataSize != 0 && size_difference >= 8)
					output.Add ((new IsoFreeSpaceBox (
						size_difference)).Render ());
				
				// If we're getting bigger, get a lot bigger so
				// we might not have to again.
				else
					output.Add ((new IsoFreeSpaceBox (2048
						)).Render ());
			}
			
			// Adjust the header's data size to match the content.
			header.DataSize = topData.Count + output.Count;
			
			// Render the full box.
			output.Insert (0, topData);
			output.Insert (0, header.Render ());
			
			return output;
		}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:55,代码来源:Box.cs

示例6: Render

        /// <summary>
        ///    Renders the current instance as a raw ASF object.
        /// </summary>
        /// <returns>
        ///    A <see cref="ByteVector" /> object containing the
        ///    rendered version of the current instance.
        /// </returns>
        public override ByteVector Render()
        {
            ByteVector output = new ByteVector ();
            uint child_count = 0;

            foreach (Object child in children)
                if (child.Guid != Asf.Guid.AsfPaddingObject) {
                    output.Add (child.Render ());
                    child_count ++;
                }

            long size_diff = (long) output.Count + 30 -
                (long) OriginalSize;

            if (size_diff != 0) {
                PaddingObject obj = new PaddingObject ((uint)
                    (size_diff > 0 ? 4096 : - size_diff));

                output.Add (obj.Render ());
                child_count ++;
            }

            output.Insert (0, reserved);
            output.Insert (0, RenderDWord (child_count));
            return Render (output);
        }
开发者ID:sanyaade-embedded-systems,项目名称:MPTagThat,代码行数:33,代码来源:HeaderObject.cs

示例7: Render

		/// <summary>
		///    Renders the current instance as a raw ASF object.
		/// </summary>
		/// <returns>
		///    A <see cref="ByteVector" /> object containing the
		///    rendered version of the current instance.
		/// </returns>
		public override ByteVector Render ()
		{
			ByteVector output = new ByteVector ();
			
			foreach (Object child in children)
				output.Add (child.Render ());
			
			output.Insert (0, RenderDWord ((uint) output.Count));
			output.Insert (0, RenderWord (6));
			output.Insert (0, Asf.Guid.AsfReserved1.ToByteArray ());
			
			return Render (output);
		}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:20,代码来源:HeaderExtensionObject.cs

示例8: UnsynchByteVector

		/// <summary>
		///    Unsynchronizes a <see cref="ByteVector" /> object by
		///    inserting empty bytes where necessary.
		/// </summary>
		/// <param name="data">
		///    A <see cref="ByteVector" /> object to unsynchronize.
		/// </param>
		/// <exception cref="ArgumentNullException">
		///    <paramref name="data" /> is <see langword="null" />.
		/// </exception>
		public static void UnsynchByteVector (ByteVector data)
		{
			if (data == null)
				throw new ArgumentNullException ("data");
			
			for (int i = data.Count - 2; i >= 0; i --)
				if (data [i] == 0xFF && (data [i+1] == 0 ||
					(data [i+1] & 0xE0) != 0))
					data.Insert (i+1, 0);
		}
开发者ID:Sephiroth25896,项目名称:Projects,代码行数:20,代码来源:SynchData.cs

示例9: Render

 protected virtual ByteVector Render(ByteVector topData)
 {
     bool flag = false;
     ByteVector vector = new ByteVector();
     if (this.Children != null)
     {
         IEnumerator<Box> enumerator = this.Children.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 Box current = enumerator.Current;
                 if (current.GetType() == typeof(IsoFreeSpaceBox))
                 {
                     flag = true;
                 }
                 else
                 {
                     vector.Add(current.Render());
                 }
             }
         }
         finally
         {
             if (enumerator == null)
             {
             }
             enumerator.Dispose();
         }
     }
     else if (this.Data != null)
     {
         vector.Add(this.Data);
     }
     if (flag || (this.BoxType == TagLib.Mpeg4.BoxType.Meta))
     {
         long padding = this.DataSize - vector.Count;
         if ((this.header.DataSize != 0) && (padding >= 8L))
         {
             vector.Add(new IsoFreeSpaceBox(padding).Render());
         }
         else
         {
             vector.Add(new IsoFreeSpaceBox(0x800L).Render());
         }
     }
     this.header.DataSize = topData.Count + vector.Count;
     vector.Insert(0, topData);
     vector.Insert(0, this.header.Render());
     return vector;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:51,代码来源:Box.cs


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