Fix null password on ReaderFactory. Fix null options on SevenZipArchive

This commit is contained in:
Adam Hathcock
2016-10-03 13:32:53 +01:00
parent c73ac2039c
commit f26ba91386
4 changed files with 6 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ namespace SharpCompress.Archives.SevenZip
/// </summary>
/// <param name="fileInfo"></param>
/// <param name="readerOptions"></param>
public static SevenZipArchive Open(FileInfo fileInfo, ReaderOptions readerOptions)
public static SevenZipArchive Open(FileInfo fileInfo, ReaderOptions readerOptions = null)
{
fileInfo.CheckNotNull("fileInfo");
return new SevenZipArchive(fileInfo, readerOptions ?? new ReaderOptions());
@@ -44,7 +44,7 @@ namespace SharpCompress.Archives.SevenZip
public static SevenZipArchive Open(Stream stream, ReaderOptions readerOptions = null)
{
stream.CheckNotNull("stream");
return new SevenZipArchive(stream, readerOptions);
return new SevenZipArchive(stream, readerOptions ?? new ReaderOptions());
}
#if !NO_FILE

View File

@@ -8,10 +8,10 @@ namespace SharpCompress.Common
{
private readonly Stream actualStream;
internal Volume(Stream stream, ReaderOptions readerFactoryOptions)
internal Volume(Stream stream, ReaderOptions readerOptions)
{
actualStream = stream;
ReaderOptions = readerFactoryOptions;
ReaderOptions = readerOptions;
}
internal Stream Stream { get { return new NonDisposingStream(actualStream); } }

View File

@@ -29,7 +29,7 @@ namespace SharpCompress.Readers
Options = options;
}
internal ReaderOptions Options { get; private set; }
internal ReaderOptions Options { get; }
public ArchiveType ArchiveType { get; }

View File

@@ -33,7 +33,7 @@ namespace SharpCompress.Readers
};
RewindableStream rewindableStream = new RewindableStream(stream);
rewindableStream.StartRecording();
if (ZipArchive.IsZipFile(rewindableStream, null))
if (ZipArchive.IsZipFile(rewindableStream, options.Password))
{
rewindableStream.Rewind(true);
return ZipReader.Open(rewindableStream, options);