Skip to content

Commit a73e64d

Browse files
authored
Fix ZipFile constructor breaking change (#840)
* Fix ZipFile constructor breaking change This PR fixes #839 * Fix another constructor too * Do not change formatting
1 parent 0ef7941 commit a73e64d

File tree

1 file changed

+42
-2
lines changed

1 file changed

+42
-2
lines changed

src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs

+42-2
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,23 @@ private bool HaveKeys
387387

388388
#region Constructors
389389

390+
/// <summary>
391+
/// Opens a Zip file with the given name for reading.
392+
/// </summary>
393+
/// <param name="name">The name of the file to open.</param>
394+
/// <exception cref="ArgumentNullException">The argument supplied is null.</exception>
395+
/// <exception cref="IOException">
396+
/// An i/o error occurs
397+
/// </exception>
398+
/// <exception cref="ZipException">
399+
/// The file doesn't contain a valid zip archive.
400+
/// </exception>
401+
public ZipFile(string name) :
402+
this(name, null)
403+
{
404+
405+
}
406+
390407
/// <summary>
391408
/// Opens a Zip file with the given name for reading.
392409
/// </summary>
@@ -399,7 +416,7 @@ private bool HaveKeys
399416
/// <exception cref="ZipException">
400417
/// The file doesn't contain a valid zip archive.
401418
/// </exception>
402-
public ZipFile(string name, StringCodec stringCodec = null)
419+
public ZipFile(string name, StringCodec stringCodec)
403420
{
404421
name_ = name ?? throw new ArgumentNullException(nameof(name));
405422

@@ -500,6 +517,29 @@ public ZipFile(Stream stream) :
500517

501518
}
502519

520+
/// <summary>
521+
/// Opens a Zip file reading the given <see cref="Stream"/>.
522+
/// </summary>
523+
/// <param name="stream">The <see cref="Stream"/> to read archive data from.</param>
524+
/// <param name="leaveOpen">true to leave the <see cref="Stream">stream</see> open when the ZipFile is disposed, false to dispose of it</param>
525+
/// <exception cref="IOException">
526+
/// An i/o error occurs
527+
/// </exception>
528+
/// <exception cref="ZipException">
529+
/// The stream doesn't contain a valid zip archive.<br/>
530+
/// </exception>
531+
/// <exception cref="ArgumentException">
532+
/// The <see cref="Stream">stream</see> doesnt support seeking.
533+
/// </exception>
534+
/// <exception cref="ArgumentNullException">
535+
/// The <see cref="Stream">stream</see> argument is null.
536+
/// </exception>
537+
public ZipFile(Stream stream, bool leaveOpen) :
538+
this(stream, leaveOpen, null)
539+
{
540+
541+
}
542+
503543
/// <summary>
504544
/// Opens a Zip file reading the given <see cref="Stream"/>.
505545
/// </summary>
@@ -518,7 +558,7 @@ public ZipFile(Stream stream) :
518558
/// <exception cref="ArgumentNullException">
519559
/// The <see cref="Stream">stream</see> argument is null.
520560
/// </exception>
521-
public ZipFile(Stream stream, bool leaveOpen, StringCodec stringCodec = null)
561+
public ZipFile(Stream stream, bool leaveOpen, StringCodec stringCodec)
522562
{
523563
if (stream == null)
524564
{

0 commit comments

Comments
 (0)