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()
        {
            TerrestrialFrequency newFrequency = new TerrestrialFrequency();
            base.Clone(newFrequency);

            newFrequency.Bandwidth = bandwidth;

            return (newFrequency);
        }
        /// <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()
        {
            TerrestrialFrequency newFrequency = new TerrestrialFrequency();

            base.Clone(newFrequency);

            newFrequency.Bandwidth = bandwidth;

            return(newFrequency);
        }
Esempio n. 3
0
 /// <summary>
 /// Initialize a new instance of the TuningSpec class for a DVB errestrial frequency.
 /// </summary>
 /// <param name="frequency">The terrestrial frequency to tune to.</param>
 public TuningSpec(TerrestrialFrequency frequency)
 {
     this.frequency = frequency;
      bandwidth = frequency.Bandwidth;
 }
        internal void load(FileInfo fileInfo)
        {
            TerrestrialFrequency terrestrialFrequency = 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 "DVBTTuning":
                            if (terrestrialFrequency != null)
                            {
                                AddFrequency(terrestrialFrequency);
                            }

                            terrestrialFrequency          = new TerrestrialFrequency();
                            terrestrialFrequency.Provider = this;

                            break;

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

                if (terrestrialFrequency != null)
                {
                    AddFrequency(terrestrialFrequency);
                }
            }
            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. 5
0
        internal void load(FileInfo fileInfo)
        {
            TerrestrialFrequency terrestrialFrequency = 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 "DVBTTuning":
                                if (terrestrialFrequency != null)
                                    AddFrequency(terrestrialFrequency);

                                terrestrialFrequency = new TerrestrialFrequency();
                                terrestrialFrequency.Provider = this;

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

                if (terrestrialFrequency != null)
                    AddFrequency(terrestrialFrequency);
            }
            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();
        }