How do I create a file to put the images in the 'resources' folder? I do not want people using my program to have access to them. The file can be any extension.
How do I create a file to put the images in the 'resources' folder? I do not want people using my program to have access to them. The file can be any extension.
Do you want to hide project resources? You can embed / embed them in assembly.
Just go the properties of the file inside Visual Studio, and where it says Build Action
, select Embedded Resource
.
Thenyoucanreadthefileasfollows(ifitisatextfile):
varassembly=Assembly.GetExecutingAssembly();varresourceName=assembly.GetName().Name+".ficheiro.txt";
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
string result = reader.ReadToEnd();
}