/// <summary> /// Parse the section. /// </summary> /// <param name="byteData">The MPEG2 section containing the section.</param> /// <param name="index">The index of the first byte of the data portion.</param> internal void Process(byte[] byteData, int index) { lastIndex = index; try { unknown = Utils.GetBytes(byteData, lastIndex, 1); lastIndex++; while (lastIndex < byteData.Length) { MediaHighwayChannelInfoEntry channelEntry = new MediaHighwayChannelInfoEntry(); channelEntry.Process(byteData, lastIndex); Channels.Add(channelEntry); lastIndex = channelEntry.Index; } } catch (IndexOutOfRangeException) { throw (new ArgumentOutOfRangeException("The MediaHighway1 Channel Section message is short")); } Validate(); }
/// <summary> /// Parse the section. /// </summary> /// <param name="byteData">The MPEG2 section containing the section.</param> /// <param name="index">The index of the first byte of the data portion.</param> /// <returns>True if the section is an MHW2 channel section; false otherwise.</returns> internal bool Process(byte[] byteData, int index) { lastIndex = index; if (byteData[lastIndex] != 0x00) { return(false); } try { fillBytes = Utils.GetBytes(byteData, lastIndex, 117); lastIndex += fillBytes.Length; channelCount = (int)byteData[lastIndex]; lastIndex++; int nameIndex = lastIndex + (8 * channelCount); while (Channels.Count < channelCount) { MediaHighwayChannelInfoEntry channelEntry = new MediaHighwayChannelInfoEntry(); channelEntry.Process(byteData, lastIndex, nameIndex); Channels.Add(channelEntry); lastIndex = channelEntry.Index; nameIndex = channelEntry.NameIndex; } } catch (IndexOutOfRangeException) { throw (new ArgumentOutOfRangeException("The MediaHighway2 Channel Section message is short")); } Validate(); return(true); }
/// <summary> /// Parse the section. /// </summary> /// <param name="byteData">The MPEG2 section containing the section.</param> /// <param name="index">The index of the first byte of the data portion.</param> /// <returns>True if the section is an MHW2 channel section; false otherwise.</returns> internal bool Process(byte[] byteData, int index) { lastIndex = index; if (byteData[lastIndex] != 0x00) return (false); try { fillBytes = Utils.GetBytes(byteData, lastIndex, 117); lastIndex += fillBytes.Length; channelCount = (int)byteData[lastIndex]; lastIndex++; int nameIndex = lastIndex + (8 * channelCount); while (Channels.Count < channelCount) { MediaHighwayChannelInfoEntry channelEntry = new MediaHighwayChannelInfoEntry(); channelEntry.Process(byteData, lastIndex, nameIndex); Channels.Add(channelEntry); lastIndex = channelEntry.Index; nameIndex = channelEntry.NameIndex; } } catch (IndexOutOfRangeException) { throw (new ArgumentOutOfRangeException("The MediaHighway2 Channel Section message is short")); } Validate(); return (true); }