How do you know about the file in the archives, knowing the way? SevenZipSharp



  • Can we get the file in the archives somehow?

    Like DotNetZip:

    ZipFile zip = new ZipFile("1.zip");
    long size = zip["dir\\file.txt"].UncompressedSize;
    


  • And you're sure that ZipFile They're not moving inside? It looks like the SevenZipSharp doesn't support this indexation, but nothing prevents you from changing the method. https://msdn.microsoft.com/ru-ru/library/bb535050(v=vs.110).aspx :

    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 a method of expansion:

    public static long GetFileSize(this SevenZipExtractor extractor, string fileName)
    {
        return (long)extractor.ArchiveFileData.First(f => f.FileName == fileName).Size;
    }
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2