private Thumbnail GetThumbnail(ArtworkFormat format, bool createNew)
{
FindCoverPhoto ();
if (coverPhoto == null) {
if (!createNew)
return null;
if (db.ArtworkDatabase != null) {
coverPhoto = db.ArtworkDatabase.CreatePhoto ();
coverPhoto.Record.TrackId = record.DatabaseId;
record.RightSideArtworkId = coverPhoto.Id;
}
}
if (coverPhoto == null) {
return null;
}
Thumbnail thumbnail = coverPhoto.LookupThumbnail (format);
if (thumbnail == null && createNew) {
thumbnail = coverPhoto.CreateThumbnail ();
thumbnail.Format = format;
thumbnail.Width = format.Width;
thumbnail.Height = format.Height;
}
return thumbnail;
}