Quantcast
Channel: DotNetZip Library
Viewing all 664 articles
Browse latest View live

New Post: Issue with Ionic.Zip in chrome or firefox

$
0
0
Hi Churni,

From memory, Response.End() doesn't flush the buffer response buffer. You can either disable the response buffer with "Response.BufferOutput = false;", or call something like Response.OutputStream.Flush(), or end the response cleanly with HttpApplication.CompleteRequest.

There's a similar thread at https://dotnetzip.codeplex.com/discussions/238541 which might be useful.

Hope this helps.

Mike

Patch Uploaded: #14786

$
0
0

Fobos has uploaded a patch.

Description:
Hi, i work with DotNetZip in my project. I should download webPages from Internet and parse them. Many is compressed in Gzip format. And i found, when i use GZipStream DecompressBuffer, i already know decompressed page size, and i can use it to reduce memory consumption. I create a patch, without it, existing code use 3x memory on GZipStream .DecompressBuffer with my patch it will only use 1x memory. I think it's gool and useful. At first i write wripper around your library, but then decide to create a patch to library.

P.S.
The code
if (compressed.Length > 5){...}
is ugly, i know, but i don't know how to write this check in the right way. I think there would be some checking that incoming buffer correct. May be you will find how to write this rigth.

Reviewed: 1.9.1.5 DotNetZip (juil. 06, 2013)

$
0
0
Rated 4 Stars (out of 5) - thanks you

New Post: Zipfile.Save() method crashes when called from my script

$
0
0
Hi Dino,

(Note: I’m addressing this post to Dino only because I’m suggesting there may be a bug in the library. However, all comments, especially those containing helpful suggestions, are welcome.) I apologize for the length of this post, but it takes quite a bit of space to communicate all the necessary information.

I’ve been struggling for several weeks to create a Powershell script that uses DotNetZip to archive (zip) a set of nested folders, and I think I’ve run into a bug in the library. I’ll lay it out for you, and maybe you can tell me what’s going on.

I'm running under Windows 7 SP1 Professional and PowerShell 3.0.

