private void ReadHeader(BinaryReader reader) { if (reader.ReadUInt16() != 0xfffe) { throw new InvalidDataException(); } if (reader.ReadUInt16() != 0) { throw new InvalidDataException(); } reader.ReadUInt32(); this.ClassId = new Guid(reader.ReadBytes(0x10)); int capacity = reader.ReadInt32(); List<KeyValuePair<Guid, int>> list = new List<KeyValuePair<Guid, int>>(capacity); for (int i = 0; i < capacity; i++) { Guid key = new Guid(reader.ReadBytes(0x10)); int num4 = reader.ReadInt32(); list.Add(new KeyValuePair<Guid, int>(key, num4)); } this.PropertySetMap = new Dictionary<Guid, PropertySet>(capacity); foreach (KeyValuePair<Guid, int> pair in list) { PropertySet set; reader.BaseStream.Seek((long) pair.Value, SeekOrigin.Begin); if (pair.Key.Equals(SummaryInformationSet.FMTID_SummaryInformation)) { set = new SummaryInformationSet(reader); } else { set = new PropertySet(reader, pair.Key); } this.PropertySetMap.Add(pair.Key, set); } }
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(); } } }