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); } } }