Skip to content

Commit

Permalink
Merge pull request #158 from Visionaid-International-Ltd/fix-build-wa…
Browse files Browse the repository at this point in the history
…rnings

Fix build warnings
  • Loading branch information
ironfede authored Sep 23, 2024
2 parents 4008143 + 501499a commit a85dea0
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 88 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

# CS1591: Missing XML comment for publicly visible type or member
dotnet_diagnostic.CS1591.severity = suggestion

[*.{cs,vb}]
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using System.IO;

namespace OpenMcdf.Extensions.OLEProperties.Interfaces
namespace OpenMcdf.Extensions.OLEProperties.Interfaces
{
public interface IDictionaryProperty : IProperty
{
void Read(BinaryReader br);
void Write(BinaryWriter bw);
}
}
37 changes: 18 additions & 19 deletions sources/OpenMcdf/CompoundFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1767,18 +1767,6 @@ List<Sector> directorySectors
/// <exception cref="T:OpenMcdf.CFException">Raised if destination file is not seekable</exception>
/// <exception cref="T:OpenMcdf.CFInvalidOperation">Raised if destination file is the current file</exception>
public void SaveAs(string fileName)
{
Save(fileName);
}

/// <summary>
/// Saves the in-memory image of Compound File to a file.
/// </summary>
/// <param name="fileName">File name to write the compound file to</param>
/// <exception cref="T:OpenMcdf.CFException">Raised if destination file is not seekable</exception>
/// <exception cref="T:OpenMcdf.CFInvalidOperation">Raised if destination file is the current file</exception>
[Obsolete("Use SaveAs method")]
public void Save(string fileName)
{
if (IsClosed)
throw new CFException("Compound File closed: cannot save data");
Expand Down Expand Up @@ -1828,6 +1816,18 @@ public void Save(string fileName)
}
}

/// <summary>
/// Saves the in-memory image of Compound File to a file.
/// </summary>
/// <param name="fileName">File name to write the compound file to</param>
/// <exception cref="T:OpenMcdf.CFException">Raised if destination file is not seekable</exception>
/// <exception cref="T:OpenMcdf.CFInvalidOperation">Raised if destination file is the current file</exception>
[Obsolete("Use SaveAs method")]
public void Save(string fileName)
{
SaveAs(fileName);
}

/// <summary>
/// Saves the in-memory image of Compound File to a stream.
/// </summary>
Expand Down Expand Up @@ -2473,15 +2473,14 @@ List<Sector> chain
/// }
/// </code>
/// </example>
public void Close()
{
this.Close(true);
}
public void Close() => CloseCore(true);

private bool closeStream = true;

[Obsolete("Use flag LeaveOpen in CompoundFile constructor")]
public void Close(bool closeStream)
public void Close(bool closeStream) => CloseCore(closeStream);

private void CloseCore(bool closeStream)
{
this.closeStream = closeStream;
((IDisposable)this).Dispose();
Expand Down Expand Up @@ -2665,7 +2664,7 @@ public StgType GetStorageType(int id)
/// </example>
public static void ShrinkCompoundFile(Stream s)
{
CompoundFile cf = new CompoundFile(s);
CompoundFile cf = new CompoundFile(s, CFSUpdateMode.ReadOnly, CFSConfiguration.LeaveOpen);

if (cf.header.MajorVersion != (ushort)CFSVersion.Ver_3)
throw new CFException("Current implementation of free space compression does not support version 4 of Compound File Format");
Expand All @@ -2692,7 +2691,7 @@ public static void ShrinkCompoundFile(Stream s)
s.SetLength(tmpMS.Length);

tmpMS.Close();
cf.Close(false);
cf.Close();
}
}

Expand Down
2 changes: 1 addition & 1 deletion sources/Structured Storage Explorer/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
saveFileDialog1.FilterIndex = 2;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
cf.Save(saveFileDialog1.FileName);
cf.SaveAs(saveFileDialog1.FileName);
}
}

Expand Down
4 changes: 2 additions & 2 deletions sources/Structured Storage Explorer/StreamDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public class StreamDataProvider : IByteProvider
bool _hasChanges;

/// <summary>
/// Initializes a new instance of the DynamicByteProvider class.
/// Initializes a new instance of the StreamDataProvider class.
/// </summary>
/// <param name="bytes"></param>
/// <param name="modifiedStream"></param>
public StreamDataProvider(CFStream modifiedStream)
{
Bytes = new ByteCollection(modifiedStream.GetData());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void Test_AS_IOSTREAM_WRITE()
Stream s = cf.RootStorage.AddStream("ANewStream").AsIOStream();
BinaryWriter bw = new BinaryWriter(s);
bw.Write(cmp);
cf.Save("$ACFFile.cfs");
cf.SaveAs("$ACFFile.cfs");
cf.Close();

cf = new CompoundFile("$ACFFile.cfs");
Expand All @@ -89,7 +89,7 @@ public void Test_AS_IOSTREAM_MULTISECTOR_WRITE()
using (BinaryWriter bw = new BinaryWriter(s))
{
bw.Write(data);
cf.Save("$ACFFile2.cfs");
cf.SaveAs("$ACFFile2.cfs");
cf.Close();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void Test_DOCUMENT_SUMMARY_INFO_ROUND_TRIP()

co.Save(cf2.RootStorage.GetStream("\u0005DocumentSummaryInformation"));

cf2.Save("test1.cfs");
cf2.SaveAs("test1.cfs");
cf2.Close();
}

Expand Down
6 changes: 3 additions & 3 deletions sources/Test/OpenMcdf.MemTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private static void TestCode()

var cf = new CompoundFile(CFSVersion.Ver_3, CFSConfiguration.SectorRecycle);
cf.RootStorage.AddStream("A").SetData(bA);
cf.Save("OneStream.cfs");
cf.SaveAs("OneStream.cfs");

cf.Close();

Expand All @@ -51,7 +51,7 @@ private static void TestCode()
cf.RootStorage.AddStream("G").SetData(bG);
cf.RootStorage.AddStream("H").SetData(bH);

cf.Save("8_Streams.cfs");
cf.SaveAs("8_Streams.cfs");

cf.Close();

Expand Down Expand Up @@ -131,7 +131,7 @@ private static void StressMemory()

CompoundFile cf = new CompoundFile(CFSVersion.Ver_4, CFSConfiguration.Default);
CFStream st = cf.RootStorage.AddStream("MySuperLargeStream");
cf.Save("LARGE.cfs");
cf.SaveAs("LARGE.cfs");
cf.Close();

//Console.WriteLine("Closed save");
Expand Down
2 changes: 1 addition & 1 deletion sources/Test/OpenMcdf.PerfTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private static void CreateFile(string fn)
cf.RootStorage.AddStream("Test" + i.ToString()).SetData(Helpers.GetBuffer(300));
}

cf.Save(fileName);
cf.SaveAs(fileName);
cf.Close();
}
}
Expand Down
Loading

0 comments on commit a85dea0

Please sign in to comment.