473,386 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ZIP files in C#

Are there any utils/tools to zip files at runtime in C#?

Thanks

Necqui
Mar 10 '06 #1
13 4043
Necqui Teja <Ne*****@nospam.nospam> wrote:
Are there any utils/tools to zip files at runtime in C#?


See http://www.icsharpcode.net/OpenSourc...b/Default.aspx

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 10 '06 #2
"Necqui Teja" <Ne*****@nospam.nospam> ha scritto nel messaggio

Are there any utils/tools to zip files at runtime in C#?


If you are using vs2005 you can also use the
System.IO.Compression.GZipStream class.
--

Free .Net Reporting Tool - http://www.neodatatype.net
Mar 10 '06 #3
Fabio <zn*******@virgilio.it> wrote:
Are there any utils/tools to zip files at runtime in C#?


If you are using vs2005 you can also use the
System.IO.Compression.GZipStream class.


While that gives compression and will cope with gzip files, I don't
believe it'll help much with "normal" zip files.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 10 '06 #4
Highly recommended: http://www.7-zip.org/
Here's their Sourceforge page: http://sourceforge.net/projects/sevenzip/

Two versions are available - one with a GUI and a compact (< 500K ) command
line version that you can execute from your code - passing in parameters for
what to zip (input and output file name).

And it's free.

-HTH

"Necqui Teja" <Ne*****@nospam.nospam> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...
Are there any utils/tools to zip files at runtime in C#?

Thanks

Necqui

Mar 11 '06 #5
Jordan <A@B.COM> wrote:
Highly recommended: http://www.7-zip.org/
Here's their Sourceforge page: http://sourceforge.net/projects/sevenzip/

Two versions are available - one with a GUI and a compact (< 500K ) command
line version that you can execute from your code - passing in parameters for
what to zip (input and output file name).

And it's free.


Starting a separate process makes life a lot more complicated than
using a library from within your own code.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 11 '06 #6
RE:
<< ...a lot more complicated... >>

Can you explain? It seems pretty straight-forward to me.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Jordan <A@B.COM> wrote:
Highly recommended: http://www.7-zip.org/
Here's their Sourceforge page: http://sourceforge.net/projects/sevenzip/

Two versions are available - one with a GUI and a compact (< 500K )
command
line version that you can execute from your code - passing in parameters
for
what to zip (input and output file name).

And it's free.


Starting a separate process makes life a lot more complicated than
using a library from within your own code.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Mar 11 '06 #7
Jon is right, Jordan. Calling a seperate app from your code creates a slew
of dependencies and issues for applications. I'd recommend against it.

Examples:
-- Customer A works for a large corporation that controls the manner in
which apps can be installed on the desktop. They review the install for
your app and, seeing that you are installing two executables instead of one,
simply refuse to allow the app to be installed. (= lost sale).

-- Customer B installs your app and then, the next day, downloads a zip file
sent from their customer. They double-click the zip file, as always, but
this time, a different app opens up to handle it because your zip app has
registered itself to handle files with the extension of .ZIP. They freak
out and call Customer Support in their company. After hours of frustration,
customer support figures out that the customer had installed your app, and
advises them to uninstall your app. They then place a rule in the corporate
knowledge base to advise everyone else to uninstall the app as well. (=
lost sale and lost reputation)

-- Customer C has a memory constrained environment. They run your app,
which attempts to decompress a large file. This takes a long time. Because
the zip app is external and async, your app thinks that the uncompression
has completed already and attempts to open the uncompressed file, which
fails. (= impression of code defects)

-- Customer D hears of a virus that has shown up and proactively searches on
their machine for files of a specific name. They find the zip program and
delete it. Your app simply starts to fail. (= impression of poor quality).

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Jordan" <A@B.COM> wrote in message
news:uf**************@TK2MSFTNGP11.phx.gbl...
RE:
<< ...a lot more complicated... >>

Can you explain? It seems pretty straight-forward to me.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Jordan <A@B.COM> wrote:
Highly recommended: http://www.7-zip.org/
Here's their Sourceforge page: http://sourceforge.net/projects/sevenzip/

Two versions are available - one with a GUI and a compact (< 500K )
command
line version that you can execute from your code - passing in parameters
for
what to zip (input and output file name).

And it's free.


Starting a separate process makes life a lot more complicated than
using a library from within your own code.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


Mar 12 '06 #8
Thanks Nick.

Your explanations and examples are all helpful. They all have to do with the
non technical aspects of calling another application. Granted, those "non
technical aspects" are critically important and reason enough, I'd agree, to
avoid calling another application in those and similar scenarios.

