Skip to content

Commit

Permalink
Fix ZipFile constructor breaking change (#840)
Browse files Browse the repository at this point in the history
* Fix ZipFile constructor breaking change

This PR fixes #839

* Fix another constructor too

* Do not change formatting
  • Loading branch information
Bykiev committed Aug 4, 2023
1 parent 0ef7941 commit a73e64d
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs
Expand Up @@ -387,6 +387,23 @@ private bool HaveKeys

#region Constructors

/// <summary>
/// Opens a Zip file with the given name for reading.
/// </summary>
/// <param name="name">The name of the file to open.</param>
/// <exception cref="ArgumentNullException">The argument supplied is null.</exception>
/// <exception cref="IOException">
/// An i/o error occurs
/// </exception>
/// <exception cref="ZipException">
/// The file doesn't contain a valid zip archive.
/// </exception>
public ZipFile(string name) :
this(name, null)
{

}

/// <summary>
/// Opens a Zip file with the given name for reading.
/// </summary>
Expand All @@ -399,7 +416,7 @@ private bool HaveKeys
/// <exception cref="ZipException">
/// The file doesn't contain a valid zip archive.
/// </exception>
public ZipFile(string name, StringCodec stringCodec = null)
public ZipFile(string name, StringCodec stringCodec)
{
name_ = name ?? throw new ArgumentNullException(nameof(name));

Expand Down Expand Up @@ -500,6 +517,29 @@ public ZipFile(FileStream file, bool leaveOpen)

}

/// <summary>
/// Opens a Zip file reading the given <see cref="Stream"/>.
/// </summary>
/// <param name="stream">The <see cref="Stream"/> to read archive data from.</param>
/// <param name="leaveOpen">true to leave the <see cref="Stream">stream</see> open when the ZipFile is disposed, false to dispose of it</param>
/// <exception cref="IOException">
/// An i/o error occurs
/// </exception>
/// <exception cref="ZipException">
/// The stream doesn't contain a valid zip archive.<br/>
/// </exception>
/// <exception cref="ArgumentException">
/// The <see cref="Stream">stream</see> doesnt support seeking.
/// </exception>
/// <exception cref="ArgumentNullException">
/// The <see cref="Stream">stream</see> argument is null.
/// </exception>
public ZipFile(Stream stream, bool leaveOpen) :
this(stream, leaveOpen, null)
{

}

/// <summary>
/// Opens a Zip file reading the given <see cref="Stream"/>.
/// </summary>
Expand All @@ -518,7 +558,7 @@ public ZipFile(FileStream file, bool leaveOpen)
/// <exception cref="ArgumentNullException">
/// The <see cref="Stream">stream</see> argument is null.
/// </exception>
public ZipFile(Stream stream, bool leaveOpen, StringCodec stringCodec = null)
public ZipFile(Stream stream, bool leaveOpen, StringCodec stringCodec)
{
if (stream == null)
{
Expand Down

0 comments on commit a73e64d

Please sign in to comment.