Example #1
0
        private void LoadTree()
        {
            this.Cursor = Cursors.WaitCursor;
            tvTree.Nodes.Clear();
            Application.DoEvents();
            var CurrentTreeName = cboSelectTree.Text;

            CurrentDirectoryTree = CurrentComparison.FindTree(CurrentTreeName);
            CurrentDirectoryTree.CopyToTreeControl(tvTree, false);
            this.Cursor = Cursors.Arrow;
            Application.DoEvents();
        }
Example #2
0
        private void cboSelectLeftTree_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            tvLeftTree.Nodes.Clear();
            Application.DoEvents();
            var CurrentLeftTreeName = cboSelectLeftTree.Text;

            CurrentLeftDirectoryTree = CurrentComparison.FindTree(CurrentLeftTreeName);
            CurrentLeftDirectoryTree.CopyToTreeControl(tvLeftTree, labLeftDir, labLeftDirCount, labLeftDirCount, false);
            this.Cursor = Cursors.Arrow;
            Application.DoEvents();
        }
Example #3
0
        private void cboSelectComparison_SelectedIndexChanged(object sender, EventArgs e)
        {
            CurrentComparisonName = cboSelectComparison.Text;
            CurrentComparison     = SlynchyTrack.Project.FindComparison(CurrentComparisonName);
            CurrentComparison.Rescan();
            var anal = GetAnalysisForComp(CurrentComparison);

            LoadUncommonDirs(anal);
            LoadUncommonDirReport(anal);

            LoadUncommonFileDirs(anal);
            LoadDifferentFileDirs(anal);
        }
Example #4
0
        private void ReScanReAnalyzeReload()
        {
            var anal = GetAnalysisForComp(CurrentComparison);

            SlynchyTrack.AnalysisList.Remove(anal);
            CurrentComparison.Rescan();
            anal = GetAnalysisForComp(CurrentComparison);

            //Reload the form
            LoadUncommonDirs(anal);
            LoadUncommonDirReport(anal);

            //Other tabs need special treatment

            LoadTree();
        }
Example #5
0
        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);
        }
Example #6
0
        private void butCopyDifferentFiles_Click(object sender, EventArgs e)
        {
            var anal   = GetAnalysisForComp(CurrentComparison);
            var relDir = cboDifferentFileDirs.Text;

            //TODO: Notify if a source tree needs to be selected
            if (String.IsNullOrEmpty(cboSelectTree.Text))
            {
                return;
            }
            var sourceTree = CurrentComparison.FindTree(cboSelectTree.Text);

            foreach (var DFile in anal.DFiles)
            {
                if (DFile.RelDir.Equals(relDir))
                {
                    var fileName = DFile.FileName;
                    foreach (var spec in DFile.Specs)
                    {
                        if (spec.Tree.Equals(sourceTree))
                        {
                            var sourceFullPathName = sourceTree.GetFilePathName(relDir, fileName);
                            var sourceFileInfo     = sourceTree.GetFileInfo(relDir, fileName);
                            foreach (var tree in CurrentComparison.Directories)
                            {
                                if (!tree.Equals(sourceTree))
                                {
                                    var destPath         = tree.RootDirectoryPath + relDir;
                                    var destFullPathName = Path.Combine(destPath, fileName);
                                    File.Copy(sourceFullPathName, destFullPathName, true);
                                }
                            }
                        }
                    }
                }
            }

            ReScanReAnalyzeReload();

            //Clear the report, reload the file directories
            tbDifferentFilesInDir.Clear();
            anal = GetAnalysisForComp(CurrentComparison);
            LoadDifferentFileDirs(anal);
        }
Example #7
0
        private void butRemoveUncommonFiles_Click(object sender, EventArgs e)
        {
            var anal   = GetAnalysisForComp(CurrentComparison);
            var relDir = cboUncommonFileDirs.Text;

            //TODO: Notify if a source tree needs to be selected
            if (String.IsNullOrEmpty(cboSelectTree.Text))
            {
                return;
            }
            var sourceTree = CurrentComparison.FindTree(cboSelectTree.Text);

            //If an uncommon file is in the source tree, remove it from all trees
            foreach (var UFile in anal.UFiles)
            {
                if (UFile.RelDir.Equals(relDir))
                {
                    var fileName = UFile.FileName;
                    if (UFile.InTrees.Contains(sourceTree))
                    {
                        var sourceRelPathName  = sourceTree.GetFilePathName(relDir, fileName);
                        var sourceFullPathName = sourceTree.RootDirectoryPath + sourceRelPathName;
                        foreach (var tree in CurrentComparison.Directories)
                        {
                            //does file exist in this tree?
                            var checkFullPathName = tree.RootDirectoryPath + sourceRelPathName;
                            if (File.Exists(checkFullPathName))
                            {
                                File.Delete(checkFullPathName);
                            }
                        }
                    }
                }
            }
            ReScanReAnalyzeReload();

            //Clear the report, reload the file directories
            tbUncommonFilesinDir.Clear();
            anal = GetAnalysisForComp(CurrentComparison);
            LoadUncommonFileDirs(anal);
        }
Example #8
0
        private void butCopyUncommonFiles_Click(object sender, EventArgs e)
        {
            var anal   = GetAnalysisForComp(CurrentComparison);
            var relDir = cboUncommonFileDirs.Text;

            //TODO: Notify if a source tree needs to be selected
            if (String.IsNullOrEmpty(cboSelectTree.Text))
            {
                return;
            }
            var sourceTree = CurrentComparison.FindTree(cboSelectTree.Text);

            //If an uncommon file is in the source tree, copy it to other trees
            foreach (var UFile in anal.UFiles)
            {
                if (UFile.RelDir.Equals(relDir))
                {
                    var fileName = UFile.FileName;
                    if (UFile.InTrees.Contains(sourceTree))
                    {
                        var sourceFullPathName = sourceTree.GetFilePathName(relDir, fileName);
                        foreach (var DestTree in UFile.NotInTrees)
                        {
                            var destPath         = DestTree.RootDirectoryPath + relDir + "\\";
                            var destFullPathName = Path.Combine(destPath, fileName);
                            File.Copy(sourceFullPathName, destFullPathName);
                        }
                    }
                }
            }
            ReScanReAnalyzeReload();

            //Clear the report, reload the file directories
            tbUncommonFilesinDir.Clear();
            anal = GetAnalysisForComp(CurrentComparison);
            LoadUncommonFileDirs(anal);
        }