コード例 #1
0
        private MetaData extractDescriptionFrom(LinkPreviewData data)
        {
            DescriptionData result = _metaDataFactory.CreateNew(MetaDataType.Description) as DescriptionData;

            result.Content = data.description;
            return(result);
        }
コード例 #2
0
ファイル: MetaDataTable.cs プロジェクト: BlackLambert/knowdes
        private DescriptionData convertDescriptionDataFrom(IDataReader reader)
        {
            Guid            metaDataGuid = new Guid(Convert.ToString(reader[METADATA_ID]));
            DescriptionData result       = new DescriptionData(metaDataGuid, Convert.ToString(reader[METADATA_INHALT]));

            result.ShowInPreview = Convert.ToBoolean(reader[METADATA_SHOWINPREVIEW]);
            return(result);
        }
コード例 #3
0
ファイル: MetaDataTable.cs プロジェクト: BlackLambert/knowdes
        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);
        }