public static void deleteEntryHelper(Queue<History> historyQueue, Entry entry, EntryElement e) { EntryElement[] folderList = e.getDirectories(); EntryElement[] fileList = e.getFiles(); foreach (EntryElement d in folderList) { deleteEntry(historyQueue, entry, d); historyQueue.Enqueue(e.removeChild(d)); } string date = string.Format("{0:yyyy-MM-dd}", DateTime.Now); foreach (EntryElement f in fileList) { string[] ext = f.FILENAME.Split('.'); if (ext.Length > 1) entry.addMetaData(ext.Last(), e.File); entry.addMetaData(date, e.File); historyQueue.Enqueue(e.removeChild(f)); } }
public static EntryElement findParentByID(EntryElement root, EntryElement e) { EntryElement[] files = root.getFiles(); EntryElement[] dirs = root.getDirectories(); foreach (EntryElement f in files) { if (root.File.ID == f.File.ID) return root; } EntryElement result = null; foreach (EntryElement d in dirs) { if (root.FILENAME != d.FILENAME) { result = findParentByID(d, e); if (result != null) break; }else{ return root; } } return result; }