public static void AddToStoredDocuments(IMemoryCache cache, string filename, int filesize, string documentId) { List <DocMetaData> documentList; DocMetaData newDocument = new DocMetaData(filename, filesize, documentId); if (cache.TryGetValue(KEY_DOCUMENTLIST, out documentList)) { cache.Remove(KEY_DOCUMENTLIST); } if (documentList == null) { documentList = new List <DocMetaData>(); } documentList.Add(newDocument); cache.Set(KEY_DOCUMENTLIST, documentList, new TimeSpan(0, 30, 0)); return; }
void PullMetaData(Gsf.Input sum_stream, Gsf.Input doc_stream) { DocProp prop = null; sumMeta = new DocMetaData(); if (sum_stream != null) { Msole.MetadataRead(sum_stream, sumMeta); } else { Logger.Log.Warn("SummaryInformationStream not found in {0}", FileName); } docSumMeta = new DocMetaData(); if (doc_stream != null) { Msole.MetadataRead(doc_stream, docSumMeta); } else { Logger.Log.Warn("DocumentSummaryInformationStream not found in {0}", FileName); } if (sumMeta != null) { prop = sumMeta.Lookup("dc:title"); if (prop != null) { AddProperty(Beagle.Property.New("dc:title", prop.Val as string)); } prop = sumMeta.Lookup("dc:subject"); if (prop != null) { AddProperty(Beagle.Property.New("dc:subject", prop.Val as string)); } prop = sumMeta.Lookup("dc:description"); if (prop != null) { AddProperty(Beagle.Property.New("dc:description", prop.Val as string)); } prop = sumMeta.Lookup("gsf:keywords"); if (prop != null) { AddProperty(Beagle.Property.New("fixme:keywords", prop.Val as string)); } prop = sumMeta.Lookup("gsf:creator"); if (prop != null) { AddProperty(Beagle.Property.New("fixme:author", prop.Val as string)); } prop = sumMeta.Lookup("gsf:last-saved-by"); if (prop != null) { AddProperty(Beagle.Property.New("fixme:last-saved-by", prop.Val as string)); } prop = sumMeta.Lookup("gsf:generator"); if (prop != null) { AddProperty(Beagle.Property.New("fixme:generator", prop.Val as string)); } prop = sumMeta.Lookup("gsf:template"); if (prop != null) { AddProperty(Beagle.Property.New("fixme:template", prop.Val as string)); } } if (docSumMeta != null) { prop = docSumMeta.Lookup("gsf:company"); if (prop != null) { AddProperty(Beagle.Property.New("fixme:company", prop.Val as string)); } prop = docSumMeta.Lookup("gsf:category"); if (prop != null) { AddProperty(Beagle.Property.New("fixme:category", prop.Val as string)); } prop = docSumMeta.Lookup("CreativeCommons_LicenseURL"); if (prop != null) { AddProperty(Beagle.Property.New("fixme:license", prop.Val as string)); } } ExtractMetaData(sum_stream, doc_stream); if (sumMeta != null) { sumMeta.Dispose(); } if (docSumMeta != null) { docSumMeta.Dispose(); } }
void PullMetaData (Gsf.Input sum_stream, Gsf.Input doc_stream) { DocProp prop = null; sumMeta = new DocMetaData (); if (sum_stream != null) Msole.MetadataRead (sum_stream, sumMeta); else Logger.Log.Warn ("SummaryInformationStream not found in {0}", FileName); docSumMeta = new DocMetaData (); if (doc_stream != null) Msole.MetadataRead (doc_stream, docSumMeta); else Logger.Log.Warn ("DocumentSummaryInformationStream not found in {0}", FileName); if (sumMeta != null) { prop = sumMeta.Lookup ("dc:title"); if (prop != null) AddProperty (Beagle.Property.New ("dc:title", prop.Val as string)); prop = sumMeta.Lookup ("dc:subject"); if (prop != null) AddProperty (Beagle.Property.New ("dc:subject", prop.Val as string)); prop = sumMeta.Lookup ("dc:description"); if (prop != null) AddProperty (Beagle.Property.New ("dc:description", prop.Val as string)); prop = sumMeta.Lookup ("gsf:keywords"); if (prop != null) AddProperty (Beagle.Property.New ("fixme:keywords", prop.Val as string)); prop = sumMeta.Lookup ("gsf:creator"); if (prop != null) AddProperty (Beagle.Property.New ("fixme:author", prop.Val as string)); prop = sumMeta.Lookup ("gsf:last-saved-by"); if (prop != null) AddProperty (Beagle.Property.New ("fixme:last-saved-by", prop.Val as string)); prop = sumMeta.Lookup ("gsf:generator"); if (prop != null) AddProperty (Beagle.Property.New ("fixme:generator", prop.Val as string)); prop = sumMeta.Lookup ("gsf:template"); if (prop != null) AddProperty (Beagle.Property.New ("fixme:template", prop.Val as string)); } if (docSumMeta != null) { prop = docSumMeta.Lookup ("gsf:company"); if (prop != null) AddProperty (Beagle.Property.New ("fixme:company", prop.Val as string)); prop = docSumMeta.Lookup ("gsf:category"); if (prop != null) AddProperty (Beagle.Property.New ("fixme:category", prop.Val as string)); prop = docSumMeta.Lookup ("CreativeCommons_LicenseURL"); if (prop != null) AddProperty (Beagle.Property.New ("fixme:license", prop.Val as string)); } ExtractMetaData (sum_stream, doc_stream); if (sumMeta != null) sumMeta.Dispose (); if (docSumMeta != null) docSumMeta.Dispose (); }