當前位置: 首頁>>代碼示例>>C#>>正文


C# FileSystem.ListDirectory方法代碼示例

本文整理匯總了C#中System.IO.FileSystem.ListDirectory方法的典型用法代碼示例。如果您正苦於以下問題:C# FileSystem.ListDirectory方法的具體用法?C# FileSystem.ListDirectory怎麽用?C# FileSystem.ListDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.IO.FileSystem的用法示例。


在下文中一共展示了FileSystem.ListDirectory方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BindFileGrid

        private void BindFileGrid()
        {
            FileSystem fs = new FileSystem(Globals.CurrentIdentity);
            string path = GetCurrentPath();
            if (path == null) return;

            CFile file = fs.GetFile(path);
            CFile.FileList dirlist;
            try {
                dirlist = fs.ListDirectory(file);
            } catch (CustomException er) {
                dirlist = new CFile.FileList();
                DisplayMessage(er.Message);
            }

            dirlist.Insert(0, file);

            m_curdir = file;
            dgFiles.DataSource = dirlist;
            dgFiles.DataBind();
        }
開發者ID:padilhalino,項目名稱:FrontDesk,代碼行數:21,代碼來源:filebrowser.ascx.cs

示例2: UpdateTreeNode

        protected void UpdateTreeNode(TreeNode node, bool fullreload)
        {
            FileSystem fs = new FileSystem(Globals.CurrentIdentity);
            CFile dir;

            dir = fs.GetFile(node.NodeData);
            if (fullreload) node.Nodes.Clear();
            if (node.Nodes.Count == 0) {

                CFile.FileList dirlist;
                try {
                    dirlist = fs.ListDirectory(dir);
                } catch (CustomException er) {
                    DisplayMessage(er.Message); return;
                }

                if (dirlist.Count > 0)
                    AddToTreeNode(node, dirlist);
            }
        }
開發者ID:padilhalino,項目名稱:FrontDesk,代碼行數:20,代碼來源:filebrowser.ascx.cs

示例3: LoadCourseNode

        private void LoadCourseNode(TreeNode par, int courseID)
        {
            FileSystem fs = new FileSystem(Globals.CurrentIdentity);
            Courses courseda = new Courses(Globals.CurrentIdentity);
            Course course = courseda.GetInfo(courseID);

            par.Nodes.Clear();
            //Load announcement folder
            if (!StudentMode)
                AddAnnFolderNode(par.Nodes, courseID);

            //Load content
            CFile.FileList cdir = fs.ListDirectory(fs.GetFile(course.ContentID));
            foreach (CFile file in cdir) {
                if (file.IsDirectory())
                    AddFolderNode(par.Nodes, file);
                else
                    AddDocumentNode(par.Nodes, file);
            }

            //Load assignments
            Assignment.AssignmentList assts;
            if (StudentMode)
                assts = courseda.GetStudentAssignments(courseID);
            else
                assts = courseda.GetAssignments(courseID);
            foreach (Assignment asst in assts)
                AddAsstNode(par.Nodes, asst);

            //Add section folder
            if (!StudentMode) {
                AddBackupsNode(par.Nodes, courseID);
                AddSectionFolderNode(par.Nodes, courseID, "Users and Sections");
                AddPermNode(par.Nodes, courseID);
            }
        }
開發者ID:padilhalino,項目名稱:FrontDesk,代碼行數:36,代碼來源:coursematrix.ascx.cs

示例4: LoadFolderNode

        private void LoadFolderNode(TreeNode par, int fileID)
        {
            FileSystem fs = new FileSystem(Globals.CurrentIdentity);
            par.Nodes.Clear();
            CFile.FileList cdir;

            try {
                cdir = fs.ListDirectory(fs.GetFile(fileID));
            } catch (CustomException er) {
                PageError(er.Message); return;
            }

            foreach (CFile file in cdir) {
                if (file.IsDirectory())
                    AddFolderNode(par.Nodes, file);
                else
                    AddDocumentNode(par.Nodes, file);
            }
        }
開發者ID:padilhalino,項目名稱:FrontDesk,代碼行數:19,代碼來源:coursematrix.ascx.cs

示例5: LoadAsstNode

        private void LoadAsstNode(TreeNode par, int asstID)
        {
            FileSystem fs = new FileSystem(Globals.CurrentIdentity);
            Assignments asstda = new Assignments(Globals.CurrentIdentity);
            Assignment asst = asstda.GetInfo(asstID);

            //Load content
            par.Nodes.Clear();
            CFile.FileList cdir = fs.ListDirectory(fs.GetFile(asst.ContentID));
            foreach (CFile file in cdir) {
                if (file.IsDirectory())
                    AddFolderNode(par.Nodes, file);
                else
                    AddDocumentNode(par.Nodes, file);
            }

            if (StudentMode) {
                AddSubFolderNode(par.Nodes, asstID);
                AddGroupFolderNode(par.Nodes, asstID);
                AddCompetitionNode(par.Nodes, asstID);
                AddResFolderNode(par.Nodes, asstID);
            }
            else {
                //Load rubric
                Rubric rub = asstda.GetRubric(asstID);
                AddRubricNode(par.Nodes, rub);

                AddFeedbackNode(par.Nodes, asstID);
                AddAutoSysNode(par.Nodes, asstID);

                AddSectionFolderNode(par.Nodes, asst.CourseID, "Users and Sections");

                AddPermNode(par.Nodes, asstID);
            }
        }
開發者ID:padilhalino,項目名稱:FrontDesk,代碼行數:35,代碼來源:coursematrix.ascx.cs


注:本文中的System.IO.FileSystem.ListDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。