本文整理汇总了C#中Manager.SendTable方法的典型用法代码示例。如果您正苦于以下问题:C# Manager.SendTable方法的具体用法?C# Manager.SendTable怎么用?C# Manager.SendTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manager
的用法示例。
在下文中一共展示了Manager.SendTable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Send
/// <summary>
/// Send the current table into the transport stream.
/// <seealso cref="Manager.SendTable"/>
/// <seealso cref="EPG.CRC32.GetCRC"/>
/// </summary>
/// <remarks>
/// If there is no current cached version the table will be reconstructed
/// using <see cref="CreateTable"/>. A table header will be automatically
/// added and a valid CRC32 checksum appended.
/// </remarks>
/// <param name="target">The transport stream where to add the table to.</param>
/// <exception cref="NotImplementedException">Currently the size of a table
/// may not exceed a single transport stream package - <see cref="CreateTable"/>
/// may not report more than 171 bytes.</exception>
public void Send( Manager target )
{
// Create table
if (TableData == null)
{
// Retrieve the raw data
var inner = CreateTable();
var outer = new byte[9 + inner.Length + 4];
// Merge inner
inner.CopyTo( outer, 9 );
// Load private data
int priv = PrivateData;
// Cut
priv &= 0xffff;
// Get section length
int len = outer.Length - 4;
// Fill table header
outer[1] = TableIdentifier;
outer[2] = (byte) (0xb0 | (len / 256));
outer[3] = (byte) (len & 0xff);
outer[4] = (byte) (priv / 256);
outer[5] = (byte) (priv & 0xff);
outer[6] = (byte) (0x01 | ((Version & 0x1f) * 2));
// Calculate CRC32
uint crc32 = EPG.CRC32.GetCRC( outer, 1, len - 1 );
// At the very end
int crcIndex = outer.Length;
// Fill in
outer[--crcIndex] = (byte) (crc32 & 0xff);
outer[--crcIndex] = (byte) ((crc32 >> 8) & 0xff);
outer[--crcIndex] = (byte) ((crc32 >> 16) & 0xff);
outer[--crcIndex] = (byte) (crc32 >> 24);
// Use table
TableData = outer;
}
// Send table
target.SendTable( ref Counter, PID, TableData );
}