Skip to content

Commit

Permalink
Dispose objects before they lose scope (CA2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-visionaid committed Oct 7, 2024
1 parent 792ebf8 commit 74489af
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ internal OLEPropertiesContainer(CFStream cfStream)
PropertySetStream pStream = new PropertySetStream();

this.cfStream = cfStream;
pStream.Read(new BinaryReader(new StreamDecorator(cfStream)));

using StreamDecorator stream = new(cfStream);
using BinaryReader reader = new(stream);
pStream.Read(reader);

ContainerType = pStream.FMTID0.ToString("B").ToUpperInvariant() switch
{
Expand Down Expand Up @@ -222,8 +225,8 @@ public void Save(CFStream cfStream)
//throw new NotImplementedException("API Unstable - Work in progress - Milestone 2.3.0.0");
//properties.Sort((a, b) => a.PropertyIdentifier.CompareTo(b.PropertyIdentifier));

Stream s = new StreamDecorator(cfStream);
BinaryWriter bw = new BinaryWriter(s);
using StreamDecorator s = new(cfStream);
using BinaryWriter bw = new BinaryWriter(s);

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

Expand Down

0 comments on commit 74489af

Please sign in to comment.