//Получение доступных дисков private void GetDrives() { var drives = DriveInfo.GetDrives(); NodeLinkedList node = new NodeLinkedList(); for (int i = 0; i < drives.Length; i++) { node.AddNode(drives[i].RootDirectory.Name); } StartDrive = node; }
public NodeLinkedList GetCurrentList(NodeLinkedList drives, NodeLinkedList directories) { var currentList = new NodeLinkedList(); currentList.StartNode.Value = drives.StartNode.Value; var currentNode = directories.StartNode; int count = directories.GetCount(); for (int i = 0; i < count; i++) { currentList.AddNode(currentNode.Value); currentNode = currentNode.NextNode; } return(currentList); }
private void GetDirectories(NodeLinkedList drive) { var path = drive.StartNode.Value; var allDirectories = Directory.GetDirectories(path); var node = new NodeLinkedList(); for (int i = 0; i < allDirectories.Length; i++) { DirectoryInfo dir = new DirectoryInfo(allDirectories[i]); if ((dir.Attributes & FileAttributes.Hidden) == 0) { node.AddNode(allDirectories[i]); } } StartDirectory = node; }
private void GetListOfFiles(NodeLinkedList directory) { var path = directory.StartNode.Value; string[] allFiles = Directory.GetFiles(path); var node = new NodeLinkedList(); for (int i = 0; i < allFiles.Length; i++) { DirectoryInfo dir = new DirectoryInfo(allFiles[i]); if ((dir.Attributes & FileAttributes.Hidden) == 0) { node.AddNode(allFiles[i]); } } StartFiles = node; }
public void GetSubDirs(string path, int index) { //string indent = "\t"; //for (int i = 0; i < index; i++) //{ // indent += "\t"; //} var root = Directory.GetDirectories(path); var node = new NodeLinkedList(); foreach (var dir in root) { DirectoryInfo info = new DirectoryInfo(dir); if ((info.Attributes & FileAttributes.Hidden) == 0) { node.AddNode(dir); GetSubDirs(dir.ToString(), index + 1); } } SubDirectories = node; }