//rename method private void rename() { if (ORGANIZEfavoritesTreeView.SelectedNode.Index >= 0) { String file = ""; RenameLink rl = new RenameLink(ORGANIZEfavoritesTreeView.SelectedNode.Text); TreeNode node = ORGANIZEfavoritesTreeView.SelectedNode; if (rl.ShowDialog() == DialogResult.OK) { node.Text = rl.newName.Text; if (ORGANIZEfavoritesTreeView.Nodes[0].Nodes.Contains(node)) { if (tree.Visible == true) { tree.Nodes[0].Nodes[node.Name].Text = rl.newName.Text; } file = linksXml; } else { if (tree.Visible == true) { tree.Nodes[node.Name].Text = rl.newName.Text; } file = favXml; } } XmlDocument myXml = new XmlDocument(); myXml.Load(file); foreach (XmlElement x in myXml.DocumentElement.ChildNodes) { if (x.GetAttribute("url").Equals(node.Name)) { x.InnerText = rl.newName.Text; break; } } myXml.Save(file); rl.Close(); } }
//renameFavorit method private void renameFavorit() { RenameLink rl = new RenameLink(name); if (rl.ShowDialog() == DialogResult.OK) { XmlDocument myXml = new XmlDocument(); myXml.Load(favXml); foreach (XmlElement x in myXml.DocumentElement.ChildNodes) { if (x.InnerText.Equals(name)) { x.InnerText = rl.newName.Text; break; } } favoritesTreeView.Nodes[adress].Text = rl.newName.Text; myXml.Save(favXml); } rl.Close(); }