I’m using a slight modification of your ZipUp-Files script at the DotNetZip Home Page on MSDN. (http://archive.msdn.microsoft.com/DotNetZip/Wiki/View.aspx?title=PowerShell%20Example&referringTitle=Home) At least I was going to start there. Unfortunately, I didn’t get very far, because of this alleged bug.

Here is my script as it stands now. Most of the changes I’ve made deal with file and directory names to make the script compatible with my machine’s filesystem.
function ZipUp-Files ( $directory )
{
  $children = get-childitem -path $directory
  foreach ($o in $children) 
  {
    if (!$BaseDir -or ($BaseDir -eq "")) {
      $ix = $o.PSParentPath.IndexOf("::")
      $BaseDir = $o.PSParentPath.Substring($ix+2)
      $x = get-item $BaseDir
      $ix = $x.PSParentPath.IndexOf("::")
      $ParentOfBase = $x.PSParentPath.Substring($ix+2) + "\"
    }
 
    if ($o.Name -ne "TestResults" -and 
        $o.Name -ne "obj" -and 
        $o.Name -ne "bin" -and
       $o.Name -ne "NTUSER.DAT" -and
    $o.Name -ne "_tfs" -and 
    $o.Name -ne "notused" -and 
    $o.Name -ne "AppNote.txt" -and 
    $o.Name -ne "CodePlex-Readme.txt" -and 
    $o.Name -ne "ReadThis.txt" -and 
    $o.Name -ne "Ionic.snk" -and 
    $o.Name -ne "Ionic.pfx" -and 
    $o.Name -ne "Debug" -and 
    $o.Name -ne "Release" -and
    $o.Name -ne "Resources")
    {
      if ($o.PSIsContainer)
      {
        ZipUp-Files ( $o.FullName )
      }
      else 
      {
        #Write-output $o.FullName
        if ($o.Name  -and
          $o.Name -ne "" -and
          $o.Name -ne ".tfs-ignore" -and
          (!$o.Name.EndsWith("~")) -and
          (!$o.Name.EndsWith("#")) -and
          (!$o.Name.EndsWith(".cache")) -and
          (!$o.Name.EndsWith(".zip") )
        )
        {
          Write-output $o.FullName.Replace($ParentOfBase, "")
          $e= $zipfile.AddFile($o.FullName.Replace($ParentOfBase, ""))
        }
      }
    }
  }
}


$DotNetZip='C:\Windows\System32\WindowsPowerShell\v1.0\DotNetZip'
$DNZ = $DotNetZip
$PS = 'C:\PSScripts'       # Development area for my PowerShell scripts

Remove-Item 'c:\DotNetZip-src-v.zip' -Force -ea SilentlyContinue

[System.Reflection.Assembly]::LoadFrom($DNZ+'\Ionic.Zip.Dll') 
# [System.Reflection.Assembly]::LoadFrom("c:\\dinoch\\bin\\Ionic.Zip.dll");
$version = get-content -path $DNZ'\AssemblyInfo.cs' | select-string -pattern 'AssemblyFileVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)'  |  %{$_ -replace "[^0-9.]",""}

$ZipFileName = 'c:\DotNetZip-src-v.zip'
$zipfile =  new-object Ionic.Zip.ZipFile($ZipFileName);
cd $DNZ; cd ..
ZipUp-Files "DotNetZip"
$zipfile.Save()
$zipfile.Dispose()

cd $PS
As suggested by $DotNetZip= immediately after the function portion of the script, on my machine, Powershell is installed at C:\Windows\System32\WindowsPowerShell\v1.0, and DotNetZip is stored in a directory therein. For the ISE host, that is sufficient. The variable $DotNetZip points to that directory, and Powershell_ISE is happy. I can run the script, which I have called ZipUp-Files-WFM.ps1 in that host all day long.

However, the Console-Host is an entirely story: when I attempt to run ZipUp-Files-WFM under simply Powershell, it results in an abnormal termination, with the following messages at the end.
. . . . . . . . . . . . . . . . . . . . . .

DotNetZip\License.zlib.txt
DotNetZip\License_1.txt
DotNetZip\PleaseDonate.txt
DotNetZip\PleaseDonate_1.txt
DotNetZip\Readme.txt
DotNetZip\Readme_1.txt
DotNetZip\Zipit.exe
Exception calling "Save" with "0" argument(s): "C:\Users\Walter\DotNetZip\Apps\ConvertFromCS-Zip.ps1"
At C:\PSScripts\ZipUp-Files-WFM.ps1:68 char:1
+ $zipfile.Save()
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FileNotFoundException
To me most of the error message is essentially nonsense. Maybe it means more to you.

If however, I install a second copy of DotNetZip in C:\Users\Walter, (which, incidentally, is the value of $Home), keeping the existing copy in C:\Windows\System32\WindowsPowerShell\v1.0, then both the Console-Host and the ISE host will run the script all day long.

The reason I suspect there is bug is that neither my $profile nor my script make any reference to the C:\Users\Walter directory, other than indirectly through $(PS)Home preference variables. Those variables alone, over which I have little or no control, should not be enough to require a second installation (i.e. copy) of DotNetZip. OTOH, if there is a good reason for there to be a second copy of DotNetZip in a directory in $Home (i.e. in c:\Users\Walter\DotNetZip), then surely both Powershell hosts should behave consistently, which they do not, in that only the non-graphical Console Host requires both copies of the DotNetZip library.

Furthermore, most of the method calls to Ionic.Zip.dll are content to use the $Home directory, and do so correctly. Only the Save() method call fails, and when it does, it yanks an (incorrect) pathname out of thin air. To me, that strongly suggests a bug somewhere in the method code.

Thanks in advance for your help,

Walter

New Post: Trying to get the AddSelectedFiles() method to store relative path to file

$
0
0
I know this is a very old post but feel the need to resurrect it.

Just like Apelkey I am finding the same issue: the relative path is copied into the zip file. However I have the latest patches and software and is 4 years later and got it again.
Certainly without this link I would not had found out what my bug was.

There is still a bug if this condition is met on looking at the code:

dirOndisk1 does not handle paths returned by unix machines. I happened to get the relative path where the files needed to be zipped from a box that contains those remote paths. The path returned contained no ending slash but had a forward slash in the middle of the string as in "...\folder1\folder2\folder3/folder4/folder5"
Once I replaced all "/" for "\" in the string the code works great.

Would be nice to include this in a patch because to find this issue is almost impossible. Thanks for this post indeed.

Created Unassigned: Install Ionic ZIp [16320]

$
0
0
I guess I am dumber than spit. I can user the DLL in my projects just by copying the DLL to where I want it. Super! I am using it effectively.

However, I am clueless about how to Install the whole (or part) of the IONIC package. Especially the help files.

No MSI file, No "How to Install" in the various readme files.

I click the CHM and can read teh table of contents of the help, but can;t see any of the help pages.

HELP

Created Unassigned: Some times this dll can not Extract zip files? [16321]

$
0
0
hello
i use this dll for update my software i zip updates with winrar and put password for zip file .
when user want update program i download zip file from server and extract in program folder.
but some users report the program can not update i check this issue and see the zip file is downloaded but not extracted only two temp file is created i forget get the name of this file. i use c#.

Commented Issue: can we please get a Ionic.Zip.Reduced.dll on nuget? [14050]

$
0
0
It would be great to also get Ionic.Zip.Reduced.dll as a package on nuget.
Comments: ** Comment from web user: drewnoakes **

Yes please. It would make using this library much easier.

https://www.nuget.org/packages/upload


New Post: What is the modification date an extracted file gets

$
0
0
After reading the documentation about "ZipEntry.LastModified" and "ZipEntry.ModifiedTime" and doing some test I am a bit confused.
I understood the problematics with the old "DOS" Date format, which is not a standardized time format and so on.
What I am trying to do is checking a zip Archive for entries and extracting only those files that have a different modification date from the files already existing on hdd.
So I want to check the zip entry for the date the extracted file would become.
But thats not as easy as I thought :-)
First issue is the "correction" you are doing there for "LastModified" by adding an hour in some cases. But that "correction" is obviously taken back again when extracting the file. So the Date in "LastModified" is not the date that the extracted file will have.
So the first basic question would be:

