This is a migrated thread and some comments may be shown as answers.

How do I open a zip file to read in c#

1 Answer 681 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Christine
Top achievements
Rank 1
Christine asked on 25 Jul 2017, 05:25 PM

I am testing a program that downloads a zipped directory that contains text files.  I tried writing a utility that unzips the directory in c# but the version of C# does not support System.IO.Compression.ZipFile.  I would like to be able to unzip the files to read and compare.  Is there a way to read the zipped files without this namespace package?

 

Here is the example C# code I tried using as an example which does not work because the .ZipFile namespace does not exist.

 

using System;

using System.IO;

using System.IO.Compression;

...

string startPath = @"c:\example\start";

string zipPath = @"c:\example\result.zip";

string extractPath = @"c:\example\extract";

ZipFile.CreateFromDirectory(startPath, zipPath);

ZipFile.ExtractToDirectory(zipPath, extractPath);

 

 

1 Answer, 1 is accepted

Sort by
0
Nikolai
Telerik team
answered on 28 Jul 2017, 07:43 AM
Hi Christine,

You can use the .NET 4.0 zip support which is somewhat limited or use Telerik's - ZipArchive implementation part of WPF/WinForms bundle for all zip related tasks.

Regards,
Nikolai
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Christine
Top achievements
Rank 1
Answers by
Nikolai
Telerik team
Share this question
or