I’m searching a way to add embedded resource to my solution. This resources will be folders with a lot of files in them. On user demand they need to be decompressed.
I’m searching for a way do store such folders in executable without involving third-party libraries (Looks rather stupid, but this is the task).
I have found, that I can GZip and UnGZip them using standard libraries. But GZip handles single file only. In such cases TAR should come to the scene. But I haven’t found TAR implementation among standard classes.
Maybe it possible decompress TAR with bare C#?
Since you are not allowed to use outside libraries, you are not restricted to a specific format of the
tarfile either. In fact, they don’t even need it to be all in the same file.You can write your own tar-like utility in C# that walks a directory tree, and produces two files: a “header” file that consists of a serialized dictionary mapping
System.IO.Pathinstances to an offset/length pairs, and a big file containing the content of individual files concatenated into one giant blob. This is not a trivial task, but it’s not overly complicated either.