How do I get the exact modification date an extracted file will really become at the end?

Related question:
Currently I have only zip files which seem to have only the "DOS" date.
What will happen if a file has "NTFS" or "UNIX" times and "ModifiedTime" becomes valid?
Will the modified time for the extracted file then taken from there?

Do not get me wrong, I am aware of all the issues with "local" time and that I will never be able to compare dates on zip files from different sources.
But anyway, all I want to know:
What will be the date of the extracted file? And I want to know that before extracting it.

New Post: How to create a self extracting exe that can extract more than 5GB data (individual file less than 4GB)

$
0
0
Hello,
I am trying to create self extracting exe using DotnetZip. Everything is working fine if the exe size reaches the allowed 4GB size of the exe. Once my exe size crossed that (I noticed when it was 5GB), post creation of exe, I try to double click the exe, there is an error "<nameofexe>.exe not a win32 application".

Now an option is to make it 64bit app, but if 32bit is the way to go, is there support for bundling these to a single exe that can do self extraction? May be a smaller exe and a zip folder where the exe extracts from the zip folder in a specific location?

Created Unassigned: The extracted file is different from the original file [16327]

$
0
0
I created a .net tool to add file to a zip file.
I also have a .net CF tool to extract from a zip file.
I noticed that sometimes the extracted file is different from the original file. I found that using the binary comparison tool. However, it is not always happening.

New Post: extracted version different from the original file

$
0
0
I created a .net tool to add file to a zip file using the Ionic.Zip 1.9.1.5.
I also have a .net CF tool to extract from a zip file using the Ionic.Zip 1.9.1.8.
I noticed that sometimes the extracted file is different from the original file. I found that using the binary comparison tool. However, it is not always happening. Is it because of the version difference or the hardware?

Created Unassigned: Delete folder from .zip [16328]

$
0
0
Hello

I have a problem

I want to delete a folder from a .zip file called "META-INF"

I tried with this and didn´t work

using (ZipFile zip = ZipFile.Read(system.zip))
{
zip.RemoveEntry("META-INF");
zip.Save();
}


Thanks

TheMrRafus

