对于SevenZipCompressor来说,什么可以是等效的PutNextEntry?
我试过
MemoryStream ms = new MemoryStream(fileByteList.First().Binary);
MemoryStream compressedStream = new MemoryStream();
SevenZip.SevenZipCompressor compressor = new SevenZip.SevenZipCompressor();
compressor.DefaultItemName = "toto";
compressor.CompressionMethod = SevenZip.CompressionMethod.Lzma2;
compressor.CompressionLevel = SevenZip.CompressionLevel.Normal;
compressor.CompressStream(ms, compressedStream);
compressor = new SevenZip.SevenZipCompressor();
compressor.CompressionMethod = SevenZip.CompressionMethod.Lzma2;
compressor.CompressionLevel = SevenZip.CompressionLevel.Normal;
compressor.DefaultItemName = "toto2";
MemoryStream ms2 = new MemoryStream(fileByteList[1].Binary);
compressor.CompressStream(ms2, compressedStream);
MemoryStream ms3 = new MemoryStream();
SevenZip.SevenZipExtractor extractor = new SevenZip.SevenZipExtractor(compressedStream);
extractor.ExtractFile(0, ms3);
给出错误:
An exception of type 'SevenZip.SevenZipArchiveException' occurred in SevenZipSharp.dll but was not handled in user code
Invalid archive: open/read error! Is it encrypted and a wrong password was provided?
If your archive is an exotic one, it is possible that SevenZipSharp has no signature for its format and thus decided it is TAR by mistake. occurred