Exemple #1
0
 /// <summary>
 /// Start scanning and enumurating picking up any files with valid extensions
 /// </summary>
 public void Scan()
 {
     try
     {
         IEnumerable<string> files = Directory.EnumerateFiles(directory, "*.*", searchOption);
         foreach (string path in files)
         {
             switch (Path.GetExtension(path).ToLower())
             {
                 case ".jpg":
                 case ".jpeg":
                 case ".png":
                 case ".gif":
                 case ".tiff":
                     if (ImageFound != null)
                     {
                         ScannerEventArgs args = new ScannerEventArgs(path);
                         ImageFound.Invoke(this, args);
                     }
                     continue;
                 default:
                     continue;
             }
         }
     }
     catch (UnauthorizedAccessException)
     {
        //silently end operation
     }
 }
 private void scannerImageFound(Scanner scanner,ScannerEventArgs e)
 {
     if (!e.Handled && files.Count != batchSettings.MaxFiles)
     {
         e.NowHandled();
         files.Push(e.File);
         if (FileAdded != null)
             FileAdded.Invoke(this);
         if (files.Count == batchSettings.MaxFiles)
         {
             if (AtMaxCapacity != null)
                 AtMaxCapacity.Invoke(this);
         }
     }
 }