private MetaData extractPreviewImageFrom(LinkPreviewData data) { PreviewImageData result = _metaDataFactory.CreateNew(MetaDataType.PreviewImage) as PreviewImageData; result.Uri = _imageFilePathConverter.Convert(data.image).Uri; return(result); }
private PreviewImageData convertPreviewImageDataFrom(IDataReader reader) { Guid metaDataGuid = new Guid(Convert.ToString(reader[METADATA_ID])); string content = Convert.ToString(reader[METADATA_INHALT]); Uri uri = string.IsNullOrEmpty(content) ? null : new Uri(content); PreviewImageData result = new PreviewImageData(metaDataGuid, uri); result.ShowInPreview = Convert.ToBoolean(reader[METADATA_SHOWINPREVIEW]); return(result); }
public void AddOrReplace(MetaData metaData, Guid entryID) { string inhalt; switch (metaData.Type) { case MetaDataType.CreationDate: CreationDateData cdd = (CreationDateData)metaData; inhalt = cdd.Date.ToString(); break; case MetaDataType.LastChangedDate: LastChangeDateData lcd = (LastChangeDateData)metaData; inhalt = lcd.Date.ToString(); break; case MetaDataType.Title: TitleData td = (TitleData)metaData; inhalt = td.Content; break; case MetaDataType.Author: AuthorData ad = (AuthorData)metaData; inhalt = string.Empty; List <Author> authors = ad.AuthorsCopy; foreach (Author author in authors) { _authorTable.AddOrReplace(author, metaData.ID); } break; case MetaDataType.Tags: TagsData tad = (TagsData)metaData; inhalt = string.Empty; List <Tag> tags = tad.TagsCopy; foreach (Tag tag in tags) { _tagsTable.AddOrReplace(tag, metaData); } break; case MetaDataType.Comment: CommentData commentData = (CommentData)metaData; inhalt = commentData.Content; break; case MetaDataType.Description: DescriptionData descriptionData = (DescriptionData)metaData; inhalt = descriptionData.Content; break; case MetaDataType.PreviewImage: PreviewImageData previewData = (PreviewImageData)metaData; inhalt = previewData.IsEmpty ? string.Empty : previewData.Uri.AbsoluteUri; break; default: throw new NotImplementedException(); } string command = createAddOrReplaceMetaDataCommand(metaData, inhalt, entryID); executeNonQuery(command); }