什么是 ICSharpCode.SharpZipLib.ZipEntry.Flag?
有人可以举个例子吗,我用谷歌搜索但没有找到任何合适的结果。
我想给出标志,以便在文件名带有特殊字符的情况下使用原始名称压缩文件。
例如,目前我正在使用
ZipEntry entry = new ZipEntry(file.FullName.Substring(directory.FullName.Length + 1));
entry.Flags |= 2048; // enable UTF8 file names
什么标志来支持特殊字符文件名?
谢谢
Will any one please give an example, I googled but not found any suitable result.
I want to give flag so that it compress the file with its original name in case of file name
with special characters.for example currently I am using
ZipEntry entry = new ZipEntry(file.FullName.Substring(directory.FullName.Length + 1));
entry.Flags |= 2048; // enable UTF8 file names
what should be the flag to support special charaters file name??
Thanx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此组件的源代码可在此处获取:
http://www.icsharpcode.net/opensource/ Sharpziplib/Download.aspx
如果您下载源代码并查看 ZipEntry 的代码,您将发现
Flags
属性的以下注释。因此,像您所做的那样,将 2048 与 Flags 进行“或”运算看起来是正确的。或者,您可以设置 IsUnicodeText 属性,该属性执行相同的操作,但使代码看起来更简洁:
Source code for this component is available here:
http://www.icsharpcode.net/opensource/sharpziplib/Download.aspx
If you download the source and review the code for ZipEntry, you'll find the following comments for the
Flags
property.So, ORing 2048 into Flags as you have done looks correct. Or, you could set the IsUnicodeText property which does the same thing, though makes the code look a little cleaner: