Пример #1
0
        /// <summary>
        /// Creates the instance by parsing the TvAudio node in the configuration file
        /// </summary>
        /// <param name="xmlNode">The TvAudio xml node</param>
        /// <returns>TvAudio instance</returns>
        public static TvAudio CreateInstance(XmlNode xmlNode)
        {
            TvAudio tvAudio = new TvAudio();

            if (xmlNode != null)
            {
                XmlNode        modeNode = xmlNode.SelectSingleNode("mode");
                TvAudioVariant mode;
                try
                {
                    mode = (TvAudioVariant)Int32.Parse(modeNode.InnerText);
                }
                catch
                {
                    tvAudio.Mode = TvAudioVariant.Unavailable;
                    return(tvAudio);
                }
                if (mode == TvAudioVariant.Normal)
                {
                    XmlNode nameNode      = xmlNode.SelectSingleNode("name");
                    XmlNode audioModeNode = xmlNode.SelectSingleNode("audioModes");
                    tvAudio.Name = nameNode.InnerText;
                    try
                    {
                        tvAudio.AudioModes = (TVAudioMode)Int32.Parse(audioModeNode.InnerText);
                    }
                    catch
                    {
                        return(tvAudio);
                    }
                }
            }
            return(tvAudio);
        }
Пример #2
0
        /// <summary>
        /// Creates the Graph instance which represents an analog graph
        /// </summary>
        /// <param name="xmlNode">The graph xml node</param>
        /// <returns>Graph instance</returns>
        public static Graph CreateInstance(XmlNode xmlNode)
        {
            Graph   graph        = new Graph();
            XmlNode tunerNode    = null;
            XmlNode tvAudioNode  = null;
            XmlNode crossbarNode = null;
            XmlNode captureNode  = null;
            XmlNode teletextNode = null;

            if (xmlNode != null)
            {
                tunerNode    = xmlNode.SelectSingleNode("tuner");
                tvAudioNode  = xmlNode.SelectSingleNode("tvAudio");
                crossbarNode = xmlNode.SelectSingleNode("crossbar");
                captureNode  = xmlNode.SelectSingleNode("capture");
                teletextNode = xmlNode.SelectSingleNode("teletext");
            }
            graph.Tuner    = Tuner.CreateInstance(tunerNode);
            graph.TvAudio  = TvAudio.CreateInstance(tvAudioNode);
            graph.Crossbar = Crossbar.CreateInstance(crossbarNode);
            graph.Capture  = Capture.CreateInstance(captureNode);
            graph.Teletext = Teletext.CreateInstance(teletextNode);
            return(graph);
        }
Пример #3
0
 /// <summary>
 /// Creates the instance by parsing the TvAudio node in the configuration file
 /// </summary>
 /// <param name="xmlNode">The TvAudio xml node</param>
 /// <returns>TvAudio instance</returns>
 public static TvAudio CreateInstance(XmlNode xmlNode)
 {
   TvAudio tvAudio = new TvAudio();
   if (xmlNode != null)
   {
     XmlNode modeNode = xmlNode.SelectSingleNode("mode");
     TvAudioVariant mode;
     try
     {
       mode = (TvAudioVariant)Int32.Parse(modeNode.InnerText);
     }
     catch
     {
       tvAudio.Mode = TvAudioVariant.Unavailable;
       return tvAudio;
     }
     if (mode == TvAudioVariant.Normal)
     {
       XmlNode nameNode = xmlNode.SelectSingleNode("name");
       XmlNode audioModeNode = xmlNode.SelectSingleNode("audioModes");
       tvAudio.Name = nameNode.InnerText;
       try
       {
         tvAudio.AudioModes = (TVAudioMode)Int32.Parse(audioModeNode.InnerText);
       }
       catch
       {
         return tvAudio;
       }
     }
   }
   return tvAudio;
 }