a problem with unzip a file

Mar 17, 2010 at 3:04 PM

hi, i'm new with this, and i have a problem with unzip a simple file. that's my code:

 

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

imports

</font></font><font size="2" color="#0000ff">

 

</font>

Ionic.Zip

Public Class Unpack

Public shared Sub ExtraeZip(ByVal nomArch As String, ByVal dir As String)

Dim ZipToUnpack As String = nomArch

Dim TargetDir As String = dir

Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir)

Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)

Dim e As ZipEntry

For Each e In zip1

e.Extract(TargetDir,True)

Next <font size="2" color="#0000ff"><font size="2" color="#0000ff">

End Using

End Sub

End Class

 

that's sends me an error which says:

</font></font><font size="2" color="#0000ff">

 

</font>

 

Unable to load the file in the location ZipFile.cs c: \ dinoch \ dev \ dotnet \ zip \ DotNetZip \ Zip ......

I have to download another file than DotNetZip v1.9?

thanks.

Coordinator
Mar 17, 2010 at 5:54 PM

Can you show me an exception message, a stacktrace?

I don't understand the error you're getting.  It seems like it might be a message from your debugger, which is trying to load the source file shown in the .pdb file.  But that is not the primary problm, I suspect.

show me the stacktrace of the primary problem.

 

Mar 17, 2010 at 6:11 PM

hi, thanks for the reply... here is the exception message

Ionic.Zip.ZipException: C:\Users\Manuel\Desktop\ is not a valid zip file ---> Ionic.Zip.ZipException: Error opening the file ---> System.IO.DirectoryNotFoundException: No se puede encontrar una parte de la ruta de acceso 'C:\Users\Manuel\Desktop\'.
   en Ionic.Zip.ZipFile.Read en c:\dinoch\dev\dotnet\zip\DotNetZip\Zip Partial DLL\ZipFile.cs:línea 4510
   en Ionic.Zip.ZipFile.Read en c:\dinoch\dev\dotnet\zip\DotNetZip\Zip Partial DLL\ZipFile.cs:línea 4458
   en Ionic.Zip.ZipFile.Read en c:\dinoch\dev\dotnet\zip\DotNetZip\Zip Partial DLL\ZipFile.cs:línea 4162
   en ims_ep_packager.Unpack.ExtraeZip en C:\Users\Manuel\Documents\SharpDevelop Projects\ims_ep_packager\ims_ep_packager\Unpack.vb:línea 17
   en ims_ep_packager.MainForm.Button1Click en C:\Users\Manuel\Documents\SharpDevelop Projects\ims_ep_packager\ims_ep_packager\MainForm.vb:línea 69
   en System.Windows.Forms.Control.OnClick
   en System.Windows.Forms.Button.OnClick
   en System.Windows.Forms.Button.OnMouseUp
   en System.Windows.Forms.Control.WmMouseUp
   en System.Windows.Forms.Control.WndProc
   en System.Windows.Forms.ButtonBase.WndProc
   en System.Windows.Forms.Button.WndProc
   en ControlNativeWindow.OnMessage
   en ControlNativeWindow.WndProc
   en System.Windows.Forms.NativeWindow.DebuggableCallback
   en ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop
   en ThreadContext.RunMessageLoopInner
   en ThreadContext.RunMessageLoop
   en System.Windows.Forms.Application.Run
   en Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun
   en Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel
   en Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run
   en ims_ep_packager.My.MyApplication.Main en 17d14f5c-a337-4978-8281-53493378c1071.vb:línea 81

 

Coordinator
Mar 17, 2010 at 6:18 PM
Edited Mar 17, 2010 at 6:19 PM

The exception comes from line 17 of your file Unpack.vb.

I don't know what that is, but I suspect it is this line:  Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)

The ZipToUnpack variable does not contain the name of a zip file.  It apparently contains the value "C:\Users\Manuel\Desktop\", which looks like a directory.

Mar 17, 2010 at 6:21 PM

ok, i saw the problem, thanks...