CodeTV.TransponderReader.PopulateChannelWithTransponderSettings C# (CSharp) Method

PopulateChannelWithTransponderSettings() public static method

public static PopulateChannelWithTransponderSettings ( ChannelTV &channel, string frequency ) : void
channel ChannelTV
frequency string
return void
        public static void PopulateChannelWithTransponderSettings(ref ChannelTV channel, string frequency)
        {
            string[] fields = frequency.Split(new char[] { ',' });
            if (channel is ChannelDVBT)
            {
                //Channelname,Frequency(KHz),Inversion(0,1),0,Bandwidth (7MHz=1, 8MHz=2)
                //C05,177.500,0,0,1
                ChannelDVBT channelDVBT = channel as ChannelDVBT;
                channelDVBT.Frequency = int.Parse(fields[1].Trim().Replace(".", ""));
                channelDVBT.Bandwidth = (fields[4].Trim() == "1" ? 7 : 8);

            }
            else if (channel is ChannelDVBC)
            {
                //Frequency(KHz), Symbolrate(Ks/s), QAM
                //50500,6900,0
                //57500,6900,64
                ChannelDVBC channelDVBC = channel as ChannelDVBC;
                channelDVBC.Frequency = int.Parse(fields[0].Trim().Replace(".", ""));
                channelDVBC.SymbolRate = int.Parse(fields[1].Trim());
                int modulation = int.Parse(fields[2].Trim());
                switch (modulation)
                {
                    case 0: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.ModNotSet; break;
                    case 16: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod16Qam; break;
                    case 32: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod32Qam; break;
                    case 64: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod64Qam; break;
                    case 80: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod80Qam; break;
                    case 96: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod96Qam; break;
                    case 112: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod112Qam; break;
                    case 128: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod128Qam; break;
                    case 160: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod160Qam; break;
                    case 192: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod192Qam; break;
                    case 224: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod224Qam; break;
                    case 256: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod256Qam; break;
                    case 320: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod320Qam; break;
                    case 384: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod384Qam; break;
                    case 448: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod448Qam; break;
                    case 512: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod512Qam; break;
                    case 640: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod640Qam; break;
                    case 768: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod768Qam; break;
                    case 896: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod896Qam; break;
                    case 1024: channelDVBC.Modulation = DirectShowLib.BDA.ModulationType.Mod1024Qam; break;
                }
            }
            else if (channel is ChannelDVBS)
            {
                //Frequecny,polarisation,symbol rate,FEC
                //11016,H, 6284,78
                ChannelDVBS channelDVBS = channel as ChannelDVBS;

                channelDVBS.Frequency = int.Parse(fields[0].Trim().Replace(".", ""));

                string polarisation = fields[1].Trim();
                if (polarisation == "H")
                    channelDVBS.SignalPolarisation = DirectShowLib.BDA.Polarisation.LinearH;
                else if (polarisation == "V")
                    channelDVBS.SignalPolarisation = DirectShowLib.BDA.Polarisation.LinearV;
                else if (polarisation == "L")
                    channelDVBS.SignalPolarisation = DirectShowLib.BDA.Polarisation.CircularL;
                else if (polarisation == "R")
                    channelDVBS.SignalPolarisation = DirectShowLib.BDA.Polarisation.CircularR;

                channelDVBS.SymbolRate = int.Parse(fields[2].Trim());
            }
        }

Usage Example

コード例 #1
0
 private void buttonOK_Click(object sender, EventArgs e)
 {
     if (this.listBoxFrequencies.SelectedItem != null)
     {
         if (this.channel != null)
         {
             string frequency = this.listBoxFrequencies.SelectedItem as string;
             TransponderReader.PopulateChannelWithTransponderSettings(ref this.channel, frequency);
         }
     }
 }
All Usage Examples Of CodeTV.TransponderReader::PopulateChannelWithTransponderSettings