Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Could not find a local header where one expected Error

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

    Hello all,
    I glanced through the titles of the other threads before posting this and did not find quite the same problem, so I am posting this.
    What I am doing is relatively simple. I am taking a zipped file created by one windows service, then unzipping it with another service to a temp directory, use the files from the zipped file to create a master directory file, then rezip all of the files back into a newly created zip file, but with the name of the original zip file.
    The error I am encountering is this:

    Xceed.Zip.InvalidZipStructureException: Could not find a local header where one was expected in the zip file.
    Type: Xceed.Zip.ZipArchive
    FullName: \
    Zip file: C:\Images\SLD001\TransferPending\SLD001-Banks_Brenda-20080128.zip
    at Xceed.FileSystem.AbstractFolder.CopyFilesTo(FileSystemEvents events, Object userData, AbstractFolder destinationFolder, Boolean recursive, Boolean replaceExistingFiles, Object[] filters)
    at Xceed.FileSystem.AbstractFolder.CopyFilesTo(AbstractFolder destinationFolder, Boolean recursive, Boolean replaceExistingFiles, Object[] filters)
    at Dicom_Router_SLDSend.Dicom_Router_SLDSend.ProcessTransfer(String PollingFolder) in J:\Eric Development\MMP Dicom Router\Dicom_Router_SLDSend\Dicom_Router_SLDSend\Dicom_Router_SLDSend.vb:line 417

    Now what I am not understanding is that the code I am using in both services is basically the same code. Only the source directory and path name of the newly create zip file have changed.

    Dim ZipFilename As String = oConfig.PollingFolder & NewFileName ‘CurrFile.FullName

    If IO.File.Exists(ZipFilename) Then
    IO.File.Delete(ZipFilename)
    End If

    Dim NewZipFile As New Xceed.FileSystem.DiskFile(ZipFilename)
    Dim xcZip As New Xceed.Zip.ZipArchive(ZipFile)

    ZipFile.Create()
    With xcZip
    .DefaultEncryptionMethod = Xceed.Zip.EncryptionMethod.WinZipAes
    .DefaultEncryptionStrength = 256
    .DefaultEncryptionPassword = oConfig.AESKey
    .DefaultDecryptionPassword = xcZip.DefaultEncryptionPassword
    .DefaultCompressionLevel = Xceed.Compression.CompressionLevel.Highest
    .DefaultCompressionMethod = Xceed.Compression.CompressionMethod.Deflated
    End With
    Dim ZipSourceFolder As New Xceed.FileSystem.DiskFolder(oConfig.PollingFolder & “Temp\”)

    ‘Application.DoEvents()
    ZipSourceFolder.CopyFilesTo(xcZip, True, True, “*”)

    I am at a loss here. Any help would be grearly appreciated.

    Thanks,
    Eric Dickey

    Imported from legacy forums. Posted by Eric (had 3027 views)

    Xceed Support
    Member
    Post count: 5658

    After reviewing the complete code, the System.IO.FileInfo and System.IO.DirectoryInfo classes were used in combination with the FileSystem. Because those classes were keeping a reference on the instances of the file, when the FileSystem tried to access them (deleting, moving files), the error (Xceed.Zip.InvalidZipStructureException) is thrown.

    Imported from legacy forums. Posted by CharlesB (had 3622 views)

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