Ejemplo n.º 1
0
        private async void btnStart_ClickAsync(object sender, EventArgs e)
        {
            List <FilesInfo> listfi = new List <FilesInfo>();
            await Task.Run(() =>
            {
                files = FastEnumerator.EnumerateFiles(txtPath.Text, "*", System.IO.SearchOption.TopDirectoryOnly, "OnlyDirectory").ToList();



                foreach (var item in files)
                {
                    FilesInfo f = new FilesInfo();
                    f.Type      = item.Attributes.ToString();
                    f.Name      = item.Name;

                    System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(item.Path);
                    f.FilesCount     = GetFilesCount(dirInfo);
                    f.DirectoryCount = GetDirectoryCount(dirInfo);

                    listfi.Add(f);
                }
            });

            Bfiles = new BindingList <FilesInfo>(listfi);
            dataGridView1.DataSource = Bfiles;
        }
        static void Main(string[] args)
        {
            List <FileData> files = FastEnumerator.EnumerateFiles(@"C:\Windows\System32", "*").ToList();

            Console.ReadKey();
        }