/// <summary> /// Helper method for GetStalePathArray(). /// </summary> private void GetStalePathArrayRecursive(List<string> _staleArray, KfsStaleTreeEntry _entry, String _path) { if (_entry.IsStale()) { _staleArray.Add(_path); return; } foreach (KfsStaleTreeEntry child in _entry.ChildTree.Values) { String cp = _path; if (cp != "") cp += "/"; cp += child.Name; GetStalePathArrayRecursive(_staleArray, child, cp); } }
/// <summary> /// Mark the path specified as stale. /// </summary> public void Add(String _path) { // If the root is already stale, stop. if (m_root != null && m_root.IsStale()) return; // Create the root if needed. if (m_root == null) { m_root = new KfsStaleTreeEntry(""); } // Split the path into individual components. String[] pathComponents = KfsPath.SplitRelativePath(_path); // Walk the tree until we find a stale entry or // we create the full path. KfsStaleTreeEntry component = m_root; foreach (String c in pathComponents) { // There is already an entry with that name. if (component.ChildTree.ContainsKey(c)) { component = component.ChildTree[c]; // The entry is stale, so stop here. if (component.IsStale()) return; } else { // No entry exist with that name, so create it. KfsStaleTreeEntry newEntry = new KfsStaleTreeEntry(c); component.ChildTree.Add(c, newEntry); component = newEntry; } } component.MarkStale(); }
/// <summary> /// Clear all entries from the tree. /// </summary> public void Clear() { m_root = null; }
public KfsStaleTree(KfsStaleTreeEntry _entry) { m_root = _entry; }