PathFilter filters directories and files by full path name.
Наследование: IScanFilter
Пример #1
0
        static void ListZipFile(string fileName, string fileFilter, string directoryFilter)
        {
            using (ZipFile zipFile = new ZipFile(fileName)) {
                PathFilter localFileFilter = new PathFilter(fileFilter);
                PathFilter localDirFilter = new PathFilter(directoryFilter);
				
                if ( zipFile.Count == 0 ) {
                    Console.WriteLine("No entries to list");
                }
                else {
                    for ( int i = 0 ; i < zipFile.Count; ++i)
                    {
                        ZipEntry e = zipFile[i];
                        if ( e.IsFile ) {
                            string path = Path.GetDirectoryName(e.Name);
                            if ( localDirFilter.IsMatch(path) ) {
                                if ( localFileFilter.IsMatch(Path.GetFileName(e.Name)) ) {
                                    Console.WriteLine(e.Name);
                                }
                            }
                        }
                        else if ( e.IsDirectory ) {
                            if ( localDirFilter.IsMatch(e.Name) ) {
                                Console.WriteLine(e.Name);
                            }
                        }
                        else {
                            Console.WriteLine(e.Name);
                        }
                    }
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Initialise a new instance of <see cref="FileSystemScanner"></see>
 /// </summary>
 /// <param name="fileFilter">The <see cref="PathFilter">file filter</see> to apply.</param>
 /// <param name="directoryFilter">The <see cref="PathFilter"> directory filter</see> to apply.</param>
 public FileSystemScanner(string fileFilter, string directoryFilter)
 {
     fileFilter_      = new PathFilter(fileFilter);
     directoryFilter_ = new PathFilter(directoryFilter);
 }
Пример #3
0
 /// <summary>
 /// Initialise a new instance of <see cref="FileSystemScanner"></see>
 /// </summary>
 /// <param name="filter">The <see cref="PathFilter">file filter</see> to apply when scanning.</param>
 public FileSystemScanner(string filter)
 {
     fileFilter_ = new PathFilter(filter);
 }
Пример #4
0
 /// <summary>
 ///     Initialise a new instance of <see cref="FileSystemScanner"></see>
 /// </summary>
 /// <param name="fileFilter">The <see cref="PathFilter">file filter</see> to apply.</param>
 /// <param name="directoryFilter">The <see cref="PathFilter"> directory filter</see> to apply.</param>
 public FileSystemScanner(string fileFilter, string directoryFilter)
 {
     fileFilter_ = new PathFilter(fileFilter);
     directoryFilter_ = new PathFilter(directoryFilter);
 }
Пример #5
0
 /// <summary>
 ///     Initialise a new instance of <see cref="FileSystemScanner"></see>
 /// </summary>
 /// <param name="filter">The <see cref="PathFilter">file filter</see> to apply when scanning.</param>
 public FileSystemScanner(string filter)
 {
     fileFilter_ = new PathFilter(filter);
 }