Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Real time zip file creation

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20068 |

    Hi,

    I wrote a piece of sw that is getting data from a device.
    I’m storing the data in binary files in a specific folder. Each 5MB, I create a new binary.

    For the moment, I filling this directory, and when I stop getting data, I launch zip process that takes all binary files one by one and copy them in the archive.

    My concern is it’s taking too much time (I need to zip 500-600 files of 5MB). What I do:

    archive.BeginUpdate();
    foreach (AbstractFile file in sourceFolder.GetFiles(true, null))
    {
        i++;
        MainForm.SetStatusMessage(“Closing ZIP… (Archiving ” + i + ” of ” + nbOfFiles.ToString() + “)”);
        file.CopyTo(archive, true);
    }
    archive.EndUpdate();

     
    where archive is a ZipArchive object.

     
    I would like to improve my algorithm starting the sippage while getting data:

    Each time I receive a binary, I do :

    archive.BeginUpdate();
    DiskFile file = new DiskFile(pFileName);
    file.CopyTo(archive, true);
    archive.EndUpdate();

    It’s good for the first 20 binary files, but when we reach the 100th file, the copy to the archive is taking to much cpu and time.

    How can I do with Xceed component to generate this ZIP file in real time ?

    Thanks

    Ben 

    Imported from legacy forums. Posted by Ben (had 1495 views)

    User (Old forums)
    Member
    Post count: 23064

    If you do not need to manipulate the archive in between adding new files until the whole archive is constructed, then you should use Real-Time Zip for .NET.  It will zip your stream as it is coming it.

    e.g.:

    ZipWriter( Stream outputStream )

    WriteLocalHeader, WriteData

      WeiteLocalHeader, WriteData

       …( for each file)

    ZipWriter.Close()

    You can read more in the documentation on how to use this :

    http://doc.xceedsoft.com/products/XceedRTZip/Introduction.html

     

    Imported from legacy forums. Posted by André (had 1293 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.