Would be nice for the self extractor both command line and win forms to have the option to display a splash image while loading and extracting the files. This is especially useful in the command line when you are running silent and then running a post extraction command.
↧
New Post: Request: Splash image
↧
New Post: Chinese character problem when extracting zip file
try initialize the encoding in the ZipFile construction, you will find the behavior is different with yours. I didn't any differrenct they are, but it resolved my problem.
using (ZipFile zip = new ZipFile(chineseZipPath, Encoding.GetEncoding(950)))
BTW. if the file is not ziped by Ionic.Zip, the name might be changed after you unzip it with Ionic.Zip. In my situation, I use Ionic.Zip both zip and unzip, and there is no problem for me. The following is my simple test code:
using (ZipFile zip = new ZipFile(System.Text.Encoding.GetEncoding(950)))
{
string tempFolder = @"c:\theme\result";
using (ZipFile zip = ZipFile.Read(@"c:\theme\Archive.zip", new ReadOptions() { Encoding = System.Text.Encoding.GetEncoding(950)}))
{
using (ZipFile zip = new ZipFile(chineseZipPath, Encoding.GetEncoding(950)))
BTW. if the file is not ziped by Ionic.Zip, the name might be changed after you unzip it with Ionic.Zip. In my situation, I use Ionic.Zip both zip and unzip, and there is no problem for me. The following is my simple test code:
using (ZipFile zip = new ZipFile(System.Text.Encoding.GetEncoding(950)))
{
zip.AddFile(@"C:\Theme\layout.xml");
zip.AddFile(@"C:\Theme\中文.jpg");
zip.AddFile(@"C:\Theme\2.bmp");
zip.Save(@"c:\theme\Archive.zip");
}string tempFolder = @"c:\theme\result";
using (ZipFile zip = ZipFile.Read(@"c:\theme\Archive.zip", new ReadOptions() { Encoding = System.Text.Encoding.GetEncoding(950)}))
{
foreach (ZipEntry e in zip)
{
e.Extract(tempFolder, ExtractExistingFileAction.OverwriteSilently);
}
}↧
↧
Commented Unassigned: saving the zip file when already zipfile existing throw error [16538]
hi,
i am using ionic.zip ver 1.9.1.5.
Problem i am facing is :
when there is already a zip file saved and is getting used by a process and again when i am trying to save the zip with same name it saying the "file is getting used by a process" .
I am using
objZip.Save(fileName); this API first call delete() which throws the exception "file is getting used by a process" so it cant delete and save fails , which i dont want . accroding to me it should save the zip file ....
kindly help.
Comments: ** Comment from web user: anupam_robinson **
i am using ionic.zip ver 1.9.1.5.
Problem i am facing is :
when there is already a zip file saved and is getting used by a process and again when i am trying to save the zip with same name it saying the "file is getting used by a process" .
I am using
objZip.Save(fileName); this API first call delete() which throws the exception "file is getting used by a process" so it cant delete and save fails , which i dont want . accroding to me it should save the zip file ....
kindly help.
Comments: ** Comment from web user: anupam_robinson **
John appreciate your reply but i need to save the zip file with the same name even though its being held by some process ...
↧
Commented Unassigned: saving the zip file when already zipfile existing throw error [16538]
hi,
i am using ionic.zip ver 1.9.1.5.
Problem i am facing is :
when there is already a zip file saved and is getting used by a process and again when i am trying to save the zip with same name it saying the "file is getting used by a process" .
I am using
objZip.Save(fileName); this API first call delete() which throws the exception "file is getting used by a process" so it cant delete and save fails , which i dont want . accroding to me it should save the zip file ....
kindly help.
Comments: ** Comment from web user: johnbuuck **
i am using ionic.zip ver 1.9.1.5.
Problem i am facing is :
when there is already a zip file saved and is getting used by a process and again when i am trying to save the zip with same name it saying the "file is getting used by a process" .
I am using
objZip.Save(fileName); this API first call delete() which throws the exception "file is getting used by a process" so it cant delete and save fails , which i dont want . accroding to me it should save the zip file ....
kindly help.
Comments: ** Comment from web user: johnbuuck **
Then you need to stop that other process so that the lock on the file is freed and you can save to that exact same file.
↧
Created Unassigned: Multi zip extraction issue [16547]
Hi,
I have few multi-zip packages that I try to extract. After the extraction successfuly finished I'm trying to remove the zip files and I receive an error stating that few of the zip files are locked by other process. actualy I'm not able to remove them until I close the application. It happens only on one or two of the multi-zip files. The main zip is always deleted. I use lonic.dll version 1.9.2.0
Code:
using (ZipFile zip = Ionic.Zip.ZipFile.Read(directory + "/temp.zip"))
{
zip.StatusMessageTextWriter = System.Console.Out;
zip.ExtractAll(directory, ExtractExistingFileAction.OverwriteSilently);
}
foreach (var file in Directory.GetFiles(directory, "*temp*"))
{
int retries = 0;
while (retries <2)
{
try
{
File.Delete(file);
break;
}
catch (Exception) //ToDO: Remove when good zip utility will not lock the ziped files
{
retries++;
}
}
}
Thanks,
yevgeni
I have few multi-zip packages that I try to extract. After the extraction successfuly finished I'm trying to remove the zip files and I receive an error stating that few of the zip files are locked by other process. actualy I'm not able to remove them until I close the application. It happens only on one or two of the multi-zip files. The main zip is always deleted. I use lonic.dll version 1.9.2.0
Code:
using (ZipFile zip = Ionic.Zip.ZipFile.Read(directory + "/temp.zip"))
{
zip.StatusMessageTextWriter = System.Console.Out;
zip.ExtractAll(directory, ExtractExistingFileAction.OverwriteSilently);
}
foreach (var file in Directory.GetFiles(directory, "*temp*"))
{
int retries = 0;
while (retries <2)
{
try
{
File.Delete(file);
break;
}
catch (Exception) //ToDO: Remove when good zip utility will not lock the ziped files
{
retries++;
}
}
}
Thanks,
yevgeni
↧
↧
New Post: Move files into Zip
This feature would be nice.
↧
Commented Unassigned: Internet Explorer compatibility mode corrupts downloaded zip [16531]
I have functioning code using the Ionic zip library. This code functions in all current pc browsers tested as well as many mobile browsers.
If user uses Internet Explorer with compatibility mode view enabled, the zip created will be corrupted and cannot be opened with 7zip or windows native zip utilities.
Dim zipTemp As New Ionic.Zip.ZipFile
For i = 0 To rayFiles.Length - 1 'loop all files marked for download
If rayFiles(i) <> "" Then
'saves to server
zipTemp.AddFile(strFolderPathPg & rayFiles(i).ToString, "")
'adds db log of download file activity
infoFile = ctrlFiles.GetFile(rayFiles(i).ToString, PortalId, getDbFolderPath(strFolderPathPg))
infoFileLog = setFileLog(infoFile.FileId, 6, infoFileLog)
ctrlFileLog.addFileLog(infoFileLog)
End If
Next
Response.Clear()
Response.BufferOutput = False
Response.ContentType = "application/zip"
Response.AddHeader("content-disposition", "filename=" + strFileName)
zipTemp.Save(Response.OutputStream)
Response.End()
Comments: ** Comment from web user: sconard **
If user uses Internet Explorer with compatibility mode view enabled, the zip created will be corrupted and cannot be opened with 7zip or windows native zip utilities.
Dim zipTemp As New Ionic.Zip.ZipFile
For i = 0 To rayFiles.Length - 1 'loop all files marked for download
If rayFiles(i) <> "" Then
'saves to server
zipTemp.AddFile(strFolderPathPg & rayFiles(i).ToString, "")
'adds db log of download file activity
infoFile = ctrlFiles.GetFile(rayFiles(i).ToString, PortalId, getDbFolderPath(strFolderPathPg))
infoFileLog = setFileLog(infoFile.FileId, 6, infoFileLog)
ctrlFileLog.addFileLog(infoFileLog)
End If
Next
Response.Clear()
Response.BufferOutput = False
Response.ContentType = "application/zip"
Response.AddHeader("content-disposition", "filename=" + strFileName)
zipTemp.Save(Response.OutputStream)
Response.End()
Comments: ** Comment from web user: sconard **
Adding ParallelDeflateThreshold = -1 did not resolve this issue and causes failure in downloads on IE9 without compatibility view.
I still cannot offer file downloads to users who use compatibility view as files are corrupted.
btw the above code should read Response.Close() instead of Response.End()
↧
New Post: IE10 fails to create zip file
This does not resolve the issue as stated above. I have the same issue and cannot find the resolution. This failure also happens in ie 11 in compatibility view.
↧
New Post: IE10 fails to create zip file
You definitely don't want to call Response.Close(); see http://blogs.msdn.com/b/ieinternals/archive/2012/07/16/content-length-and-transfer-encoding-validation-in-ie10-download-manager-couldnt-be-downloaded-retry-cancel.aspx
If you perform your download with Fiddler running, you'll probably get a HTTP-protocol warning showing what's wrong with the download.
If you perform your download with Fiddler running, you'll probably get a HTTP-protocol warning showing what's wrong with the download.
↧
↧
New Post: How do I overwrite the existing zip file?
Hi,
I've been using the library for a few months on Windows 2008, but now that I've moved it to Windows 2012 R2 it's throwing an exception every time I run it.
My program updates a ZIP which contains a single file, by overwriting the ZIP file:
Am I misunderstanding how it works? All I want to do is totally replace the destination zip with the new one. I realise I could delete the file first, but it's non-ideal to have this missing for any period of time (even a few seconds) and if you Delete the file programatically, it still seems to be there after a few seconds.
Any help appreciated!
Nick
I've been using the library for a few months on Windows 2008, but now that I've moved it to Windows 2012 R2 it's throwing an exception every time I run it.
My program updates a ZIP which contains a single file, by overwriting the ZIP file:
using (ZipFile zip = new ZipFile())
{
zip.ParallelDeflateThreshold = -1;
zip.AddFile(settings.SQLiteDbFilePath, String.Empty);
zip.Save(settings.ZipFilePath);
}
However this now throws the following exception:Unhandled Exception: System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Ionic.Zip.ZipFile.InternalAddEntry(String name, ZipEntry entry)
at Ionic.Zip.ZipFile._InternalAddEntry(ZipEntry ze)
at Ionic.Zip.ZipFile.AddFile(String fileName, String directoryPathInArchive)
I thought that calling Save('filename') would simply overwrite the existing file, but as I'm getting an exception, I presume it's somehow trying to merge the temporary zip file with the file I've told it to save over. Am I misunderstanding how it works? All I want to do is totally replace the destination zip with the new one. I realise I could delete the file first, but it's non-ideal to have this missing for any period of time (even a few seconds) and if you Delete the file programatically, it still seems to be there after a few seconds.
Any help appreciated!
Nick
↧
New Post: How do I overwrite the existing zip file?
Check the call stack. It's throwing the exception when adding the file not when saving the ZIP file. As I recall, there is a method to update a file that's already there.
Eric
Eric
↧
New Post: Corrupted zip after rename entries
Hi, I try rename entry in zip
using(ZipFile zip = ZipFile.Read("test.zip"))
{
for(int i=0; i>zip.Entries.Count; i++)
{
If(zip[i].IsDirectory) continue;
Console.WriteLine(zip[i].FileName); //prints Week_01\text123.txt
string newFileName = rename(zip[i].FileName); //returns Week_01\text_123.txt
zip[i].FileName = newFileName;
//zip[zip[i].FileName] = newFileName; //generates the same problem
Console.WriteLine(zip[i].FileName); //prints Week_01\text_123.txt its OK
//but zip.Entries.Count increse by 1 and latest entry its the same as current entry
}
zip.Save();
}
After all etries are renamed and zip is saved, zip has twice as size, twice as entries and its corrupted.↧
New Post: How do I overwrite the existing zip file?
But at that point, it doesn't even know about the existing zip file as it hasn't been passed the file name yet, so I'm not sure that's what's happening.
Nick
Nick
↧
↧
Reviewed: v1.9.1.8 DotNetZip - Latest Stable (Dec 19, 2013)
Rated 5 Stars (out of 5) - The examples are excellent.
↧
New Post: AddEntry with WriteDelegate doesn't end up writing the right size into the LocalFileHeader in the resulting zip.
I am adding a zip file to another zip using AddEntry with a write delegate, and although many 3rd party programs can parse the resulting file, the particular app I am trying to write the zip file for cannot load the file. Debugging through the other app, it appears as though the local file header in the resulting zip has 0 for the size of the files. I can get it to work by saving the inner zip to a temp file first, but I would like to avoid that.
Here are some simplified versions of the problem I am seeing. I'm not sure if it matters, but both zip files are uncompressed.
This works:
Here are some simplified versions of the problem I am seeing. I'm not sure if it matters, but both zip files are uncompressed.
This works:
ZipFile output = GetOutputFile();
IDictionary<string, ZipFile> pakFiles = GetPackFiles();
foreach (var pakEntry in pakFiles)
{
var p = pakEntry.Value;
if (p.Count > 0)
{
var tempStream = File.Open(Path.GetTempFileName(), FileMode.Open, FileAccess.ReadWrite);
p.Save(tempStream);
tempStream.Seek(0, SeekOrigin.Begin);
output.AddEntry(contentPath + pakEntry.Key, tempStream);
}
}
output.Save(stream);
And this doesn't: ZipFile output = GetOutputFile();
IDictionary<string, ZipFile> pakFiles = GetPackFiles();
foreach (var pakEntry in pakFiles)
{
var p = pakEntry.Value;
if (p.Count > 0)
{
output.AddEntry(contentPath + pakEntry.Key, (string entryName, Stream s) => { p.Save(s); });
}
}
output.Save(stream);
↧
New Post: AddEntry with WriteDelegate doesn't end up writing the right size into the LocalFileHeader in the resulting zip.
To clarify, it is the local file headers in the inner zip file that are not correct.
Is it possible that ZipFile.Save uses seeking within the stream to write the file sizes after writing the entry? I believe the default stream that is used by ZipFile doesn't support seeking, so I wonder if it is just failing to seek back to update the file size in the local file header?
Is it possible that ZipFile.Save uses seeking within the stream to write the file sizes after writing the entry? I believe the default stream that is used by ZipFile doesn't support seeking, so I wonder if it is just failing to seek back to update the file size in the local file header?
↧
Commented Unassigned: Zipping directory hangs on any compression level other than none. [16437]
Using VS2010 and 1.9.1 DotNetZip and trying to zip a directory using the following code:
Using zip As Ionic.Zip.ZipFile = New Ionic.Zip.ZipFile
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.None
zip.AddDirectory(BuildCachePath)
zip.UseZip64WhenSaving = Ionic.Zip.Zip64Option.AsNecessary
zip.Save(ExportPath & "\temp\build.zip")
This code works fine until I attempt to change the compression level to anything other than none. As soon as I do, the process just hangs indefinitely. It begins creating the zip file, but hangs right around 71mb in size and won't proceed. Any thoughts/ideas?
Comments: ** Comment from web user: pgeorges **
Using zip As Ionic.Zip.ZipFile = New Ionic.Zip.ZipFile
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.None
zip.AddDirectory(BuildCachePath)
zip.UseZip64WhenSaving = Ionic.Zip.Zip64Option.AsNecessary
zip.Save(ExportPath & "\temp\build.zip")
This code works fine until I attempt to change the compression level to anything other than none. As soon as I do, the process just hangs indefinitely. It begins creating the zip file, but hangs right around 71mb in size and won't proceed. Any thoughts/ideas?
Comments: ** Comment from web user: pgeorges **
try to add
zip.ParallelDeflateThreshold = -1;
to avoid the buggy parallel deflate process. This will slow things down, but looks safer.
↧
↧
New Post: compressing problem
(sorry for my english, i will try)
i'm making a game that gets his sources from a FTP server,
The Game download the zip file (pack.zip) and extract it in the gamefolder
but that is not the problem.
I made a editor for my game, and have a publish option in it; the program wil zip whole the project and upload it to the FTP server, so that the game will update.
with the editor, i can zip the folder.
but i can't open / extract it,
it says = zipfile is invaled
here are my code's of the editor, where the zip is gonna create:
![Image]()
(it's dutch, but it tells: can not open the map.
De zipped folder C:\gtamig\pack.zip is invaled)
please help me,
Miguel Billiet
i'm making a game that gets his sources from a FTP server,
The Game download the zip file (pack.zip) and extract it in the gamefolder
but that is not the problem.
I made a editor for my game, and have a publish option in it; the program wil zip whole the project and upload it to the FTP server, so that the game will update.
with the editor, i can zip the folder.
but i can't open / extract it,
it says = zipfile is invaled
here are my code's of the editor, where the zip is gonna create:
Imports Ionic.Zip
Module Module1
Public Sub zipp()
Using zip As New ZipFile
zip.AddDirectory("c:\gtamig\bin")
zip.Save("c:\gtamig\pack.zip")
End Using
End Sub
End Module
here is the error(it's dutch, but it tells: can not open the map.
De zipped folder C:\gtamig\pack.zip is invaled)
please help me,
Miguel Billiet
↧
Reviewed: v1.9.1.8 DotNetZip - Latest Stable (Jan 02, 2014)
Rated 2 Stars (out of 5) - I tried to zip both large MS Access files (*.mdb), approx. 1.5 GB nad medium size (500 MB). It doesn't always work. It zips the file but sometimes when trying to unzip the archive using Windows Explorer (right-click on the file + Extract All), it returns an error...
↧
Reviewed: v1.9.1.8 DotNetZip - Latest Stable (Jan 02, 2014)
Rated 2 Stars (out of 5) - I tried to zip both large MS Access files (*.mdb), approx. 1.5 GB and medium size (500 MB). It doesn't always work.
It zips the file but sometimes when trying to unzip the archive using Windows Explorer (right-click on the file + Extract All), it returns an error... Not reliable.
↧