public static void ExtractStreamToFileSystem(this Stream compressedStream, IFileSystemWriter writer) { using (var zipInputStream = new ZipInputStream(compressedStream)) { foreach (var currentEntry in zipInputStream.ToList()) { string entryDirectory = Path.GetDirectoryName(currentEntry.Name); string entryFileName = Path.GetFileName(currentEntry.Name); if (entryDirectory.Length > 0) { writer.CreateDirectory(entryDirectory); } if (string.IsNullOrEmpty(entryFileName)) { continue; } writer.CreateFile(zipInputStream, Path.Combine(entryDirectory, entryFileName)); } } }