Exemple #1
0
        /// <summary>
        /// Parse the summary data.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the summary data.</param>
        /// <param name="index">Index of the first byte of the summary data in the MPEG2 section.</param>
        internal void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                eventID    = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex += 4;

                unknown    = Utils.GetBytes(byteData, lastIndex, 3);
                lastIndex += 3;

                replayCount = (int)byteData[lastIndex];
                lastIndex++;

                if (replayCount != 0)
                {
                    replays = new Collection <MediaHighway1Replay>();

                    int repeatLoop = 0;

                    while (repeatLoop < replayCount)
                    {
                        MediaHighway1Replay replay = new MediaHighway1Replay();
                        replay.Process(byteData, lastIndex);
                        replays.Add(replay);

                        lastIndex = replay.Index;
                        repeatLoop++;
                    }
                }

                shortDescription = Utils.GetString(byteData, lastIndex, byteData.Length - lastIndex, true);
                lastIndex       += (byteData.Length - lastIndex);

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The MediaHighway1 Summary Data message is short"));
            }
            catch (OverflowException)
            {
                throw (new ArgumentOutOfRangeException("The MediaHighway1 Summary Data message cause an overflow exception"));
            }
            catch (ArithmeticException)
            {
                throw (new ArgumentOutOfRangeException("The MediaHighway1 Summary Data message cause an arithmetic exception"));
            }
        }
        /// <summary>
        /// Parse the summary data.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the summary data.</param>
        /// <param name="index">Index of the first byte of the summary data in the MPEG2 section.</param>
        internal void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                eventID = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex += 4;

                unknown = Utils.GetBytes(byteData, lastIndex, 3);
                lastIndex += 3;

                replayCount = (int)byteData[lastIndex];
                lastIndex++;

                if (replayCount != 0)
                {
                    replays = new Collection<MediaHighway1Replay>();

                    int repeatLoop = 0;

                    while (repeatLoop < replayCount)
                    {
                        MediaHighway1Replay replay = new MediaHighway1Replay();
                        replay.Process(byteData, lastIndex);
                        replays.Add(replay);

                        lastIndex = replay.Index;
                        repeatLoop++;
                    }
                }

                shortDescription = Utils.GetString(byteData, lastIndex, byteData.Length - lastIndex, true);
                lastIndex += (byteData.Length - lastIndex);

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The MediaHighway1 Summary Data message is short"));
            }
            catch (OverflowException)
            {
                throw (new ArgumentOutOfRangeException("The MediaHighway1 Summary Data message cause an overflow exception"));
            }
            catch (ArithmeticException)
            {
                throw (new ArgumentOutOfRangeException("The MediaHighway1 Summary Data message cause an arithmetic exception"));
            }
        }