Using the ZippedFile class, you can bypass the "on disk" part.
In this example, let's say I have a stream on each of the blobs (represented by the stream on each of the files from my TestFolder). Also, my self-extractor file is on disk, but it could be a MemoryFile. As for the name of the file, I gave them random names, but I could have used some file specific names instead.
private static void StreamedFilesToSFXForum11600()
{
Xceed.Zip.Licenser.LicenseKey = "license key";
AbstractFile[] files = new DiskFolder( @"D:\TestFolder" ).GetFiles( true, null );
AbstractFile sfxFile = new DiskFile( @"D:\Forum11600\archive.exe" );
ZipArchive archive = new ZipArchive( sfxFile );
XceedSfxPrefix sfx = new XceedSfxPrefix( new DiskFile( @"C:\Program Files\Xceed Components\Bin\Sfx\XcdSfxZ64AES.bin" ) );
archive.SfxPrefix = sfx;
int counter = 0;
archive.BeginUpdate();
foreach( AbstractFile file in files )
{
using( Stream source = file.OpenRead() )
{
ZippedFile zipped = new ZippedFile( sfxFile, "Name" + counter.ToString() );
zipped.Create();
using( Stream destination = zipped.OpenWrite( true ) )
{
byte[] buffer = new byte[ 32768 ];
int bytesRead = 0;
while( ( bytesRead = source.Read( buffer, 0, buffer.Length ) ) > 0 )
{
destination.Write( buffer, 0, bytesRead );
}
}
}
counter++;
}
archive.EndUpdate();
}
Charles Bérubé-Rémillard
Technical Support
Xceed Software Inc.