private NodeEntries GetEntryNodesFromXML(XmlNode w, XmlNamespaceManager atomNsMgr) { NodeEntries entries = new NodeEntries(); XmlNodeList collectionList = w.SelectNodes("app:collection", atomNsMgr); if (collectionList == null) { System.Diagnostics.Debug.WriteLine("app:collection is null."); return(entries); } foreach (XmlNode n in collectionList) { var hrefAttr = n.Attributes["href"].Value; if (hrefAttr == null) { System.Diagnostics.Debug.WriteLine("href Attr is null."); continue; } XmlNode title = n.SelectSingleNode("atom:title", atomNsMgr); if (title == null) { System.Diagnostics.Debug.WriteLine("atom:title is null."); continue; } XmlNodeList acceptList = n.SelectNodes("app:accept", atomNsMgr); if (acceptList == null) { System.Diagnostics.Debug.WriteLine("app:accept is null."); continue; } foreach (XmlNode a in acceptList) { if (a.InnerText == "application/atom+xml;type=entry") { NodeEntryCollection entry = new NodeEntryCollection(title.InnerText, new Uri(hrefAttr)); entry.AcceptTypes.Add(a.InnerText); entries.Children.Add(entry); } else { // TODO. // application/atomcat+xml System.Diagnostics.Debug.WriteLine("app:accept type " + a.InnerText + " not implemented (yet)."); } } if (entries.Children.Count > 0) { entries.Expanded = true; } } return(entries); }
private void cmdLoadGenPath_Click(object sender, EventArgs e) { if (txtGenPaths.Text != "") { tvPath.Nodes.Clear(); String[] sep = { "\r\n" }; String[] paths = txtGenPaths.Text.Split(sep, StringSplitOptions.RemoveEmptyEntries); NodeEntryCollection nec = new NodeEntryCollection(); Array.Sort(paths); foreach (string s in paths) { if (s.StartsWith("generic") || s.StartsWith("Form")) { System.Diagnostics.Debug.Print("Skip " + s); } else { nec.AddEntry(s.Replace("\r", "").Replace("\n", ""), 0); } } TreeNode tn; foreach (NodeEntry ne in nec.Values) { tn = new TreeNode(ne.Key); tvPath.Nodes.Add(tn); tn.Tag = ne.Data; AddPathChildren(tn, ne); } foreach (TreeNode c in tvPath.Nodes) { CheckChildren(c, true); } } else { MessageBox.Show("Загрузите список путей на предыдущей вкладке."); } }
public NodeEntry(string separator = NodeEntryCollection.DefaultSeparator) { Children = new NodeEntryCollection(separator); }