public void removeImage(string imageName) { tagOrganizer.removeAllTags(imageName); foreach (XmlElement node in imageRoot.ChildNodes) { if (node.GetAttribute("name").Equals(imageName)) { imageRoot.RemoveChild(node); break; } } imageDoc.Save(Constants.FILE_IMAGES); }
/// <summary> /// Removes the specified SourceImage object from the XML file specified in Constants.FILE_IMAGES. /// All for the image are also removed, using the TagOrganizer. /// </summary> /// <param name="imageName">The name of the file to be removed, including file extension.</param> public void removeImage(string imageName) { //remove all tags for the image from the TagOrganizer tagOrganizer.removeAllTags(imageName); //loop until correct image is found foreach (XmlElement node in imageRoot.ChildNodes) { //remove the correct image if (node.GetAttribute("name").Equals(imageName)) { imageRoot.RemoveChild(node); break; } } //save! imageDoc.Save(Constants.FILE_IMAGES); }