Can I somehow get the file data in the archive (index, size, etc.) without going through all the files?
Like for example in DotNetZip:
ZipFile zip = new ZipFile("1.zip"); long size = zip["dir\\file.txt"].UncompressedSize;
Are you sure that ZipFile
doesn’t ZipFile
them inside? It seems that SevenZipSharp does not support such indexing, but nothing prevents you from entrusting the First
method to a brute force:
using System.Linq; ... var extractor = new SevenZipExtractor("test.7z"); var size = extractor.ArchiveFileData.First(f => f.FileName == "dir\\file.txt").Size;
If you wish, you can write an extension method:
public static long GetFileSize(this SevenZipExtractor extractor, string fileName) { return (long)extractor.ArchiveFileData.First(f => f.FileName == fileName).Size; }
Source: https://ru.stackoverflow.com/questions/476891/
All Articles