Example #1
0
        public void grouper(AppForm form)
        {
            form.setProgressBar(0, AppForm.photos_count, 1);
            int total_directories = AppForm.directories.Count;
            int i = 0, j = 0;

            while (AppForm.directories.Count != 0)
            {
                i++;
                form.addLog("Directory " + i + "/" + total_directories);
                string path = AppForm.directories.Pop();
                IEnumerable <string> photo_list = findPhotos(path);
                int photos_in_current_dir       = photo_list.Count();
                foreach (string photo in photo_list)
                {
                    j++;
                    try
                    {
                        Bitmap bitmap = new Bitmap(photo);  //parametre exception
                        operation(AppForm.operation, photo, exifReader(bitmap));
                    }
                    catch (Exception e)
                    {
                        corruptFile(AppForm.operation, photo);
                    }
                    finally
                    {
                        form.addLog("   Completed " + j + "/" + photos_in_current_dir);
                        form.performStep();
                    }
                }
                j = 0;
            }
        }
Example #2
0
 public void findDirectories(string root_path)
 {
     try
     {
         var directories = Directory.EnumerateDirectories(root_path, "*", SearchOption.AllDirectories);
         form.setProgressBar(0, directories.Count() + 1, 1);
         foreach (var path in directories)
         {
             form.addLog("   " + path);
             AppForm.directories.Push(path);
             form.performStep();
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
     }
 }