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

New Post: extracted version different from the original file

$
0
0
Hi Brandonzeng

Just how are the files different - do they have a different size, or just different contents. I have been using DotNetZip in production code for over 4 years and i cannot see how DotNetZip could extract a file from a .zip that was different from the original file - it would fail all the CRC checks and give errors.

Can you give more information about this fault?

Ali

Reviewed: v1.9.1.8 DotNetZip - Latest Stable (août 01, 2013)

$
0
0
Rated 5 Stars (out of 5) - It unpacks files that some other libraries can't unpack.

New Post: Vietnamese characters in contents

$
0
0
I've been using DotNetZip for a while but just ran into a problem. I have some text (not the filename but the actual text contents) which includes non-Latin characters (specifically Vietnamese). When I use DotNetZip to zip up this content, every time I unzip it, the text is garbled (changed in a bad way).
    Dim strOriginal As String = "Đinh Quỳnh Ngô Nguyễn Phạm Tuấn Vũ Phương Ngọc Châu Trần Thị Ngọc Hồng Hiền Tô"
    Using zip As New Ionic.Zip.ZipFile()
        zip.AlternateEncoding = System.Text.Encoding.Unicode
        zip.AlternateEncodingUsage = Ionic.Zip.ZipOption.Always
        zip.AddEntry("data", strOriginal)
        zip.Save("test.zip")
    End Using

    Dim strContents As String
    Using zip As New Ionic.Zip.ZipFile("test.zip")
        Using ms As New System.IO.MemoryStream()
            zip.Entries(0).Extract(ms)
            ms.Position = 0
            Using sr As New System.IO.StreamReader(ms)
                strContents = sr.ReadToEnd
                sr.Close()
            End Using
            ms.Close()
        End Using
    End Using
    If strOriginal = strContents Then
        MsgBox("Happy")
    Else
        MsgBox("Sad")
    End If
I've tried the following Encoding options: UTF7, UTF8, Unicode, UTF32, and BigEndianUnicode. All produce bad results.

Is this a bug or is my implementation off somehow?

In case it matters, I'm using VB.Net 2010, Win7 x64, .Net 3.5, and DotNetZip 1.9.1.8.

New Post: Repack directory on a .zip

$
0
0
Hello

I want to repack all files and subfolders of a directory on a .zip file.

There are a way to do this without add every entry manually?


Thanks

TheMrRafus

Created Unassigned: Password with special characters (ÆØÅ) [16350]

$
0
0
Hi

Is it possible to have password protected zips where the password is ISO-8859-1 encoded?

I would like to use ÆØÅ in my passwords (WinRar understands this, if I create the archive in WinRar)


Thanks in advance

Created Unassigned: Cannot use Vietnamese characters in content with .AddEntry(string,string) [16351]

$
0
0
I have some text (not the filename but the actual text contents) which includes non-Latin characters (specifically Vietnamese). When I use DotNetZip to zip up this content, every time I unzip it, the text is garbled (changed in a bad way).

Dim strOriginal As String = "Đinh Quỳnh Ngô Nguyễn Phạm Tuấn Vũ Phương Ngọc Châu Trần Thị Ngọc Hồng Hiền Tô"
Using zip As New Ionic.Zip.ZipFile()
zip.AlternateEncoding = System.Text.Encoding.Unicode
zip.AlternateEncodingUsage = Ionic.Zip.ZipOption.Always
zip.AddEntry("data", strOriginal)
zip.Save("test.zip")
End Using

Dim strContents As String
Using zip As New Ionic.Zip.ZipFile("test.zip")
Using ms As New System.IO.MemoryStream()
zip.Entries(0).Extract(ms)
ms.Position = 0
Using sr As New System.IO.StreamReader(ms)
strContents = sr.ReadToEnd
sr.Close()
End Using
ms.Close()
End Using
End Using
If strOriginal = strContents Then
MsgBox("Happy")
Else
MsgBox("Sad")
End If

I've tried the following Encoding options: UTF7, UTF8, Unicode, UTF32, and BigEndianUnicode. All produce bad results.

