简体   繁体   English

使用.NET在Windows上将许多文件合并为一个ZIP的替代方法

[英]Alternatives to ZIP for combining many files into one on Windows using .NET

Im looking for methods to combine files including their name and relative path into one single file. 我正在寻找将文件的名称和相对路径组合到一个文件中的方法。 A folder disguised as a file. 伪装成文件的文件夹。 I don't need any compression or encryption. 我不需要任何压缩或加密。 Just the file data including some binary metadata attached to each file. 仅文件数据包括附加到每个文件的一些二进制元数据。

It would be great if this file was possible to open/inspect/unpack with a standard file browser in Windows such as with regular zip-files. 如果可以使用Windows中的标准文件浏览器(例如常规zip文件)打开/检查/解压缩该文件,那就太好了。

Yes I could use zip. 是的,我可以使用拉链。 But I'm researching alternatives and I would prefer a simple method I could implement myself in C#/.NET. 但是我正在研究替代方法,我更喜欢一种可以在C#/。NET中实现自己的简单方法。

UPDATE 更新

I've researched this some more and came across Microsoft's Structured Storage format. 我对此进行了更多研究,并发现了Microsoft的结构化存储格式。 It looked promising at first but it seemes to be an obsolete format, replaced with the Open Package Format. 起初它看起来很有希望,但似乎是一种过时的格式,已由“开放包格式”代替。 And then I found out about the TAR-format. 然后我发现了TAR格式。 It seemes to be the most basic format. 它似乎是最基本的格式。 But I'm not sure yet if I can add any custom metadata to the entries with TAR. 但是我不确定是否可以将任何自定义元数据添加到具有TAR的条目中。

UPDATE 更新

I went with DotNetZip at the end anyway... 无论如何,我最终还是选择了DotNetZip ...

Why not use zip? 为什么不使用zip? You can use a third party library, like dotnetzip , to make the code easy to write. 您可以使用诸如dotnetzip之类的第三方库来使代码易于编写。 And, as you mentioned, Windows handles zip files well. 而且,正如您提到的,Windows可以很好地处理zip文件。

If you have specific reason to search an alternative to ZIP, take a look on virtual file systems, eg. 如果您有特定的原因要搜索ZIP的替代版本,请查看虚拟文件系统,例如。 CodeBase File System or our Solid File System . CodeBase文件系统或我们的Solid File System Solid File System lets you add alternate data streams (like in NTFS) or tags (small chunks of binary or text data) to each file or directory. 固态文件系统使您可以向每个文件或目录添加备用数据流(如NTFS中的数据流)或标签(小块的二进制或文本数据)。 And with OS edition of SolFS you can make the filesystem visible to Windows (including Explorer and third-party applications). 借助SolFS的OS版本,您可以使文件系统对Windows(包括资源管理器和第三方应用程序)可见。

I must admit that while virtual file systems are easy to use (easier than ZIP), they are commercial products (I didn't see free virtual file system implementations yet). 我必须承认,尽管虚拟文件系统易于使用(比ZIP容易),但它们是商业产品(我还没有看到免费的虚拟文件系统实现)。

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

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