0

enter image description here

I imported a plain text file into my XNA game, and I'm not sure which Content Importer AND Content Processor to specify, could anyone point me in the right direction? I don't need to do anything special with the file, it's just plain text.. I didn't think it'd need one since I'm just reading it with a StreamReader, so I would like to avoid converting it to .XNB, if possible.

Note: In case it matters, I'm using C#. I didn't tag it since it shouldn't matter.

2 Answers 2

2

You're overcomplicated something very simple. You don't need to put it in your content project at all. You should bundle it with your actual application and put it in the same directory as your application, or use the Copy To Output Directory property on the file after you put it in your regular project (in a Content folder, if you really need to).

After that, it's just opening a FileStream of File.Open on "index.txt".

Good luck!

2
  • Thanks, just one question: since you can import .PNG textures yourself instead of from Content, are there any disadvantages to not using the content pipeline at all (like performance), and just using PNG textures, etc.?
    – Oztaco
    Apr 17, 2013 at 0:14
  • @leaf68 You're asking this question too early. Make your game first, then measure what is going wrong.
    – user1357649
    Apr 17, 2013 at 1:54
0

If you import/drag it into the content folder within VS you can reach the file like so:

using (StreamReader sr = new StreamReader(@"Content\filename.txt")
{
}

This way you can access the text file easy from within VS and it gets sorted properly within content when you publish your project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.