In case it matters, I'm using VB.Net 2010, Win7 x64, .Net 3.5, and DotNetZip 1.9.1.8.

New Post: Vietnamese characters in contents

Commented 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 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?
Comments: ** Comment from web user: alijmoor **

Hi Brandonzeng. A few questions :
Can you supply an example file to replicate the error?
Also when extracting the files, did it not give a CRC error? Have you tried unzipping the file with other tools like WinZip or 7Zip?

The .zip file format includes CRC checks to ensure that the extracted data is identical to the original data. I cannot understand how DotZetZip can extract files and give a file with contents different from the original file without throwing a CRC error, as the CRC check of the extracted file will surely be different.

Also if you have the orginal and extracted files, would it be possible for you to manually check the CRC's of the original and extracted file? There are many tools on the web to calculate the CRC32 of a file. and you could check it with the CRC stored in the nonfunctional .zip file.

Regards
Ali


New Post: MDF file is corrupt when extracting

$
0
0
i also have same problem when i am creating zip using Iconic.Zip.dll program is running but when extracting .mdf file it gives error file is corrupt

New Post: MDF file is corrupt when extracting

$
0
0
@rahulmutreja - then you can probably use the same solution as other people in this thread...

use "zip.ParallelDeflateThreshold = -1;" when creating the zip

Hope this helps.

Cheers,

Mike

New Post: Generating type library for C++

$
0
0
Hi

I am trying to use DotNetZip in a 64 bit native C++ application on Windows. I had some issues with registration but managed to do it and can instantiate the classes from VB script.

Next I proceeded to generate the type library from the Ionic.Zip.dll but failed to achieve this satisfactorily. regasm generates the type lib with all the classes, interfaces etc but the interfaces do not contain any functions. I have checked this on Win2003 (32 bit) and Win2008 (64 bit) servers. For instance:

struct __declspec(uuid("addb00cf-7653-3f9a-8bec-1d37721384d4"))
_ZipFile : IDispatch
{};

I have checked the generated .TLB file with OLE View utility and found the same info. How can I generate the complete type lib?

New Post: c# need help understanding network related performance

$
0
0
hi

we have some existing .NET 2.0 C# client code which copies batches of files over a LAN to a server using individual File.Copy commands.

in my attempts to increase the performance, i am considering zipping the files locally, copying the single zip file over to the server, then extracting it on the server.

