public void Visit(FileCompareObject file, string[] currentPath) { XmlDocument xmlDoc = new XmlDocument(); for (int i = 0; i < currentPath.Length; i++) { if(currentPath[i].Contains(META_DIR)) continue; string xmlPath = Path.Combine(currentPath[i], METADATAPATH); if (!File.Exists(xmlPath)) continue; xmlDoc.Load(xmlPath); PopulateFileWithTodo(xmlDoc, file, i); xmlDoc.Save(xmlPath); } }
private FileCompareObject PopulateFileWithTodo(XmlDocument xmlDoc, FileCompareObject file, int counter) { XmlNode node = xmlDoc.SelectSingleNode(XPATH_EXPR + "/todo" + "[name='" + file.Name + "']"); if (node == null) return file; XmlNodeList childNodeList = node.ChildNodes; for (int i = 0; i < childNodeList.Count; i++) { XmlNode childNode = childNodeList[i]; if (childNode.Name.Equals(NODE_CHANGE_TYPE)) { if (node.InnerText.Equals(DELETE)) file.ToDoAction = ToDo.Delete; else if (node.InnerText.Equals(RENAME)) file.ToDoAction = ToDo.Rename; } } return file; }