static internal TreeNode Find(this TreeNode node, string url) { object o = node.Tag; if (o is ILogItem) { ILogItem li = o as ILogItem; if (li.GetUrl().Equals(url)) { return(node); } } foreach (TreeNode tn in node.Nodes) { TreeNode t = Find(tn, url); if (t != null) { return(t); } } return(null); }
void SetUrl() { TreeNode n = treeViewMain.SelectedNode; if (n == current) { return; } current = n; changeNode(n); if (n == null) { return; } if (log == null) { return; } if (n.Tag is ILogItem) { ILogItem d = n.Tag as ILogItem; string uid = d.GetUrl(); try { log.Url = uid; toolStripLabelSize.Text = "Length = " + d.GetLength(); toolStripLabelSize.Visible = true; } catch (Exception exception) { exception.ShowError(); } return; } toolStripLabelSize.Visible = false; }