The StreamReader looks for the file in the current folder (if you just start your App it will be the folder of your ".exe") and in all
$path$ folders (e.g. in the Window folder). If you open a CMD window and enter
echo %path%, you will see all of the valid paths.
To access your file at runtime you have to follow the following steps:
1) Get the Application-Path
System.Sting path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
2) Add "\" to the end
if (String.Compare(path.substr(path.lengh-1, 1), "\\") != 0)
path = path + "\\";
3) Open file relative to the path:
FileStream fileStream = new FileStream(path + "data\\level.txt", FileMode.Open);
If your folder structure looks like this:
\bin\game.exe <- your program
Then you need to go up a folder level, so use use '..'
FileStream fileStream = new FileStream(path + "..\\data\\level.txt", FileMode.Open);