Last active
February 10, 2016 00:49
-
-
Save LGM-AdrianHum/6370244afd07e1d2af8a to your computer and use it in GitHub Desktop.
Just a snippet that uses System.IO.Compression to copy the data from an embedded files to a string and send it to the console.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Linq; | |
namespace CheckZipToString | |
{ | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
using (var zipStream = new FileStream("some.zip", FileMode.Open)) | |
using (var archive = new ZipArchive(zipStream, ZipArchiveMode.Read)) { | |
foreach (var entry in archive.Entries) { | |
using (var stream = entry.Open()) | |
using (var reader = new StreamReader(stream)) { | |
Console.WriteLine(reader.ReadToEnd()); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment