public static ArchiveFile From(ZipArchiveEntry entry) { var text = GetText(entry); var file = new ArchiveFile(entry.FullName, text); return(file); }
public static ArchiveFile From(ZipArchiveEntry entry) { var filePath = CalculateArchivePath(entry.FullName); var text = GetText(entry); var file = new ArchiveFile(filePath, text); return(file); }
public static IReadOnlyList <ArchiveFile> ReadSourceFiles(Stream stream) { var result = new List <ArchiveFile>(); try { using (var zipArchive = new ZipArchive(stream, ZipArchiveMode.Read)) { foreach (var entry in zipArchive.Entries) { var file = ArchiveFile.From(entry); result.Add(file); } } } catch { // The archive is likely incomplete (corrupt) because the build crashed. // Tolerate this situation. } return(result); }