When opening a 7z archive and calling CreateEntry via a .NET Stream, the result is that the archive size grows, but the added files are not listed and there is a message under the archive properties that says “There are some data after the end of the payload data”.
The code is taken from your example methods and simply run twice with new files in Append mode.
The 7z command line does not have this problem, but it is imperative that I am able to add to an archive from memory and not disk.
My POC code looks like…
try
{
using (FileStream sevenZipFile = File.Open(archivePath,FileMode.Append))
{
using (FileStream source1 = new FileStream(inputFile,FileMode.OpenOrCreate))
{
using (var archive = new SevenZipArchive())
{
archive.CreateEntry(inputEntryName, source1, new SevenZipEntrySettings(new SevenZipLZMACompressionSettings(), new SevenZipAESEncryptionSettings(pwd)));
archive.Save(sevenZipFile);
}
}
}
Console.WriteLine("Successfully Created a Seven Zip File with AES Encryption Settings");
}
This is the result after running 2 times and changing the input files and names…
image.png (33.7 KB)