Exemple #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 <FreeSatChannelInfoEntry>();

                    int length = Length - 2;

                    while (length > 0)
                    {
                        FreeSatChannelInfoEntry channelInfoEntry = new FreeSatChannelInfoEntry();
                        channelInfoEntry.Process(byteData, lastIndex);
                        if (channelInfoEntry.UserNumber != -1)
                        {
                            channelInfoEntries.Add(channelInfoEntry);
                        }

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

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The FreeSat 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<FreeSatChannelInfoEntry>();

                    int length = Length - 2;

                    while (length > 0)
                    {
                        FreeSatChannelInfoEntry channelInfoEntry = new FreeSatChannelInfoEntry();
                        channelInfoEntry.Process(byteData, lastIndex);
                        if (channelInfoEntry.UserNumber != -1)
                            channelInfoEntries.Add(channelInfoEntry);

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

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