示例#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()
        {
            AtscFrequency newFrequency = new AtscFrequency();

            base.Clone(newFrequency);

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

            return(newFrequency);
        }
示例#2
0
 /// <summary>
 /// Initialize a new instance of the TuningSpec class for an ATSC frequency.
 /// </summary>
 /// <param name="frequency">The frequency to tune to.</param>
 public TuningSpec(AtscFrequency frequency)
 {
     this.frequency = frequency;
     symbolRate = frequency.SymbolRate;
     fec = frequency.FEC;
     modulation = frequency.Modulation;
     channelNumber = frequency.ChannelNumber;
 }
示例#3
0
        internal void load(FileInfo fileInfo)
        {
            AtscFrequency atscFrequency = null;
            XmlReader reader = null;

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

            try
            {
                reader = XmlReader.Create(fileInfo.FullName, settings);

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

                                atscFrequency = new AtscFrequency();
                                atscFrequency.Provider = this;

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

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

            if (reader != null)
                reader.Close();
        }
示例#4
0
        internal void load(FileInfo fileInfo)
        {
            AtscFrequency atscFrequency = null;
            XmlReader     reader        = null;

            XmlReaderSettings settings = new XmlReaderSettings();

            settings.IgnoreWhitespace = true;

            try
            {
                reader = XmlReader.Create(fileInfo.FullName, settings);

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

                            atscFrequency          = new AtscFrequency();
                            atscFrequency.Provider = this;

                            break;

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

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

            if (reader != null)
            {
                reader.Close();
            }
        }
示例#5
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()
        {
            AtscFrequency newFrequency = new AtscFrequency();
            base.Clone(newFrequency);

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

            return (newFrequency);
        }