mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-11-15 17:02:03 +00:00
Merge branch 'master' into system_buffers
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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); } }
|
||||
|
||||
@@ -3,13 +3,6 @@ using SharpCompress.Converters;
|
||||
|
||||
namespace SharpCompress.Compressors.PPMd
|
||||
{
|
||||
public enum PpmdVersion
|
||||
{
|
||||
H,
|
||||
H7z,
|
||||
I1
|
||||
}
|
||||
|
||||
public class PpmdProperties
|
||||
{
|
||||
public PpmdVersion Version = PpmdVersion.I1;
|
||||
|
||||
9
src/SharpCompress/Compressors/PPMd/PpmdVersion.cs
Normal file
9
src/SharpCompress/Compressors/PPMd/PpmdVersion.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace SharpCompress.Compressors.PPMd
|
||||
{
|
||||
public enum PpmdVersion
|
||||
{
|
||||
H,
|
||||
H7z,
|
||||
I1
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace SharpCompress.Readers
|
||||
Options = options;
|
||||
}
|
||||
|
||||
internal ReaderOptions Options { get; private set; }
|
||||
internal ReaderOptions Options { get; }
|
||||
|
||||
public ArchiveType ArchiveType { get; }
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -19,10 +19,10 @@ namespace SharpCompress.Writers.Zip
|
||||
{
|
||||
private readonly CompressionType compressionType;
|
||||
private readonly CompressionLevel compressionLevel;
|
||||
private readonly PpmdProperties ppmdProperties = new PpmdProperties(); // Caching properties to speed up PPMd
|
||||
private readonly List<ZipCentralDirectoryEntry> entries = new List<ZipCentralDirectoryEntry>();
|
||||
private readonly string zipComment;
|
||||
private long streamPosition;
|
||||
private PpmdProperties ppmdProps;
|
||||
|
||||
public ZipWriter(Stream destination, ZipWriterOptions zipWriterOptions)
|
||||
: base(ArchiveType.Zip)
|
||||
@@ -34,6 +34,18 @@ namespace SharpCompress.Writers.Zip
|
||||
InitalizeStream(destination, !zipWriterOptions.LeaveStreamOpen);
|
||||
}
|
||||
|
||||
private PpmdProperties PpmdProperties
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ppmdProps == null)
|
||||
{
|
||||
ppmdProps = new PpmdProperties();
|
||||
}
|
||||
return ppmdProps;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
if (isDisposing)
|
||||
@@ -252,8 +264,8 @@ namespace SharpCompress.Writers.Zip
|
||||
}
|
||||
case ZipCompressionMethod.PPMd:
|
||||
{
|
||||
counting.Write(writer.ppmdProperties.Properties, 0, 2);
|
||||
return new PpmdStream(writer.ppmdProperties, counting, true);
|
||||
counting.Write(writer.PpmdProperties.Properties, 0, 2);
|
||||
return new PpmdStream(writer.PpmdProperties, counting, true);
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "0.13.0",
|
||||
"version": "0.13.1",
|
||||
"title": "SharpCompress - Pure C# Decompression/Compression",
|
||||
"authors": [ "Adam Hathcock" ],
|
||||
"language": "en-US",
|
||||
|
||||
Reference in New Issue
Block a user