Mr. Skeet's advice, however, seemed to imply some *technical issues* with
calling another application (he wrote, "Starting a separate process...
[causes problems]"). If that was his meaning then I'd still be interested in
knowing any technical issues because I'm currently doing what he is advising
against. I have a simple Console app that gets executed by the Windows Task
Scheduler on a nightly basis. It looks for files in a folder and zips any
that are found as part of a data archiving routine. If there is some
technical issue with doing this I'd be very interested in knowing what they
are.

Thanks again!

-J

"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.com> wrote in message
news:65********************@comcast.com...
Jon is right, Jordan. Calling a seperate app from your code creates a
slew of dependencies and issues for applications. I'd recommend against
it.

Examples:
-- Customer A works for a large corporation that controls the manner in
which apps can be installed on the desktop. They review the install for
your app and, seeing that you are installing two executables instead of
one, simply refuse to allow the app to be installed. (= lost sale).

-- Customer B installs your app and then, the next day, downloads a zip
file sent from their customer. They double-click the zip file, as always,
but this time, a different app opens up to handle it because your zip app
has registered itself to handle files with the extension of .ZIP. They
freak out and call Customer Support in their company. After hours of
frustration, customer support figures out that the customer had installed
your app, and advises them to uninstall your app. They then place a rule
in the corporate knowledge base to advise everyone else to uninstall the
app as well. (= lost sale and lost reputation)

-- Customer C has a memory constrained environment. They run your app,
which attempts to decompress a large file. This takes a long time.
Because the zip app is external and async, your app thinks that the
uncompression has completed already and attempts to open the uncompressed
file, which fails. (= impression of code defects)

-- Customer D hears of a virus that has shown up and proactively searches
on their machine for files of a specific name. They find the zip program
and delete it. Your app simply starts to fail. (= impression of poor
quality).

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Jordan" <A@B.COM> wrote in message
news:uf**************@TK2MSFTNGP11.phx.gbl...
RE:
<< ...a lot more complicated... >>

Can you explain? It seems pretty straight-forward to me.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Jordan <A@B.COM> wrote:
Highly recommended: http://www.7-zip.org/
Here's their Sourceforge page:
http://sourceforge.net/projects/sevenzip/

Two versions are available - one with a GUI and a compact (< 500K )
command
line version that you can execute from your code - passing in
parameters for
what to zip (input and output file name).

And it's free.

Starting a separate process makes life a lot more complicated than
using a library from within your own code.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too



Mar 12 '06 #9
Jordan <A@B.COM> wrote:
RE:
<< ...a lot more complicated... >>

Can you explain? It seems pretty straight-forward to me.


Starting separate processes is more complicated in terms of:

1) Redirecting standard output/error, depending on what the process
does
2) Capturing precise error information - an exception can be a lot more
useful than an error number
3) The options available - how would you open a zip file and read one
entry *in memory* using a separate process?
4) Security - who is the process going to run as? Will that user always
have enough permissions to do everything you'd be able to do within
the CLR if, say, impersonation is involved?
5) Security the other way round - perhaps the process will end up with
*more* permissions than the .NET sandboxed process.
Libraries are just a lot easier to work with than separate processes,
unless all you want to do is exactly what the other program would do.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 12 '06 #10
Hi Necqui,
Welcome to MSDN Newsgroup!

I hope the following article will be helpful for you:
Title: ZIP Code Utility
URL: http://www.codeproject.com/csharp/zipcodeutil.asp

Thanks and have a nice day!

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
From: "Necqui Teja" <Ne*****@nospam.nospam>
Subject: ZIP files in C#
Date: Fri, 10 Mar 2006 13:17:12 -0800
Lines: 7
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Message-ID: <uS**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: 216.57.203.121
Path: TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.languages.csharp:391401
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Are there any utils/tools to zip files at runtime in C#?

Thanks

Necqui


Mar 13 '06 #11
"TerryFei" wrote:
I hope the following article will be helpful for you:
Title: ZIP Code Utility
URL: http://www.codeproject.com/csharp/zipcodeutil.asp

Thanks and have a nice day!


Wrong kind of zip. From the first line of the article:

<quote>
This article provides an easy method to lookup a U.S. City/State by ZIP
Code, or one or more ZIP Codes by City/State.
</quote>

In other words, nothing to do with zip *files*.

Jon

Mar 13 '06 #12
Hi ,

