Esempio n. 1
0
 private void ScanSourceThread(GallerySource source, bool reScan)
 {
     try
     {
         using (GalleryDatabase database = GalleryDatabase.Open(Gallery.FilePath, Gallery.EncryptionAlgorithm, Gallery.Password, true))
         {
             database.RegisterStreamProvider <Gallery>(GalleryMetadataStreamProvider);
             database.RegisterStreamProvider <MediaFile>(MediaFileStreamProvider);
             FileSystemHandler.ScanFolders(database, source, reScan);
             source.ScanDate = DateTime.Now;
             source.UpdateMediaCount();
             database.UpdateEntry(GALLERY_FILE_NAME, string.Empty, Gallery, true);
             database.Save();
         }
         RaiseDatabaseOperationCompletedEvent(OperationType.ScanSource);
     }
     catch (Exception ex)
     {
         CommonWorker.ShowError(ex);
     }
 }
Esempio n. 2
0
        public void AddSource()
        {
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()
            {
                Description = "Please select a source root folder..."
            };

            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                GallerySource source = new GallerySource(folderBrowserDialog.SelectedPath, Gallery);
                if (Gallery.AddSource(source))
                {
                    using (GalleryDatabase database = GalleryDatabase.Open(Gallery.FilePath, Gallery.EncryptionAlgorithm, Gallery.Password, true))
                    {
                        database.RegisterStreamProvider <Gallery>(GalleryMetadataStreamProvider);
                        database.UpdateEntry(GALLERY_FILE_NAME, string.Empty, Gallery, true);
                        database.Save();
                    }
                    FolderAdded(source.RootFolder);
                }
            }
        }