Skip to content

Commit

Permalink
Merge pull request #135 from Numpsy/users/rw/maintain_guid
Browse files Browse the repository at this point in the history
[Test] Store the value of FmtID0 when reading a property set, and use that v…
  • Loading branch information
ironfede authored Sep 3, 2024
2 parents 43af64c + cdbe4e1 commit 2e0d67b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class OLEPropertiesContainer
public bool HasUserDefinedProperties { get; private set; }

public ContainerType ContainerType { get; internal set; }
private Guid? FmtID0 { get; }

public PropertyContext Context { get; private set; }

Expand Down Expand Up @@ -100,6 +101,7 @@ internal OLEPropertiesContainer(CFStream cfStream)
break;
}

this.FmtID0 = pStream.FMTID0;

this.PropertyNames = (Dictionary<uint, string>)pStream.PropertySet0.Properties
.Where(p => p.PropertyType == PropertyType.DictionaryProperty).FirstOrDefault()?.Value;
Expand Down Expand Up @@ -238,6 +240,8 @@ public void Save(CFStream cfStream)
Stream s = new StreamDecorator(cfStream);
BinaryWriter bw = new BinaryWriter(s);

Guid fmtId0 = this.FmtID0 ?? (this.ContainerType == ContainerType.SummaryInfo ? new Guid(WellKnownFMTID.FMTID_SummaryInformation) : new Guid(WellKnownFMTID.FMTID_DocSummaryInformation));

PropertySetStream ps = new PropertySetStream
{
ByteOrder = 0xFFFE,
Expand All @@ -247,7 +251,7 @@ public void Save(CFStream cfStream)

NumPropertySets = 1,

FMTID0 = this.ContainerType == ContainerType.SummaryInfo ? new Guid(WellKnownFMTID.FMTID_SummaryInformation) : new Guid(WellKnownFMTID.FMTID_DocSummaryInformation),
FMTID0 = fmtId0,
Offset0 = 0,

FMTID1 = Guid.Empty,
Expand Down

0 comments on commit 2e0d67b

Please sign in to comment.