/// <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); }
/// <summary> /// Creates the instance by parsing the Tuner node in the configuration file /// </summary> /// <param name="xmlNode">The Tuner xml node</param> /// <returns>Tuner instance</returns> public static Tuner CreateInstance(XmlNode xmlNode) { Tuner tuner = new Tuner(); if (xmlNode != null) { XmlNode nameNode = xmlNode.SelectSingleNode("name"); XmlNode videoPinNode = xmlNode.SelectSingleNode("videoPin"); XmlNode audioPinNode = xmlNode.SelectSingleNode("audioPin"); XmlNode radioModeNode = xmlNode.SelectSingleNode("radioMode"); try { tuner.VideoPin = Int32.Parse(videoPinNode.InnerText); tuner.AudioPin = Int32.Parse(audioPinNode.InnerText); tuner.RadioMode = (RadioMode)Int32.Parse(radioModeNode.InnerText); } catch { tuner.RadioMode = RadioMode.None; return tuner; } tuner.Name = nameNode.InnerText; } return tuner; }