Serfs is a Simple Embedded Resource File System for .Net
Embedded resources are files in a .Net Assembly which have their Build Action Property set to Embedded Resource. They can be placed in a directory-like structure.
Serfs provides simple read-only access to such files in a way similar to reading files from disk.
Stream stream = serfs.OpenRead("files/test.txt") string sb = serfs.Read("./test.txt"); string st = serfs.ReadText("test.txt");
You can tell Serfs which assemblies contain files, and which files to include. The files are merged into one collection so that they can be accessed as one virtual disk. You can create as many virtual disks as you like – just create separate instances.
The quickest way to explore in full what Serfs can do is to look at the unit tests in
TestSerfs/TestSerfs.cs or the Examples
\slashes are directory separators.
folder\filenamepath convention, embedded resources are actually stored with
.separators. There are other name adjustments too, such as spaces and
_. Serfs will try to find the correct file, but it won’t be able to differentiate between, say,
The content of the embedded resources in an assembly is easily read by external programs.
If you want to avoid shipping sensitive information in plain-text, you can encode the file content before you build the assembly. You can then supply a decode routine to Serfs, and it will perform the decoding on the fly.
This repository contains 3 projects:
Last edited by rifraf,