I'm using SevenZipSharp
and it has Size property in ArchiveFileInfo
struct, that "Gets or sets size of the file (unpacked)".
How can I get size of packed file in archive?
I'm using SevenZipSharp
and it has Size property in ArchiveFileInfo
struct, that "Gets or sets size of the file (unpacked)".
How can I get size of packed file in archive?
Unfortunately it seems that SevenZipSharp doesn't fill this info. Here's for example how it fills unpacked size in ArchiveFileInfo
:
var fileInfo = new ArchiveFileInfo { Index = (int)i };
...
_archive.GetProperty(i, ItemPropId.Size, ref data);
fileInfo.Size = NativeMethods.SafeCast<ulong>(data, 0);
ItemPropId
enum has PackedSize
property which is not used though, I suppose due to the fact it may be absent (according to the comment):
/// <summary>
/// Item packed sise; usually absent
/// </summary>
PackedSize,
So I guess the only way to get it is to fork SevenZipSharp and try to fix it yourself (or search for an already existing fork). If it's possible at all.
You have to create an instance of SevenZipExtractor
and there you have the property ArchiveFileData
, where you can find the needed file informations of each file, which is compressed in your archive.
SevenZipExtractor extractor = new SevenZipExtractor(path);
foreach (var file in extractor.ArchiveFileData)
{
Console.WriteLine("{0} : {1} Bytes", file.FileName, file.Size);
}