How to find uncompressed size of ionic zip file

試著忘記壹切 提交于 2019-12-01 08:36:26
Taniq

This should do the trick:

static long totaluncompressedsize;
static string info;
.
.
.
.

// Option 1
foreach (ZipEntry e in zip)
{
    long uncompressedsize = e.UncompressedSize;
    totaluncompressedsize += uncompressedsize;
}

// Or

// Option 2 - will need to sift through the mass of info        
using (ZipFile zip = ZipFile.Read(zipFile))
{
    info = zip.Info;
}
Crulex
public static long GetTotalUnzippedSize(string zipFileName)
{
    using (ZipArchive zipFile = ZipFile.OpenRead(zipFileName))
    {
        return zipFile.Entries.Sum(entry => entry.Length);
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!