コード例 #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 void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                int nameLength = (int)byteData[lastIndex];
                lastIndex++;

                if (nameLength != 0)
                {
                    name = new MultipleString();
                    name.Process(byteData, lastIndex);
                    name.LogMessage();

                    lastIndex = name.Index;
                }

                graduatedScale = ((byteData[lastIndex] & 0x10) != 0);

                int valueCount = byteData[lastIndex] & 0x0f;
                lastIndex++;

                if (valueCount != 0)
                {
                    values = new Collection <RatingRegionValue>();

                    while (valueCount != 0)
                    {
                        RatingRegionValue value = new RatingRegionValue();
                        value.Process(byteData, lastIndex);
                        values.Add(value);

                        lastIndex = value.Index;
                        valueCount--;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Rating Region Dimension message is short"));
            }
        }
コード例 #2
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 void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                int nameLength = (int)byteData[lastIndex];
                lastIndex++;

                if (nameLength != 0)
                {
                    name = new MultipleString();
                    name.Process(byteData, lastIndex);
                    name.LogMessage();

                    lastIndex = name.Index;
                }

                graduatedScale = ((byteData[lastIndex] & 0x10) != 0);

                int valueCount = byteData[lastIndex] & 0x0f;
                lastIndex++;

                if (valueCount != 0)
                {
                    values = new Collection<RatingRegionValue>();

                    while (valueCount != 0)
                    {
                        RatingRegionValue value = new RatingRegionValue();
                        value.Process(byteData, lastIndex);
                        values.Add(value);

                        lastIndex = value.Index;
                        valueCount--;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The PSIP Rating Region Dimension message is short"));
            }
        }