Tuesday, 9 June 2009

C# Read file from zip file to string

public void ReadFromZipFile()
string sampleZipFile = @"C:\temp\myzip.zip";
string result;
using (MemoryStream memory = new MemoryStream())
using (ZipFile zip = ZipFile.Read(sampleZipFile))
ZipEntry e = zip["myfile.txt"];

using (StreamReader reader = new StreamReader(memory))
memory.Seek(0, SeekOrigin.Begin);
result = reader.ReadToEnd();


Alex said...

My friend gave important doc file in zip archive,but unfortunately file was damaged.But after two days one familiar advised-all zip for recovery software.As he said tool helped him in like condition and program has free status.Besides that utility extract data from corrupted files with *.zip extension.

Alexis said...

I often join my zip files and once I did it and both files were deleted!I didn't know what to do.But I used next tool-best recovery zip software,which I found in one forum and tool solved my problem.Moreover it is free and can too extract data from corrupted files with *.zip extension.

Post a Comment