コード例 #1
0
ファイル: Drives.cs プロジェクト: LadyNoveria/fileManager
        //Получение доступных дисков
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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;
        }
コード例 #4
0
ファイル: Files.cs プロジェクト: LadyNoveria/fileManager
        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;
        }
コード例 #5
0
        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;
        }