本文整理汇总了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);
}
示例2: Render
public new ByteVector Render()
{
ByteVector output = new ByteVector();
output = _data;
output.Insert(0, Header.Render());
return output;
}
示例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);
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}