currently the whole process is ran from the client PC. so, after copying the zip file over to the server's shared directory, the client PC would be initiating the extraction of files onto the server's shared directory (e.g. unzip to "\server\mydocs\").

so does the fact that the extraction is being initiated by a client PC from over the network mean this will not be any faster? apologies if this question seems naive i'm just trying to get my head around whether this would work...

Commented Issue: BZip2InputStream.Read returns -1 instead of 0 [16069]

$
0
0
According to documentation on Stream class, the Read method should return 0 if the end of the stream has been reached, and there's no single mention of -1 possibility. But BZip2InputStream returns -1 if EOF is encountered.

This breaks some code relying on 0 as the EOF. I believe that Stream.CopyTo(...) will break as it checks for 0 as EOF.
Comments: ** Comment from web user: dbrowne **

Plus one. This is an incorrect Stream implementation. Please fix.

Commented Issue: BZip2InputStream.Read returns -1 instead of 0 [16069]

$
0
0
According to documentation on Stream class, the Read method should return 0 if the end of the stream has been reached, and there's no single mention of -1 possibility. But BZip2InputStream returns -1 if EOF is encountered.

This breaks some code relying on 0 as the EOF. I believe that Stream.CopyTo(...) will break as it checks for 0 as EOF.
Comments: ** Comment from web user: dbrowne **

The impact here is that BZip2InputStream can't be copied using Stream.CopyTo or a boilerplate stream copying method, and can't be composed with TextReaders and such. Basically you have to copy the contents of the BZip2InputStream to an uncompressed MemoryStream of FileStream to do anything with it.

David

Commented Issue: File fails to zip/unzip correctly [15159]

$
0
0
When using version 1.9.1.8 the attached file will fail to zip/unzip when using compression,
(works ok when using no compression)
Seems to compress correctly when using version 1.9.1.5,
Comments: ** Comment from web user: Repete **

I have the same behavior as norm2005. Rolled back to 1.9.1.5 but nothing changed. To help debugging the problem I introduced ZipFile's two progress handlers
AddProgress
SaveProgress
but they are are not called.

My hunch is that it may be connected to the length of the involved file names. Here is a sample from my other (working) code using SharpZipLib
Zipping abcDir\2013-08-15 11-42-54 phe\dkws-phe-01.milestone.dk_7563 - ddd6fa2f-49ce-4e88-8fa8-18521108dcd0\FF0000000000_1\FF0000000000_1_106.pic


New Post: Problems with Zip.AddFile

$
0
0
Hi,

I'm using AddFile to add a bunch of files to a new archive which I then save to a stream, but this never seems to work!
I can use AddEntry to add an entry from content, but with AddFile the zip is always invalid.

Strangely, if I read the file contents into a byte array and add them using AddEntry, I have the same problem, but AddEntry with a text string works fine.

I'd be grateful for any suggestions!

Note: this all works fine if I save it to a file, but not if I save to a stream!

New Post: IE10 fails to create zip file

$
0
0
Hi Rob,

Try using "Response.End()" instead of "Response.Close()". I was facing the same issue. "Response.End()" did the job for me. You code will be like:

Response.Clear()
Response.BufferOutput = False
Dim archiveName As String = String.Format("{0}-" & Request("p") & ".zip", DateTime.Now.ToString("yyyy-MMM-dd-HHmmss"))
Response.ContentType = "application/zip"
Response.AddHeader("content-disposition", "filename=" + archiveName)

If HeaderSize <> 0 Then
Response.AddHeader("Content-Length", HeaderSize)
End If

Using zip As ZipFile = New ZipFile()
            zip.AddFiles(filesToInclude, "")
            zip.Save(Response.OutputStream)
End Using
Response.End()

I hope it does resolve your problem. Let me know how it goes.

Commented Issue: BadReadException on byte[1179648] [16092]

$
0
0
http://stackoverflow.com/questions/15337186/dotnetzip-badreadexception-on-extract


```
public class Program
{
public static void Main(string[] args)
{
var source = new FileInfo("foo.txt");
using (var writer = source.CreateText())
writer.Write(new string('a', 1179648));

var target = new FileInfo(Path.ChangeExtension(source.FullName, "zip"));
var folder = new DirectoryInfo(Path.ChangeExtension(source.FullName, null));

if (target.Exists)
target.Delete();

if (folder.Exists)
folder.Delete(true);

using (var zip = new ZipFile(target.FullName))
{
zip.AddFile(source.FullName, string.Empty);
zip.Save();
}

using (var zip = new ZipFile(target.FullName))
zip.ExtractAll(folder.FullName);
}
}
```

```
Unhandled Exception: Ionic.Zip.BadReadException: bad read of entry foo.txt from compressed archive.
at Ionic.Zip.ZipEntry._CheckRead(Int32 nbytes)
at Ionic.Zip.ZipEntry.ExtractOne(Stream output)
at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, String password)
at Ionic.Zip.ZipFile._InternalExtractAll(String path, Boolean overrideExtractExistingProperty)
at Ionic.Zip.ZipFile.ExtractAll(String path)
at ConsoleApplication1.Program.Main(String[] args) in C:\ZipDemo\ConsoleApplication1\ConsoleApplication1\Program.cs:line 32
```
Comments: ** Comment from web user: ichris **

This is probably a duplicate of https://dotnetzip.codeplex.com/workitem/14087

New Comment on "Documentation"

$
0
0
The reference doc link on https://dotnetzip.codeplex.com/documentation has been broken for about 2 weeks. Please fix.

New Post: Setting the last modified date

$
0
0
I'm setting the last modified date on a zipEntry but when I save the zip file the lastmodfied is not set.

Is there an easy way to do this?
Viewing all 664 articles
Browse latest View live


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