public ArchiveTask(DirectoryInfoCache workDir, Action<IEnumerable<FileInfo>, string> archive, string extension) { Archive = archive; var node = DirectoryInfoCache.Forest(workDir); _walker = node.Walker; Extension = extension; SourceExtension = ".html"; }
public void TestForest() { /* * a--b-+-d * | | * | +-e * c */ TreeForTest a = new TreeForTest(); TreeForTest b = new TreeForTest(); TreeForTest c = new TreeForTest(); TreeForTest d = new TreeForTest(); TreeForTest e= new TreeForTest(); a.Children.Add(b); a.Children.Add(c); b.Parent = a; c.Parent = a; b.Children.Add(d); b.Children.Add(e); d.Parent = b; e.Parent = b; ForestNode<TreeForTest> root = new ForestNode<TreeForTest>( ForestNode<TreeForTest>.Edge.Leading, a, (node, i) => node.Children[i], (node) => node.Parent, (node) => node.Children.Count, (node) => node.Parent == null ? 1 : node.Parent.Children.IndexOf(node)); ForestWalker<TreeForTest> walker = new ForestWalker<TreeForTest>(root); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode<TreeForTest>.Edge.Leading, a, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode<TreeForTest>.Edge.Leading, b, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode<TreeForTest>.Edge.Leading, d, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode<TreeForTest>.Edge.Trailing, d, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode<TreeForTest>.Edge.Leading, e, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode<TreeForTest>.Edge.Trailing, e, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode<TreeForTest>.Edge.Trailing, b, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode<TreeForTest>.Edge.Leading, c, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode<TreeForTest>.Edge.Trailing, c, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode<TreeForTest>.Edge.Trailing, a, walker.Current); Assert.IsFalse(walker.MoveNext()); }
public void StartSplit() { Abort = false; Current = StartDirectory; var root = DirectoryInfoCache.Forest(StartDirectory); _walker = root.Walker; _dirty.Clear(); WriteBlack(StartDirectory.FullName); SyncDirectoryInfoCacheToFileSystem(); }
public void TestForest() { /* * a--b-+-d * | | * | +-e * c */ TreeForTest a = new TreeForTest(); TreeForTest b = new TreeForTest(); TreeForTest c = new TreeForTest(); TreeForTest d = new TreeForTest(); TreeForTest e = new TreeForTest(); a.Children.Add(b); a.Children.Add(c); b.Parent = a; c.Parent = a; b.Children.Add(d); b.Children.Add(e); d.Parent = b; e.Parent = b; ForestNode <TreeForTest> root = new ForestNode <TreeForTest>( ForestNode <TreeForTest> .Edge.Leading, a, (node, i) => node.Children[i], (node) => node.Parent, (node) => node.Children.Count, (node) => node.Parent == null ? 1 : node.Parent.Children.IndexOf(node)); ForestWalker <TreeForTest> walker = new ForestWalker <TreeForTest>(root); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode <TreeForTest> .Edge.Leading, a, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode <TreeForTest> .Edge.Leading, b, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode <TreeForTest> .Edge.Leading, d, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode <TreeForTest> .Edge.Trailing, d, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode <TreeForTest> .Edge.Leading, e, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode <TreeForTest> .Edge.Trailing, e, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode <TreeForTest> .Edge.Trailing, b, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode <TreeForTest> .Edge.Leading, c, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode <TreeForTest> .Edge.Trailing, c, walker.Current); Assert.IsTrue(walker.MoveNext()); AssertNode(ForestNode <TreeForTest> .Edge.Trailing, a, walker.Current); Assert.IsFalse(walker.MoveNext()); }