Skip to content

add or delete files error #290

Closed
Closed

Description

@a405012187

Steps to reproduce

  1. i generate a compressed file
  2. i want to update or delete some of them

Expected behavior

files can successfully update or delete

Actual behavior

1.some files success,they're all at the root dir,such as:"Test.txt"
2.some files error,they're all at subdirectory,such as : "Test\Test.txt";and return "Cannot find entry to delete" exception.
3.when i scan the source code,i find that it maybe can't find the specified file name in the dictionary updateIndex_ using the file name;but when i debug the program ,i find the file name is completly the same as the key;and i can also find the file using method FindEntry or GetEntry.

Version of SharpZipLib :0.86.0.518

Obtained from (only keep the relevant lines)

  • Compiled from source, commit: _______
  • Downloaded from GitHub √
  • Package installed using NuGet

Activity

  1. piksel commented on Dec 10, 2018

    @piksel
    Member

    Could you provide some code that describes your problem?

    Version 0.86 is not supported, have you tried using v1.0?

  2. a405012187 commented on Dec 11, 2018

    @a405012187
    Author

    Could you provide some code that describes your problem?

    Version 0.86 is not supported, have you tried using v1.0?

    Here's my code for adding file to the compressed file:
    using (var zipStream = File.Open(zipPath, FileMode.OpenOrCreate, FileAccess.ReadWrite,
    FileShare.ReadWrite))
    {
    using (var zipFile = new ZipFile(zipStream))
    {
    zipFile.UseZip64 = UseZip64.On;
    zipFile.IsStreamOwner = true;//the two properties have no effect
    zipFile.BeginUpdate();
    zipFile.Add(fileDataSource,entryName,CompressionMethod.Deflated);
    //which inherited from the interface IStaticDataSource
    zipFile.CommitUpdate();
    zipFile.Close();
    }
    }
    when I add a file at the root directory,it works,such as "Test.txt";but when I update a file at a sub-directory which exist an old one,it shows two files with the same name,and the length of the compressed file is doubled,such as "Test\Test.txt".
    ps:I've tried to installed the nuget package to my program ,but it shows that it can't be installed to a .NetFramework version=4.0 , and my program is only allowed to use the version 4.0

  3. a405012187 commented on Dec 11, 2018

    @a405012187
    Author

    Could you provide some code that describes your problem?

    Version 0.86 is not supported, have you tried using v1.0?

    btw,I can just find the DLL of 0.86 version,and v1.0 can only find a nuget-package which can not installed T^T
    Is v1.0 don't support .net 4.0?

  4. Grunkles commented on Dec 12, 2018

    @Grunkles

    You can open the package with any zip program (7zip, winrar, etc.). The DLL is in the lib\net45 folder.

    Hope that helps!

  5. piksel commented on Jan 3, 2019

    @piksel
    Member

    The issue you are experiencing might have been fixed by the PR above this comment, but unfortunately, no, .NET 4.0 is not supported.
    You can get the Nuget package with the fixes here:
    https://ci.appveyor.com/project/icsharpcode/sharpziplib/builds/21365536/job/ye2ljnut390yyxl8/artifacts

  6. a405012187 commented on Jan 11, 2019

    @a405012187
    Author

    The issue you are experiencing might have been fixed by the PR above this comment, but unfortunately, no, .NET 4.0 is not supported.
    You can get the Nuget package with the fixes here:
    https://ci.appveyor.com/project/icsharpcode/sharpziplib/builds/21365536/job/ye2ljnut390yyxl8/artifacts

    thx for reply,I just found that the reason why I can't search a file inside a directory, is that I use a right slash(''),but the root recorded uses a left slash('/').when I replaced it ,I can correctly find out the file,and update or delete it.

  7. piksel commented on Jan 14, 2019

    @piksel
    Member

    Glad you solved the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions