override protected void ExtractMetaData (Gsf.Input sumStream, Gsf.Input docSumStream) { int count = 0; DocProp prop = null; if (sumMeta != null) { prop = sumMeta.Lookup ("gsf:word-count"); if (prop != null) count = (int) prop.Val; if (count > 0) AddProperty (Beagle.Property.NewUnsearched ("fixme:word-count", count)); count = 0; prop = sumMeta.Lookup ("gsf:page-count"); if (prop != null) count = (int) prop.Val; if (count > 0) AddProperty (Beagle.Property.NewUnsearched ("fixme:page-count", count)); } }
private static int ParseElement(Gsf.Input stream) { byte [] data = stream.Read(8); if (data == null) return 0; RecordType.TypeCode opcode = (RecordType.TypeCode) (data[2] + (data[3] << 8)); int length = data[4] + (data[5] << 8) + (data[6] << 16) + (data[7] << 24); RecordType type = RecordType.Find (opcode); if (type.is_container) { int length_remaining = length; while (length_remaining > 0) { int elem_length = ParseElement(stream); if (elem_length == 0) return 0; length_remaining -= elem_length; } } else { if (length != 0) { data = stream.Read(length); if (data == null) return 0; string val = null; if (opcode == RecordType.TypeCode.TextBytesAtom) { val = System.Text.Encoding.GetEncoding (28591).GetString (data); } else if (opcode == RecordType.TypeCode.TextCharsAtom) { val = System.Text.Encoding.Unicode.GetString (data); } if (val != null) System.Console.WriteLine(val); } } return length + 8; }
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 (); }
protected virtual void ExtractMetaData (Gsf.Input sum_stream, Gsf.Input doc_stream) { }