Exemplo n.º 1
0
        private List <String> getFiles(string path)
        {
            List <String> pathName = new List <string>();

            DirectoryList.GetDirectory(path);
            //目录列表
            // foreach (string item in DirectoryList.DirectorysList)
            // {
            //     Console.WriteLine(item);
            // }
            //文件列表
            foreach (string item in DirectoryList.FileList)
            {
                pathName.Add(item);
            }

            return(pathName);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 读取文件名
        /// </summary>
        private void readFilePathList()
        {
            filePathList.Clear();
            DirectoryList.GetDirectory(filesPath_tb.Text);
            foreach (string item in DirectoryList.FileList)
            {
                filePathList.Add(item);
            }
            file_name_dg.Rows.Clear();
            foreach (String name in filePathList)
            {
                String[] path = name.Split('\\');

                DataGridViewRow dr = new DataGridViewRow();
                dr.CreateCells(file_name_dg);
                dr.Cells[0].Value = path[path.Length - 1];
                file_name_dg.Rows.Add(dr);
            }
        }