IN many games, there are a number of associated files and resources that need to be shipped and installed with the program executable. By leaving these files as separate documents on the user's file system, you make them available to the user to modify, copy or, in the worst case scenario, delete.
One option to control what files are available, and reduce the clutter and temptation to fiddle, is to set files as an embedded resource. In a .NET project, you can achieve this by following these simple steps:
Add the file or files you wish to ship with your program to the Visual Studio.NET project.
In Solution Explorer select the file and press f4 to bring up the Properties Window.
Scroll down the list of properties to find the BuildAction property. Tab to the value field, and use the up and down arrow keys to change the value to Embedded Resource.
In your code, where you wish to access the file, use the GetManifestResourceStream of the executing assembly to retrieve the file from the embedded resource.
Note: If you wish to allow such resources to be amended without having to recompile the executable, then create a Resource Assembly, which could be separately packaged and deployed to your customers.
Also note that embedding resources does not compress files by default. Therefore, there is no size saving in this procedure. However, there is nothing to stop you encrypting or compressing the files before adding them as embedded resources. But you would need to decrypt and/or uncompress them programmatically on use.