Sorry, I have misunderstood the meaning. Based on my knowledge, if we want
to compress file , we can use ZLIB library to achieve it.
I also hope the following article will be helpful:
Title: Compress Zip files with Windows Shell API and C#
URL:http://www.codeproject.com/csharp/co...shellapics.asp
Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
From: "Jon Skeet [C# MVP]" <sk***@pobox.com>
Newsgroups: microsoft.public.dotnet.languages.csharp
Subject: Re: ZIP files in C#
Date: 13 Mar 2006 00:07:44 -0800
Organization: http://groups.google.com
Lines: 18
Message-ID: <11**********************@z34g2000cwc.googlegroups .com>
References: <uS**************@TK2MSFTNGP12.phx.gbl>
<kq**************@TK2MSFTNGXA03.phx.gbl>
NNTP-Posting-Host: 213.146.158.130
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1142237271 11332 127.0.0.1 (13 Mar 2006 08:07:51 GMT)X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Mon, 13 Mar 2006 08:07:51 +0000 (UTC)
In-Reply-To: <kq**************@TK2MSFTNGXA03.phx.gbl>
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8) Gecko/20051111 Firefox/1.5,gzip(gfe),gzip(gfe)X-HTTP-Via: 1.1 Clearswift Web Policy Engine
Complaints-To: gr**********@google.com
Injection-Info: z34g2000cwc.googlegroups.com; posting-host=213.146.158.130;
posting-account=wlYlwRMAAABhmH17w-KED1nF-HZQHW_udygjClLVOm2VliHq0ftfvw
Path: TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!border1.nntp.d ca.giganews.com!nntp.gigan
ews.com!postnews.google.com!z34g2000cwc.googlegrou ps.com!not-for-mailXref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.languages.csharp:391703
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

"TerryFei" wrote:
I hope the following article will be helpful for you:
Title: ZIP Code Utility
URL: http://www.codeproject.com/csharp/zipcodeutil.asp

Thanks and have a nice day!


Wrong kind of zip. From the first line of the article:

<quote>
This article provides an easy method to lookup a U.S. City/State by ZIP
Code, or one or more ZIP Codes by City/State.
</quote>

In other words, nothing to do with zip *files*.

Jon


Mar 13 '06 #13
On Sat, 11 Mar 2006 07:30:41 -0000, Jon Skeet [C# MVP]
<sk***@pobox.com> wrote:
Jordan <A@B.COM> wrote:
Highly recommended: http://www.7-zip.org/
Here's their Sourceforge page: http://sourceforge.net/projects/sevenzip/

Two versions are available - one with a GUI and a compact (< 500K ) command
line version that you can execute from your code - passing in parameters for
what to zip (input and output file name).

And it's free.


Starting a separate process makes life a lot more complicated than
using a library from within your own code.


Also, you might want to have an entirely managed solution, as well, so
when looking for a .NET Zip compression component, be sure you don't
fall into the trap of thinking you purchased a .NET Zip component but
it is actually just a .NET wrapper over unmanaged code. Only the most
reputable companies offer this (Xceed, Dart, /n Software) and also
sharpZipLib, if you have more time on your hands or don't need
advanced capabilities (like support for more than 4GB, immediate help
by email, great documentation, etc.)

--
Alex Leblanc
Xceed Software Inc.
http://www.xceedsoft.com

Check out our advanced .NET grid and Windows Forms UI controls

Email: xL*******@xceedsoft.com (remove the first 'x')
Mar 15 '06 #14

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

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
44
by: Xah Lee | last post by:
here's a large exercise that uses what we built before. suppose you have tens of thousands of files in various directories. Some of these files are identical, but you don't know which ones are...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
18
by: JKop | last post by:
Here's what I know so far: You have a C++ project. You have source files in it. When you go to compile it, first thing the preprocessor sticks the header files into each source file. So now...
3
by: pooja | last post by:
Suppose i have created a class c1 with f1()in c1.cpp and included this c1.cpp in file1.cpp file , which is also having main() by giving the statement #include "c1.cpp". the same i can do by...
11
by: ambika | last post by:
Iam just trying to know "c". And I have a small doubt about these header files. The header files just contain the declaration part...Where is the definition for these declarations written??And how...
22
by: Daniel Billingsley | last post by:
Ok, I wanted to ask this separate from nospam's ridiculous thread in hopes it could get some honest attention. VB6 had a some simple and fast mechanisms for retrieving values from basic text...
18
by: UJ | last post by:
Folks, We provide custom content for our customers. Currently we put the files on our server and people have a program we provide that will download the files. These files are usually SWF, HTML or...
0
by: wal | last post by:
How does one attach files to emails using libgmail? The following code http://pramode.net/articles/lfy/fuse/4.txt works fine when said files are simple text files, but it failes as soon as the...
3
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.