private bool UpdateGrabberDetails(string channelId, string grabberId) { tbChannelName.Text = null; tbGrabSite.Text = null; tbGrabDays.Text = null; if (channelId != null && grabberId != null) { tbChannelName.Tag = channelId; ChannelConfigInfo info = (ChannelConfigInfo)_hChannelConfigInfo[channelId]; if (info != null) { tbChannelName.Text = info.FullName; Log.Info("WebEPG Config: Selection: {0}", info.FullName); GrabberConfigInfo gInfo = (GrabberConfigInfo)info.GrabberList[grabberId]; if (gInfo != null) { tbGrabSite.Text = gInfo.GrabberName; //tbGrabSite.Tag = gInfo.GrabberID; tbGrabDays.Text = gInfo.GrabDays.ToString(); return(true); } else { tbGrabSite.Text = "(Unknown)"; } } } return(false); }
private void GetGrabbers(ref TreeNode Main, string Location) { DirectoryInfo dir = new DirectoryInfo(Location); Log.Debug("WebEPG Config: Directory: {0}", Location); GrabberConfigInfo gInfo; foreach (FileInfo file in dir.GetFiles("*.xml")) { gInfo = new GrabberConfigInfo(); //XmlDocument xml = new XmlDocument(); GrabberConfigFile grabberXml; try { Log.Debug("WebEPG Config: File: {0}", file.Name); XmlSerializer s = new XmlSerializer(typeof (GrabberConfigFile)); TextReader r = new StreamReader(file.FullName); grabberXml = (GrabberConfigFile)s.Deserialize(r); } catch (Exception) { Log.Info("WebEPG Config: File open failed - XML error"); return; } gInfo.GrabDays = grabberXml.Info.GrabDays; string GrabberSite = file.Name.Replace(".xml", ""); GrabberSite = GrabberSite.Replace("_", "."); gInfo.GrabberID = file.Directory.Name + "\\" + file.Name; gInfo.GrabberName = GrabberSite; gInfo.Country = file.Directory.Name; hGrabberConfigInfo.Add(gInfo.GrabberID, gInfo); if (CountryList[file.Directory.Name] == null) { CountryList.Add(file.Directory.Name, new SortedList()); } TreeNode gNode = new TreeNode(GrabberSite); Main.Nodes.Add(gNode); //XmlNode cl=sectionList.Attributes.GetNamedItem("ChannelList"); foreach (ChannelInfo channel in grabberXml.Channels) { if (channel.id != null) { ChannelConfigInfo info = (ChannelConfigInfo)hChannelConfigInfo[channel.id]; if (info != null) // && info.GrabberList[gInfo.GrabberID] != null) { TreeNode tNode = new TreeNode(info.FullName); tNode.Tag = new GrabberSelectionInfo(info.ChannelID, gInfo.GrabberID); gNode.Nodes.Add(tNode); if (info.GrabberList == null) { info.GrabberList = new SortedList(); } if (info.GrabberList[gInfo.GrabberID] == null) { info.GrabberList.Add(gInfo.GrabberID, gInfo); } } else { info = new ChannelConfigInfo(); info.ChannelID = channel.id; info.FullName = info.ChannelID; info.GrabberList = new SortedList(); info.GrabberList.Add(gInfo.GrabberID, gInfo); hChannelConfigInfo.Add(info.ChannelID, info); TreeNode tNode = new TreeNode(info.FullName); tNode.Tag = new GrabberSelectionInfo(info.ChannelID, gInfo.GrabberID); gNode.Nodes.Add(tNode); } } } } }