public void LoadPhotoDatabase(bool createFresh) { if (photo_database == null && ModelInfo.PhotosSupported) { photo_database = new PhotoDatabase(this, true, createFresh); } }
internal Album(AlbumRecord record, PhotoDatabase db) { this.record = record; photos = new List <Photo> (); foreach (AlbumItemRecord item in record.Items) { Photo photo = db.LookupPhotoById(item.Id); photos.Add(photo); } }
internal Photo(ImageItemRecord item, PhotoDatabase db) { this.item = item; this.db = db; foreach (ImageNameRecord name in item.Names) { try { thumbnails.Add(new Thumbnail(this, name)); } catch (Exception e) { Console.Error.WriteLine("ipod-sharp: Failed to read thumbnail: " + e.Message); } } }
public void Save() { if (track_database != null) { TrackDatabase.Save(); } if (photo_database != null) { PhotoDatabase.Save(); } // nothing more to do if (equalizers == null) { return; } string backup_path = String.Format("{0}.bak", EqualizerDatabasePath); try { // Back up the eq db if (File.Exists(EqualizerDatabasePath)) { File.Copy(EqualizerDatabasePath, backup_path, true); } // Save the eq db using (BinaryWriter writer = new BinaryWriter(new FileStream(EqualizerDatabasePath, FileMode.Create))) { equalizer_container_record.Save(writer); } } catch (Exception e) { // restore the backup File.Copy(backup_path, EqualizerDatabasePath, true); throw e; } }