/// <summary> /// This creates a subtree rooted at root containing all the nodes of /// root for which the Predicate returns true. root is modified such that /// the nodes (if not containers) are deleted from it. /// </summary> /// <param name="root">source tree</param> /// <param name="venn">node evaluation function</param> public ActionData(IActionData3 node, Predicate<ActionData> venn, ReadableContentRequest readContentDelegate) : this() { ActionData root = node as ActionData; if (root == null) return; myIC = root.myIC; rawContent = root.rawContent; streamProperties = root.streamProperties; tag = root.tag; RetrieveContent = readContentDelegate; filename = root.filename; displayname = root.displayname; List<ActionData> toRemove = new List<ActionData>(); uniqueID = root.uniqueID; foreach (ActionData c in root.Nested) { if (!venn(c) && c.nested.Count == 0) continue; if (c.nested.Count == 0) toRemove.Add(c); ActionData reassignedChild = new ActionData(c, venn, readContentDelegate); Nested.Add(reassignedChild); reassignedChild.parent = this; } foreach (ActionData c in toRemove) { root.Nested.Remove(c); } }
public ActionData(IContainer ic, ReadableContentRequest readContentDelegate) : this(ic, delegate(IContainer me) { return true; }, readContentDelegate) { }
public ActionData(IContainer ic, Predicate<IContainer> venn, ReadableContentRequest readContentDelegate) : this() { myIC = ic as File; filename = ic.FileName; RetrieveContent = readContentDelegate; if (myIC == null && ic is Workshare.FCS.Lite.Interface.File) { myIC = new File(ic as Workshare.FCS.Lite.Interface.File); } if (!string.IsNullOrEmpty(myIC.ContentId)) { try { uniqueID = new Guid(myIC.ContentId); } catch (System.FormatException fe) { Logger.LogInfo(fe); } } PopulateStream(); foreach (IContainer c in ic.Files) { if (!venn(c) && c.Files.Count == 0) continue; ActionData childNode = new ActionData(c, venn, readContentDelegate); childNode.parent = this; nested.Add(childNode); } }
public ActionExecuter(IProgressCallback callback) { _progressCallback = callback; GetReadableContent = new ReadableContentRequest(ReadableContent); }