Esempio n. 1
0
        /// <summary>
        /// Generate a copy of this frequency.
        /// </summary>
        /// <returns>A new instance with the same properties as the old instance.</returns>
        public override TuningFrequency Clone()
        {
            CableFrequency newFrequency = new CableFrequency();

            base.Clone(newFrequency);

            newFrequency.FEC        = fec;
            newFrequency.SymbolRate = symbolRate;
            newFrequency.Modulation = modulation;

            return(newFrequency);
        }
Esempio n. 2
0
 /// <summary>
 /// Initialize a new instance of the TuningSpec class for a DVB cable frequency.
 /// </summary>
 /// <param name="frequency">The frequency to tune to.</param>
 public TuningSpec(CableFrequency frequency)
 {
     this.frequency = frequency;
     symbolRate = frequency.SymbolRate;
     fec = frequency.FEC;
     modulation = frequency.Modulation;
 }
Esempio n. 3
0
        internal void load(FileInfo fileInfo)
        {
            CableFrequency cableFrequency = null;
            XmlReader reader = null;

            XmlReaderSettings settings = new XmlReaderSettings();
            settings.IgnoreWhitespace = true;

            try
            {
                reader = XmlReader.Create(fileInfo.FullName, settings);
            }
            catch (IOException)
            {
                Logger.Instance.Write("Failed to open " + fileInfo.Name);
                return;
            }

            try
            {
                while (!reader.EOF)
                {
                    reader.Read();
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                            case "DVBCTuning":
                                if (cableFrequency != null)
                                    AddFrequency(cableFrequency);

                                cableFrequency = new CableFrequency();
                                cableFrequency.Provider = this;

                                break;
                            default:
                                if (cableFrequency != null)
                                    cableFrequency.load(reader);
                                break;
                        }
                    }
                }

                if (cableFrequency != null)
                    AddFrequency(cableFrequency);
            }
            catch (XmlException e)
            {
                Logger.Instance.Write("Failed to load file " + fileInfo.Name);
                Logger.Instance.Write("Data exception: " + e.Message);
            }
            catch (IOException e)
            {
                Logger.Instance.Write("Failed to load file " + fileInfo.Name);
                Logger.Instance.Write("I/O exception: " + e.Message);
            }

            if (reader != null)
                reader.Close();
        }
Esempio n. 4
0
        /// <summary>
        /// Generate a copy of this frequency.
        /// </summary>
        /// <returns>A new instance with the same properties as the old instance.</returns>
        public override TuningFrequency Clone()
        {
            CableFrequency newFrequency = new CableFrequency();
            base.Clone(newFrequency);

            newFrequency.FEC = fec;
            newFrequency.SymbolRate = symbolRate;
            newFrequency.Modulation = modulation;

            return (newFrequency);
        }
Esempio n. 5
0
        internal void load(FileInfo fileInfo)
        {
            CableFrequency cableFrequency = null;
            XmlReader      reader         = null;

            XmlReaderSettings settings = new XmlReaderSettings();

            settings.IgnoreWhitespace = true;

            try
            {
                reader = XmlReader.Create(fileInfo.FullName, settings);
            }
            catch (IOException)
            {
                Logger.Instance.Write("Failed to open " + fileInfo.Name);
                return;
            }

            try
            {
                while (!reader.EOF)
                {
                    reader.Read();
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                        case "DVBCTuning":
                            if (cableFrequency != null)
                            {
                                AddFrequency(cableFrequency);
                            }

                            cableFrequency          = new CableFrequency();
                            cableFrequency.Provider = this;

                            break;

                        default:
                            if (cableFrequency != null)
                            {
                                cableFrequency.load(reader);
                            }
                            break;
                        }
                    }
                }

                if (cableFrequency != null)
                {
                    AddFrequency(cableFrequency);
                }
            }
            catch (XmlException e)
            {
                Logger.Instance.Write("Failed to load file " + fileInfo.Name);
                Logger.Instance.Write("Data exception: " + e.Message);
            }
            catch (IOException e)
            {
                Logger.Instance.Write("Failed to load file " + fileInfo.Name);
                Logger.Instance.Write("I/O exception: " + e.Message);
            }

            if (reader != null)
            {
                reader.Close();
            }
        }