private void SetUpNodeOnTree(DirTreeNode currentDirTreeNode) { currentDirTreeNode.SetDirectories(); currentDirTreeNode.SetFilePaths(); currentDirTreeNode.SetAttributes(); foreach (DirTreeNode node in currentDirTreeNode.Directories) { SetUpNodeOnTree(node); } }
public DirTree(string rootDirPathPassed) { rootDirPath = rootDirPathPassed; root = new DirTreeNode(rootDirPath); }
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(); }
public void AssembleDirTreeText(DirTreeNode dirTreeNode) { dirTreeText.Length = 0; CheckAgainstMaximumPathDisplayLength(dirTreeNode); AppendInfoIntoDirTreeText(dirTreeNode); }
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(); }
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); } } } }