Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void DeleteProject (string projectName)
- {
- string ccConfigPath = ConfigurationManager.AppSettings["ConfigPath"];
- XmlDocument configDoc = new XmlDocument();
- configDoc.Load(ccConfigPath);
- XmlNodeList projectNodes = configDoc.GetElementsByTagName("project");
- for (int i = 0; i < projectNodes.Count; i++)
- {
- if (projectNodes[i].Attributes["name"] != null)
- {
- if (projectName == projectNodes[i].Attributes["name"].InnerText)
- {
- configDoc.RemoveChild(projectNodes[i]);
- configDoc.Save(ccConfigPath);
- }
- }
- }
- }
- XmlNode project = configDoc.SelectSingleNode("//project[@name='" + projectName + "']");
- project.ParentNode.RemoveChild(project);
- configDoc.RemoveChild(projectNodes[i]);
- projectNodes[i].parentNode.RemoveChild(projectNodes[i]);
- <Root>
- <Blah>
- <project>...</project>
- </Blah>
- </Root>
- configDoc.DocumentElement.RemoveChild(projectNodes[i]);
Add Comment
Please, Sign In to add comment