Reputation: 4962
I have a collection of text files in my project containing level information that I want to load as streams and read in XNA. I am using MonoGame XNA and targeting Windows RT. Let's say I want to open /Content/Levels/Level1.txt as a stream. How would I do this?
On some other platforms using C# I would set the file's build action to resource and use
Application.GetResourceStream
but this is not available in XNA.
Upvotes: 2
Views: 714
Reputation: 595
string fileName = "Dummy.xml";
string resourceName = "Namespace0.Folder.Folder2.DataFolder." + fileName;
var resource = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName);
Upvotes: 0
Reputation: 45117
There are two kinds of storage in an XNA game: Title Storage and User Storage. See What is Storage? To read data from Title Storage, use TitleContainer.OpenStream as in this example.
Upvotes: 4