简体   繁体   English

C#中的SevenZipSharp具有所有路径文件夹的压缩文件

[英]SevenZipSharp in C# Compress files with all path folders

I have some code 我有一些代码

SevenZipExtractor.SetLibraryPath(@"C:\Program Files\7-Zip\7z.dll");//x64    
var cmpr = new SevenZipCompressor();
cmpr.CompressionFinished += (s, e) => { dof.DoFinishEvent(); cmpr = null; };
cmpr.BeginCompressDirectory("C:\\58", "C:\\Table\files\today\58.7z");

This code is work, but when I open 58.7z I Must to open all folders(table/files/today and then I see what inside). 这段代码是有效的,但是当我打开58.7z时,我必须打开所有文件夹(今天是表/文件/然后是里面的东西)。 Maybe isset some possible to save without absolute path? 也许设置了一些没有绝对路径的保存方法? Thanks! 谢谢!

According to the source code , there is a boolean flag for exactly this purpose: 根据源代码 ,有一个布尔标志用于此目的:

/// <summary>
/// Gets or sets the value indicating whether to preserve the directory structure.
/// </summary>
public bool DirectoryStructure { get; set; }

我找到解决办法

cmpr.DirectoryStructure = false;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM