Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            string            path = @"C:\Users\Vitaliy_Dryha\Desktop\C# Anton";
            FileSystemVisitor fileSystemVisitor = new FileSystemVisitor("txt");

            SearchStart  searchStart  = new SearchStart();
            SearchFinish searchFinish = new SearchFinish();

            fileSystemVisitor.SearchStarted  += searchStart.OnSearchStarted;
            fileSystemVisitor.SearchFinished += searchFinish.OnSearchFinished;

            foreach (var dirOrFile in fileSystemVisitor.GetAllDirectoriesAndFiles(path).Where(dir => dir.Contains(fileSystemVisitor.Filter)))
            {
                Console.WriteLine(dirOrFile);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string            path = @"C:\Users\Vitaliy_Dryha\Desktop\C# Anton";
            FileSystemVisitor fileSystemVisitor = new FileSystemVisitor(MyFilter);

            fileSystemVisitor.SearchStarted  += OnSearchStarted;
            fileSystemVisitor.SearchFinished += OnSearchFinished;

            fileSystemVisitor.EntryFound         += OnEntryFound;
            fileSystemVisitor.FilteredEntryFound += OnFilteredEntryFound;


            foreach (var dirOrFile in fileSystemVisitor.GetAllDirectoriesAndFiles(path))
            {
                Console.WriteLine(dirOrFile);
            }
        }