/// <summary> /// Creates the instance by parsing the Crossbar node in the configuration file /// </summary> /// <param name="xmlNode">The TvAudio xml node</param> /// <returns>TvAudio instance</returns> public static Crossbar CreateInstance(XmlNode xmlNode) { Crossbar crossbar = new Crossbar(); Dictionary <AnalogChannel.VideoInputType, int> videoPinMap = new Dictionary <AnalogChannel.VideoInputType, int>(); Dictionary <AnalogChannel.VideoInputType, int> videoPinRelatedAudioMap = new Dictionary <AnalogChannel.VideoInputType, int>(); Dictionary <AnalogChannel.AudioInputType, int> audioPinMap = new Dictionary <AnalogChannel.AudioInputType, int>(); crossbar.AudioPinMap = audioPinMap; crossbar.VideoPinMap = videoPinMap; crossbar.VideoPinRelatedAudioMap = videoPinRelatedAudioMap; if (xmlNode != null) { XmlNode nameNode = xmlNode.SelectSingleNode("name"); XmlNode videoOutNode = xmlNode.SelectSingleNode("videoOut"); XmlNode audiouOutNode = xmlNode.SelectSingleNode("audioOut"); try { crossbar.VideoOut = Int32.Parse(videoOutNode.InnerText); crossbar.AudioOut = Int32.Parse(audiouOutNode.InnerText); XmlNodeList videoPinList = xmlNode.SelectNodes("videoPin"); XmlNodeList audioPinList = xmlNode.SelectNodes("audioPin"); if (videoPinList != null) { foreach (XmlNode pin in videoPinList) { AnalogChannel.VideoInputType type = (AnalogChannel.VideoInputType)Int32.Parse(pin.Attributes["type"].Value); int index = Int32.Parse(pin.Attributes["index"].Value); int related = Int32.Parse(pin.Attributes["related"].Value); videoPinMap.Add(type, index); videoPinRelatedAudioMap.Add(type, related); } } if (audioPinList != null) { foreach (XmlNode pin in audioPinList) { AnalogChannel.AudioInputType type = (AnalogChannel.AudioInputType)Int32.Parse(pin.Attributes["type"].Value); int index = Int32.Parse(pin.Attributes["index"].Value); audioPinMap.Add(type, index); } } } catch { return(crossbar); } crossbar.Name = nameNode.InnerText; } return(crossbar); }
/// <summary> /// Creates the instance by parsing the Crossbar node in the configuration file /// </summary> /// <param name="xmlNode">The TvAudio xml node</param> /// <returns>TvAudio instance</returns> public static Crossbar CreateInstance(XmlNode xmlNode) { Crossbar crossbar = new Crossbar(); Dictionary<AnalogChannel.VideoInputType, int> videoPinMap = new Dictionary<AnalogChannel.VideoInputType, int>(); Dictionary<AnalogChannel.VideoInputType, int> videoPinRelatedAudioMap = new Dictionary<AnalogChannel.VideoInputType, int>(); Dictionary<AnalogChannel.AudioInputType, int> audioPinMap = new Dictionary<AnalogChannel.AudioInputType, int>(); crossbar.AudioPinMap = audioPinMap; crossbar.VideoPinMap = videoPinMap; crossbar.VideoPinRelatedAudioMap = videoPinRelatedAudioMap; if (xmlNode != null) { XmlNode nameNode = xmlNode.SelectSingleNode("name"); XmlNode videoOutNode = xmlNode.SelectSingleNode("videoOut"); XmlNode audiouOutNode = xmlNode.SelectSingleNode("audioOut"); try { crossbar.VideoOut = Int32.Parse(videoOutNode.InnerText); crossbar.AudioOut = Int32.Parse(audiouOutNode.InnerText); XmlNodeList videoPinList = xmlNode.SelectNodes("videoPin"); XmlNodeList audioPinList = xmlNode.SelectNodes("audioPin"); if (videoPinList != null) { foreach (XmlNode pin in videoPinList) { AnalogChannel.VideoInputType type = (AnalogChannel.VideoInputType)Int32.Parse(pin.Attributes["type"].Value); int index = Int32.Parse(pin.Attributes["index"].Value); int related = Int32.Parse(pin.Attributes["related"].Value); videoPinMap.Add(type, index); videoPinRelatedAudioMap.Add(type, related); } } if (audioPinList != null) { foreach (XmlNode pin in audioPinList) { AnalogChannel.AudioInputType type = (AnalogChannel.AudioInputType)Int32.Parse(pin.Attributes["type"].Value); int index = Int32.Parse(pin.Attributes["index"].Value); audioPinMap.Add(type, index); } } } catch { return crossbar; } crossbar.Name = nameNode.InnerText; } return crossbar; }
/// <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); }