private MetaData extractTitleFrom(LinkPreviewData data)
        {
            TitleData result = _metaDataFactory.CreateNew(MetaDataType.Title) as TitleData;

            result.Content = data.title;
            return(result);
        }
        private TitleData convertTitleDataFrom(IDataReader reader)
        {
            Guid      metaDataGuid = new Guid(Convert.ToString(reader[METADATA_ID]));
            TitleData result       = new TitleData(metaDataGuid, Convert.ToString(reader[METADATA_INHALT]));

            result.ShowInPreview = Convert.ToBoolean(reader[METADATA_SHOWINPREVIEW]);
            return(result);
        }
Exemple #3
0
        private TitleData extractTitle(PdfDocumentInfo info)
        {
            string title = info.GetTitle();

            if (string.IsNullOrEmpty(title))
            {
                return(null);
            }
            TitleData result = _metaDataFactory.CreateNew(MetaDataType.Title) as TitleData;

            result.Content = title;
            return(result);
        }
Exemple #4
0
        public Result Extract()
        {
            PdfDocumentInfo info;

            using (FileStream fileStream = File.OpenRead(_path))
            {
                PdfReader   reader      = new PdfReader(fileStream);
                PdfDocument pdfDocument = new PdfDocument(reader);
                info = pdfDocument.GetDocumentInfo();
            }
            TitleData  title   = extractTitle(info);
            AuthorData authors = extractAuthors(info);
            TagsData   tags    = extractTags(info);

            return(new Result(title, authors, tags));
        }
        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);
        }
Exemple #6
0
 public Result(TitleData title, AuthorData authors, TagsData tags)
 {
     Title   = title;
     Authors = authors;
     Tags    = tags;
 }