Ejemplo n.º 1
0
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the MPEG2 section following the descriptor length.</param>
        internal override void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                if (Length != 2)
                {
                    channelInfoEntries = new Collection <FreeviewChannelInfoEntry>();

                    int length = Length - 2;

                    while (length > 0)
                    {
                        FreeviewChannelInfoEntry channelInfoEntry = new FreeviewChannelInfoEntry();
                        channelInfoEntry.Process(byteData, lastIndex);
                        channelInfoEntries.Add(channelInfoEntry);

                        lastIndex += channelInfoEntry.Length;
                        length    -= channelInfoEntry.Length;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The Freeview Channel Info Descriptor message is short"));
            }
        }
        /// <summary>
        /// Parse the descriptor.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the descriptor.</param>
        /// <param name="index">Index of the byte in the MPEG2 section following the descriptor length.</param>
        internal override void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                if (Length != 2)
                {
                    channelInfoEntries = new Collection<FreeviewChannelInfoEntry>();

                    int length = Length - 2;

                    while (length > 0)
                    {
                        FreeviewChannelInfoEntry channelInfoEntry = new FreeviewChannelInfoEntry();
                        channelInfoEntry.Process(byteData, lastIndex);
                        channelInfoEntries.Add(channelInfoEntry);

                        lastIndex += channelInfoEntry.Length;
                        length -= channelInfoEntry.Length;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The Freeview Channel Info Descriptor message is short"));
            }
        }