コード例 #1
0
ファイル: DirTree.cs プロジェクト: aaronmcooke/Mono-Framework
        private void SetUpNodeOnTree(DirTreeNode currentDirTreeNode)
        {
            currentDirTreeNode.SetDirectories();
            currentDirTreeNode.SetFilePaths();
            currentDirTreeNode.SetAttributes();

            foreach (DirTreeNode node in currentDirTreeNode.Directories)
            {
                SetUpNodeOnTree(node);
            }
        }
コード例 #2
0
ファイル: DirTree.cs プロジェクト: aaronmcooke/Mono-Framework
 public DirTree(string rootDirPathPassed)
 {
     rootDirPath = rootDirPathPassed;
     root = new DirTreeNode(rootDirPath);
 }
コード例 #3
0
        private void AppendInfoIntoDirTreeText(DirTreeNode currentNode)
        {
            displayTab.TabIn();

            dirTreeText.Append(string.Empty.PadLeft(displayTab.Value, ' '));
            dirTreeText.Append(currentNode.DirName.PadRight(displayTab.Multiplier + maximumPathLength - displayTab.Value, ' '));
            dirTreeText.Append(currentNode.CreatedOn.ToString(dateTimeFormat) + string.Empty.PadRight(displayTab.Multiplier, ' '));
            dirTreeText.Append(currentNode.LastAccessed.ToString(dateTimeFormat) + string.Empty.PadRight(displayTab.Multiplier, ' '));
            dirTreeText.Append(currentNode.LastWritten.ToString(dateTimeFormat) + string.Empty.PadRight(displayTab.Multiplier, ' '));
            dirTreeText.AppendLine(currentNode.FilePaths.Count.ToString());

            foreach (DirTreeNode Item in currentNode.Directories)
            {
                AppendInfoIntoDirTreeText(Item);
            }

            displayTab.TabOut();
        }
コード例 #4
0
 public void AssembleDirTreeText(DirTreeNode dirTreeNode)
 {
     dirTreeText.Length = 0;
     CheckAgainstMaximumPathDisplayLength(dirTreeNode);
     AppendInfoIntoDirTreeText(dirTreeNode);
 }
コード例 #5
0
        private void CheckAgainstMaximumPathDisplayLength(DirTreeNode dirTreeNodePassed)
        {
            displayTab.TabIn();

            int pathLength = dirTreeNodePassed.DirName.PadLeft(dirTreeNodePassed.DirName.Length + displayTab.Value, ' ').Length;
            if (pathLength > maximumPathLength)
            {
                maximumPathLength = pathLength;
            }

            foreach (DirTreeNode node in dirTreeNodePassed.Directories)
            {
                CheckAgainstMaximumPathDisplayLength(node);
            }

            displayTab.TabOut();
        }
コード例 #6
0
        public void SetDirectories()
        {
            if (!dirPath.Equals(@"D:\System Volume Information"))
            {
                string[] directoryPaths = new string[0];
                try
                {
                    directoryPaths = Directory.GetDirectories(dirPath);
                }
                catch (Exception e)
                {
                    runLog.AppendLine(e.Message);
                    runLog.AppendLine(DirName);
                }

                for (int i = 0; i < directoryPaths.Length; i++)
                {
                    try
                    {
                        DirTreeNode newDirTreeNode = new DirTreeNode(directoryPaths[i]);
                        directories.Add(newDirTreeNode);
                    }
                    catch (Exception e)
                    {
                        runLog.AppendLine(e.Message);
                        runLog.AppendLine(DirName);
                    }
                }
            }
        }