Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ZipFile constructor breaking change #840

Merged
merged 3 commits into from
Aug 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 42 additions & 2 deletions src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs
Original file line number Diff line number Diff line change
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