private Image ReadThumbnail() { if (!(this.HasSummary && this.HasThumbnail)) { return null; } if ((this.Thumbnail != null) && this.Thumbnail.IsAlive) { return (Image) this.Thumbnail.Target; } Image target = null; try { using (CompoundFile file = new CompoundFile(this._FileInfo.OpenRead())) { CompoundStreamEntry entry = file.Root["\x0005SummaryInformation"] as CompoundStreamEntry; if (entry != null) { using (Stream stream = entry.OpenRead()) { PropertyStorage storage = new PropertyStorage(stream); this.Summary = storage.GetSection(SummaryInformationSet.FMTID_SummaryInformation) as SummaryInformationSet; if (this.Summary != null) { foreach (int num in OlePropertyProvider.PropertyMap.Values) { this.Summary.CacheProperty(num); } target = this.Summary.Thumbnail; } } } } } catch (Exception exception) { PropertyProviderManager.ProviderTrace.TraceException(TraceEventType.Error, exception); } if (this.Summary == null) { this.HasSummary = false; } if (target == null) { this.HasThumbnail = false; } else { this.Thumbnail = new WeakReference(target); } if (!(this.HasSummary && this.HasThumbnail)) { base.ResetAvailableSet(); } return target; }
private void ReadSummary() { if (this.HasSummary && (!this.HasSummary || (this.Summary == null))) { try { using (CompoundFile file = new CompoundFile(this._FileInfo.OpenRead())) { CompoundStreamEntry entry = file.Root["\x0005SummaryInformation"] as CompoundStreamEntry; if (entry != null) { using (Stream stream = entry.OpenRead()) { PropertyStorage storage = new PropertyStorage(stream); this.Summary = storage.GetSection(SummaryInformationSet.FMTID_SummaryInformation) as SummaryInformationSet; if (this.Summary != null) { foreach (int num in OlePropertyProvider.PropertyMap.Values) { this.Summary.CacheProperty(num); } } } } } } catch (Exception exception) { PropertyProviderManager.ProviderTrace.TraceException(TraceEventType.Error, exception); } if (this.Summary == null) { this.HasSummary = false; base.ResetAvailableSet(); } } }