intdel = null;
for (int i = 1; i <= intcount - intindex; i++)
{
//从选定节点向下的节点全部删除。
foreach (var cl in xmlFile.Elements("cdbm"))
{
if (cl.Value.ToString() == strcdbm[i - 1])
{
cl.Remove();
intdel = 1;
}
}
}
if (intdel == 1)
{
treeView1.Nodes.Remove(xdnode); //删除树形控件节点
}
//依次添加被删除元素以下所有元素和属性
for (int i = 1; i <= intcount - intindex - 1; i++)
{
XElement menu = new XElement("cdbm",
new XAttribute("cdmc", strcdmc[i]),
new XAttribute("zxml", strzxml[i]),
new XAttribute("sxbm", strsxbm[i]), strcdbm[i - 1]);
xmlFile.Add(menu);
}
xmlFile.Save(@"C:\XMLCdsj.xml");
string lc_xml = @"C:\XMLCdsj.xml";
Network network = new Network();
network.UploadFile(lc_xml,@"ftp://100.100.0.1/yhcd1/XMLCdsj.xml", "administrator", "1234567", false, 500);
MessageBox.Show("菜单项删除成功 !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
|