UpdateDVBChannelPids() static private method

static private UpdateDVBChannelPids ( IMpeg2Data mpeg2Data, ushort pmtPid, ChannelDVB channelDVB ) : void
mpeg2Data IMpeg2Data
pmtPid ushort
channelDVB ChannelDVB
return void
        private void buttonChannelUpdatePid_Click(object sender, EventArgs e)
        {
            if (this.propertyGridChannel.SelectedObject is ChannelDVB)
            {
                ChannelDVB           currentChannelTV = this.propertyGridChannel.SelectedObject as ChannelDVB;
                ChannelDVB.VideoType videoType        = currentChannelTV.VideoDecoderType;
                if (videoType != ChannelDVB.VideoType.MPEG2)
                {
                    currentChannelTV.VideoDecoderType = ChannelDVB.VideoType.MPEG2;
                }
                MainForm.TuneChannelGUI(currentChannelTV);
                if (MainForm.GraphBuilder is GraphBuilderBDA)
                {
                    IMpeg2Data mpeg2Data = (MainForm.GraphBuilder as GraphBuilderBDA).SectionsAndTables as IMpeg2Data;
                    if (mpeg2Data == null)
                    {
                        MessageBox.Show(Properties.Resources.CannotUpdatePidChannel);
                        return;
                    }

                    PSISection[] psis = PSISection.GetPSITable((int)PIDS.PAT, (int)TABLE_IDS.PAT, mpeg2Data);
                    for (int i = 0; i < psis.Length; i++)
                    {
                        PSISection psi = psis[i];
                        if (psi != null && psi is PSIPAT)
                        {
                            PSIPAT pat = (PSIPAT)psi;
                            Trace.WriteLineIf(MainForm.trace.TraceVerbose, "PSI Table " + i + "/" + psis.Length + "\r\n");
                            Trace.WriteLineIf(MainForm.trace.TraceVerbose, pat.ToString());

                            foreach (PSIPAT.Data program in pat.ProgramIds)
                            {
                                if (program.ProgramNumber == currentChannelTV.SID)
                                {
                                    WizardForm.UpdateDVBChannelPids(mpeg2Data, program.Pid, currentChannelTV);
                                    this.propertyGridChannel.SelectedObject = currentChannelTV;
                                    if (videoType != ChannelDVB.VideoType.MPEG2)
                                    {
                                        currentChannelTV.VideoDecoderType = videoType;
                                    }
                                    MainForm.TuneChannelGUI(currentChannelTV);
                                    return;
                                }
                            }
                        }
                    }
                }
            }
        }