Commented Issue: "Path is empty" when extracting in a linux system. [15236]

$
0
0
When using the following code:
 
ZipFile zip = ZipFile.Read(ms);
zip.ExtractAll(LatestPath);
 
An "Path is empty" exception message is triggered by that DotNetZip tries to pass "" to Directory.Create() in ZipEntry.Extract, line 760.
 
The cause is that the variable targetFileName contain the path using "\" as directory separator. When run on linux the path is interpreted as a single filename making the directory path "".
 
I would guess it could be fixed in the method ValidateOutput() in the same file line 1417:
- outFileName = outFileName.Replace("/","\\");
+ outFileName = outFileName.Replace('/', Path.DirectorySeparatorChar);
 
It works but someone who knows it should have a look at it.
Comments: ** Comment from web user: gfxmonk **

This bug makes the library unusable on linux, and the fix does indeed seem to work fine. It would be great to see this merged.

Created Unassigned: ConvertZipToSfx.exe -exec flag is incorrectly documented [16330]

$
0
0
The help text says:

```
$ mono ConvertZipToSfx.exe -help
usage:
CreateSelfExtractor [-cmdline] [-extractdir <xxxx>] [-comment <xx>]
[-exec <xx>] <Zipfile>
Creates a self-extracting archive (SFX) from an existing zip file.

options:
-cmdline - the generated SFX will be a console/command-line exe.
The default is that the SFX is a Windows (GUI) app.
-exec <xx> - The command line to execute after the SFX runs.
-comment <xx> - embed a comment into the self-extracting archive.
It is displayed when the SFX is extracted.
```


But that doesn't work. From the source code, it looks like the -exec flag is actually implemented as -exeonunpack

Created Unassigned: Change stream return from -1 to 0 [16332]

$
0
0
I can't simply use CopyTo which is a function in `class Stream` since .NET 4. It throws an error because rather then returning 0 when the stream ends it returns -1 which .NET thinks is an error and throws an exception. I imagine the output stream suffers from the same problem as well.

using (var mem = new MemoryStream())
{
using (var memin = new MemoryStream(arr))
using (var comp = new BZip2InputStream(memin))
{
comp.CopyTo(mem, 4096);

New Post: unzipping files produces by zlib

$
0
0
Within an App I am developing I extract a zipped file, coded in base64, from an xml file. I have done the base64 conversion to produce the original zip (which contains just text in the original unzipped state). The original zip was produced using zlib for some reason known only to the original programmer.

The zip file I have extracted will open in the Windows XP environment with WinRAR but not with the Windows zip facility. I just simply need to extract the base text file from it from within my C# code. I have loaded the full DotNetZip dll into the project, but when it attempts to extract from the zip it comes up with an error message saying that the file is not recognised as a zip file.

Am I doing something wrong, or will this library simply not work with a zlib zip?

New Post: .tmp file - quick question (ZIP)

$
0
0
I have the same problem, in the latest version (currently 1.9.1.8 ~2011)
I'm saving a zip file to the desktop, but I get a random .tmp file for every file in the zip archive, & it doesn't get deleted!!

It's not only messy, but I've written code to open Explorer in Windows and select my zip archive but It doesn't work because the writing/updating of .tmp files by DotNetZip removes the file selection I made.

I do not want to take my bat & ball but this is a very ordinary problem considering this common & expected usage and really reflects badly on the project that it's sitting there for over 2 years.

And especially since I cannot imagine why anyone would not create a temp file (*.tmp) in a temp directory to start with.
What could be the reason for saving temp files not into the system temp directory?
Are we missing something important here?

New Post: ZipFile in version 1.9.1.8

$
0
0
Hi there,

As a newbie to this library, I just cannot see ZipFile class in the library referenced in my project. The referenced dll is Ionic.Zlib and it is version 1.9.1.8.

What exactly am I missing?

New Post: ZipFile in version 1.9.1.8

$
0
0
Hi Rezahc

Your problem is that you are referencing the wrong DLL. The zlib dll only contains the improved ZLibStream classes. To use the full DotNetZip functionality you need to reference Ionic.Zip.DLL

Hope that solves your problem

Ali
Viewing all 664 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>