SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

BeginUpdate() and CommitUpdate()

Last post 10-06-2008 8:46 PM by cemo. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-27-2008 8:44 PM

    • cemo
    • Not Ranked
    • Joined on 09-27-2008
    • Posts 2

    BeginUpdate() and CommitUpdate()

    Hi, I'm trying to add some files to a single zip file with ZipFile.Add() method. When I use BeginUpdate() and CommitUpdate() inside the loop, it is slow. When I use them before and after the loop, it is very fast but the zip file is corrupted. (Probably the file list isn't written at the end) Is this a normal behavior or am I missing something? Thanks in advance, CP
  • 10-06-2008 8:20 PM In reply to

    Re: BeginUpdate() and CommitUpdate()

    Hi,

    It is not normal behaviour at all.  More input is required so we can determine were this is going awry.

    Under what conditions is it failing?  Does it always fail?

    Cheers, -jr-

     

  • 10-06-2008 8:46 PM In reply to

    • cemo
    • Not Ranked
    • Joined on 09-27-2008
    • Posts 2

    Re: BeginUpdate() and CommitUpdate()

    It fails all the time. It doesn't raise any error but resulting zip file is corrupted. When I try to open the zip file it says 'Unexpected end of archive'

    When I put the BeginUpdate() and CommitUpdate() in the for-next loop everything is fine, but very slow comparing to first.

    Thanks

    My code is like below (nothing special with it actually):

    ------

    Dim zip1 As Zip.ZipFile = Zip.ZipFile.Create(Me.txTargetZip.Text)

    ------

    zip1.BeginUpdate()
    For Each strFilePath In strFiles 'strFiles is a simple string array

      zip1.Add(strFilePath)

    Next
    zip1.CommitUpdate()

    ------

Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.