473,657 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UNZIP File

Hi
Where can I find info on unzipping file with VB.NET. I need to unzip a winzip file with my application

Thanks
Jul 21 '05 #1
7 3356
The J# runtimes have that capability and otherwise check out
http://www.icsharpcode.net/OpenSourc...b/Default.aspx for a free
zipping utility.

Yves

"Chris" <an*******@disc ussions.microso ft.com> schreef in bericht
news:5B******** *************** ***********@mic rosoft.com...
Hi,
Where can I find info on unzipping file with VB.NET. I need to unzip a winzip file with my application.
Thanks

Jul 21 '05 #2
Hi
I have th foll code

If (False = rdCompress.Chec ked) The
' Decompression of single-file archiv
Dim fsBZ2Archive As FileStream, fsOutput As FileStrea
Dim strOutputFilena me As Strin

fsBZ2Archive = File.OpenRead(t xtFileName.Text
strOutputFilena me = Path.GetDirecto ryName(txtFileN ame.Text) &
Path.GetFileNam eWithoutExtensi on(txtFileName. Text

fsOutput = File.Create(str OutputFilename

BZip2.Decompres s(fsBZ2Archive, fsOutput

fsBZ2Archive.Cl ose(
fsOutput.Flush(
fsOutput.Close(
Els
'Compression of single-file archiv
Dim fsInputFile As FileStream, fsBZ2Archive As FileStrea
fsInputFile = File.OpenRead(t xtFileName.Text
fsBZ2Archive = File.Create(txt FileName.Text + ".zip") '<<<<<<<<<<<<< i change this from .BZ to .ZI

BZip2.Compress( fsInputFile, fsBZ2Archive, 4026

fsInputFile.Clo se(

---------------------------------------------------
The zip file is created but when I try to open it I get "File is not a valid archive" and ideas?
Jul 21 '05 #3
Chris <an*******@disc ussions.microso ft.com> wrote:
The zip file is created but when I try to open it I get "File is not
a valid archive" and ideas?


I don't believe that bzip2 is the same as zip.

See http://www.pobox.com/~skeet/csharp/faq/#zip though for a link to a
..NET zip library.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #4
Jon
Thhats the same lib I downloaded but I can't seem to unzip a .zip file. Do you have any ideas?
Jul 21 '05 #5
Chris <an*******@disc ussions.microso ft.com> wrote:
Thhats the same lib I downloaded but I can't seem to unzip a .zip
file. Do you have any ideas?


Well, using ZipFile, ZipInputStream and ZipEntry seem to be a good bet
to me.

I've just written this code which unzips a file - but it doesn't do
anything about paths etc, so will fail on various zip files. It just
demonstrates the very basic ideas.

using System.IO;
using ICSharpCode.Sha rpZipLib.Zip;

public class Test
{
static void Main(string[] args)
{
foreach (string x in args)
{
Unzip (x);
}
}

static void Unzip (string zipName)
{
byte[] buffer = new byte[16384];
ZipFile zipFile = new ZipFile(zipName );
try
{
foreach (ZipEntry entry in zipFile)
{
Stream input = zipFile.GetInpu tStream(entry);
using (Stream output = File.Create(ent ry.Name))
{
int read;
while((read=inp ut.Read(buffer, 0,buffer.Length ))>0)
{
output.Write(bu ffer, 0, read);
}
}
}
}
finally
{
zipFile.Close() ;
}
}
}
--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #6
Chris <an*******@disc ussions.microso ft.com> wrote:
Thanks Guy! But I truely don't understand C#.


It should be fairly clear what method calls are involved though. The
only other thing you need to know is that a "using" construct calls
Dispose on what you create at the start of it.

There should certainly be enough information there for you to work out
how to use the library. (There should be enough in the documentation,
even - I hadn't used SharpZipLib at all before creating that test app,
and it only took a few minutes or so to write it.)

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #7
Cor
Hi Jon,

Chriss asked this question again in the language.vb group.

I have given hime the bottle opener with a lot of links to C#, VB
converters.

Cor
Jul 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
4512
by: Yogi_Bear_79 | last post by:
pardon my ignorance as I am a self-taught hobbyist programmer. I am curious after reading up on SharpZipLib. Can I embed a zipped txt file in my program? Then either read from within the zip file or unzip and read it? I currently have an embedded text file that contains a list that is read into an array. I'm always looking to save space. And I could reduce my file size 75% if it was zipped! I have looked at the SharpZipLib web site,...
1
1842
by: Jean Christophe Avard | last post by:
Hi! Finally I figure out what was wrong... "objZipEntry.size = strmFile" I wasn't giving the right file length... But now, I have issue with the unzip function... I can't unzip it, the unzip function return true but its invalid parameter when I try to set the image to the picture box.... Private Overloads Function Unzip(ByVal strSource As String, ByVal strFileToExtract As String, ByRef newms As MemoryStream) As Boolean If...
7
923
by: Chris | last post by:
Hi Where can I find info on unzipping file with VB.NET. I need to unzip a winzip file with my application Thanks
3
5780
by: SDRoy | last post by:
Hello Can someone tell me how I can unzip a .zip file in C#. The zip file is already there and I just need to unzip..not zip and unzip. -- Thanks, SDRoy
4
6011
by: DataSmash | last post by:
I need to unzip all zip file(s) in the current directory into their own subdirectories. The zip file name(s) always start with the string "usa" and end with ".zip". The code below will make the subdirectory, move the zip file into the subdirectory, but unzips the contents into the root (current) directory. I want the contents of the zip file unloaded into the newly created subdirectory where the zip file is. Any ideas? Thanks.
3
2628
by: sdoty044 | last post by:
I am a true n00b... and I just using Python to complete some very small uneventful task, but need help with one last thing. Basically, this I what I am trying to do. make a temp directory (this part I can do) Need help with: ***unzip a JAR file with the complete list of subdirectories w/ files****
5
7036
by: =?Utf-8?B?anVsaW8=?= | last post by:
Hi, I write a program to unzip a Tar file generated on a Unix environment file using SharpZipLib, but returns a error "Header checksum is invalid" when execute the program. This error appears when I try to extract the files. Can any help me where is a sample to unzip a tar file TIA Julio
1
8517
by: olddocks | last post by:
I want to upload a zip file and then extract/unzip it. I am accomplishing this with php exec command. I am calling unzip from php exec command within a php script and it is not extracting files. why? <?php echo exec('unzip file.zip'); ?> i checked apache logs and it says It works perfectly fine when i unzip using SSH command line.. how to fix this problem.
2
6379
by: somsub | last post by:
Hi all, Here is my samle code use strict ; use warnings ; use IO::Uncompress::Unzip ; When I compiled this three lines of code in win32 I got error like below.
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1611
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.