/// <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 { region = (int)byteData[lastIndex]; lastIndex++; int dimensionCount = (int)byteData[lastIndex]; lastIndex++; if (dimensionCount != 0) { dimensions = new Collection <ContentAdvisoryRatingDimension>(); while (dimensionCount != 0) { ContentAdvisoryRatingDimension dimension = new ContentAdvisoryRatingDimension(); dimension.Process(byteData, lastIndex); dimensions.Add(dimension); lastIndex = dimension.Index; dimensionCount--; } } int descriptionLength = (int)byteData[lastIndex]; lastIndex++; if (descriptionLength != 0) { description = new MultipleString(); description.Process(byteData, lastIndex); lastIndex = description.Index; } Validate(); } catch (IndexOutOfRangeException) { throw (new ArgumentOutOfRangeException("The PSIP Content Advisory Rating Region 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 void Process(byte[] byteData, int index) { lastIndex = index; try { region = (int)byteData[lastIndex]; lastIndex++; int dimensionCount = (int)byteData[lastIndex]; lastIndex++; if (dimensionCount != 0) { dimensions = new Collection<ContentAdvisoryRatingDimension>(); while (dimensionCount != 0) { ContentAdvisoryRatingDimension dimension = new ContentAdvisoryRatingDimension(); dimension.Process(byteData, lastIndex); dimensions.Add(dimension); lastIndex = dimension.Index; dimensionCount--; } } int descriptionLength = (int)byteData[lastIndex]; lastIndex++; if (descriptionLength != 0) { description = new MultipleString(); description.Process(byteData, lastIndex); lastIndex = description.Index; } Validate(); } catch (IndexOutOfRangeException) { throw (new ArgumentOutOfRangeException("The PSIP Content Advisory Rating Region message is short")); } }