private void butCopyUncommonDir_Click(object sender, EventArgs e) { //If a directory is selected and a source tree is selected, copy the directory, its files // and all subdirs and their files to the trees where this subdir does not exist. //Exclusions apply var anal = GetAnalysisForComp(CurrentComparison); var relDir = cboUncommonDirs.Text; UncommonDirectory UDir = null; foreach (var uDir in anal.UDirs) { if (uDir.RelDir.Equals(relDir)) { UDir = uDir; } } if (UDir != null) { if (String.IsNullOrEmpty(cboSelectTree.Text)) { //TODO: notify that source tree must be selected return; } var sourceTree = CurrentComparison.FindTree(cboSelectTree.Text); var sNode = sourceTree.GetDirectoryNode(relDir); foreach (var tree in UDir.NotInTrees) { //Make sure starting directory exists var destPath = tree.RootDirectoryPath + relDir; Directory.CreateDirectory(destPath); //Copy the tree sourceTree.CopyNodeTree(sNode, destPath); } } ReScanReAnalyzeReload(); //Clear the report, reload the file directories tbDirReport.Clear(); anal = GetAnalysisForComp(CurrentComparison); LoadUncommonDirs(anal); LoadUncommonDirReport(anal); }
public void GetUncommonSubDirs(SlynchyDirectory node, List <SlynchyDirectoryTree> otherTrees) { foreach (var snode in node.SubDirectoryInfoList) { if (!snode.Exclude) { var DirName = snode.RelativeDirectory(); var IsUnCommon = false; foreach (var tree in otherTrees) { if (!tree.RelDirectoryExists(DirName)) { IsUnCommon = true; } } if (IsUnCommon) { //Make sure directory isn't already in list if (!IsInUncommonDirList(DirName)) { //If not in list, add var uDir = new UncommonDirectory(); uDir.RelDir = DirName; UDirs.Add(uDir); foreach (var tree in otherTrees) { if (tree.RelDirectoryExists(DirName)) { uDir.InTrees.Add(tree); } else { uDir.NotInTrees.Add(tree); } } } } GetUncommonSubDirs(snode, otherTrees); } } //Get the uncommon and unmatched files GetUncommonUnmatchedFiles(node, otherTrees); }
private void butRemoveUncommonDir_Click(object sender, EventArgs e) { //If a directory is selected, delete the directory, its files // and all subdirs and their files in the trees where this subdir exists. var anal = GetAnalysisForComp(CurrentComparison); var relDir = cboUncommonDirs.Text; UncommonDirectory UDir = null; foreach (var uDir in anal.UDirs) { if (uDir.RelDir.Equals(relDir)) { UDir = uDir; } } if (UDir != null) { foreach (var tree in UDir.InTrees) { //Make sure directory exists var fullPath = tree.RootDirectoryPath + relDir; if (Directory.Exists(fullPath)) { Directory.Delete(fullPath, true); } } } ReScanReAnalyzeReload(); //Clear the report, reload the file directories tbDirReport.Clear(); anal = GetAnalysisForComp(CurrentComparison); LoadUncommonDirs(anal); LoadUncommonDirReport(anal); }