Ejemplo n.º 1
0
        private void processChannelSections(Collection<Mpeg2Section> sections)
        {
            foreach (Mpeg2Section section in sections)
            {
                if (RunParameters.Instance.DebugIDs.Contains("SIEHFERNBLOCKS"))
                    Logger.Instance.Dump("Siehfern Block", section.Data, section.Data.Length);

                try
                {
                    Mpeg2ExtendedHeader mpeg2Header = new Mpeg2ExtendedHeader();
                    mpeg2Header.Process(section.Data);
                    if (mpeg2Header.Current)
                    {
                        if (mpeg2Header.TableIDExtension == 0x1502)
                        {
                            SiehFernInfoChannelSection channelSection = new SiehFernInfoChannelSection();
                            channelSection.Process(section.Data, mpeg2Header);
                            channelSection.LogMessage();

                            bool added = SiehFernInfoChannelSection.AddSection(channelSection);
                            if (added)
                            {
                                if (RunParameters.Instance.DebugIDs.Contains("SIEHFERNCHANNELBLOCKS"))
                                    Logger.Instance.Dump("Siehfern Info Block Type 0x" + mpeg2Header.TableIDExtension.ToString("X"), section.Data, section.Data.Length);
                            }
                        }
                    }
                }
                catch (ArgumentOutOfRangeException e)
                {
                    Logger.Instance.Write("<e> Error processing SiehFern Info Channel section: " + e.Message);
                }
            }
        }
        internal static bool AddSection(SiehFernInfoChannelSection newSection)
        {
            if (sections == null)
                sections = new Collection<SiehFernInfoChannelSection>();

            foreach (SiehFernInfoChannelSection oldSection in sections)
            {
                if (oldSection.SequenceNumber == newSection.SequenceNumber)
                    return (false);

                if (oldSection.SequenceNumber > newSection.SequenceNumber)
                {
                    sections.Insert(sections.IndexOf(oldSection), newSection);
                    return (true);
                }
            }

            sections.Add(newSection);

            return (true);
        }