<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.xna.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>XNA Framework Content Pipeline</title><link>http://forums.xna.com/forums/55.aspx</link><description>Get the most from your art assets in XNA Game Studio Express</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 0.0)</generator><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/225455.aspx</link><pubDate>Fri, 11 Sep 2009 20:44:22 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:225455</guid><dc:creator>XXIst Century Boy</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/225455.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=225455</wfw:commentRss><description>&lt;div&gt;With 3.1 : &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Solution -&amp;gt; Add -&amp;gt; New Project -&amp;gt; Content Pipeline Extension Library&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;name it &amp;quot;TextFileExtension&amp;quot;, although it&amp;#39;s not important, it&amp;#39;s just to stay in line with the following code.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="overflow-x:auto;overflow-y:auto;background-color:white;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-color:#7f9db9;border-right-color:#7f9db9;border-bottom-color:#7f9db9;border-left-color:#7f9db9;font-family:&amp;#39;courier new&amp;#39;;font-size:11px;"&gt;&lt;table cellpadding="0" cellspacing="0" style="width:99%;margin-top:2px;margin-right:0px;margin-bottom:2px;margin-left:0px;border-collapse:collapse;border-bottom-style:solid;border-bottom-color:#eeeeee;background-color:#ffffff;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;"&gt;                &lt;tr&gt;            &lt;td&gt;&lt;span style="font-size:11px;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt;&lt;span style="font-size:11px;"&gt; System; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt;&lt;span style="font-size:11px;"&gt; Microsoft.Xna.Framework.Content.Pipeline; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt;&lt;span style="font-size:11px;"&gt; System.IO; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt; &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;&lt;span style="color:green;"&gt;// TODO: replace these with the processor input and output types.&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt;&lt;span style="font-size:11px;"&gt; TInput = System.Array; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt;&lt;span style="font-size:11px;"&gt; TOutput = System.String; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;&lt;span style="color:green;"&gt;// TODO: replace this with the type you want to import.&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt;&lt;span style="font-size:11px;"&gt; TImport = System.Array; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt; &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;&lt;span style="color:blue;"&gt;namespace&lt;/span&gt;&lt;span style="font-size:11px;"&gt; TextFileExtension &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;{ &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:green;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    &lt;span style="color:green;"&gt;/// This class will be instantiated by the XNA Framework Content Pipeline&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:green;"&gt;/// to apply custom processing to content data, converting an object of&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    &lt;span style="color:green;"&gt;/// type TInput to TOutput. The input and output types may be the same if&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:green;"&gt;/// the processor wishes to alter data without changing its type.&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    &lt;span style="color:green;"&gt;///&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:green;"&gt;/// This should be part of a Content Pipeline Extension Library project.&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    &lt;span style="color:green;"&gt;///&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:green;"&gt;/// TODO: change the ContentProcessor attribute to specify the correct&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    &lt;span style="color:green;"&gt;/// display name for this processor.&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:green;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    [ContentProcessor(DisplayName = &lt;span style="color:blue;"&gt;&amp;quot;TextFileExtension.TextFileProcessor&amp;quot;&lt;/span&gt;&lt;span style="font-size:11px;"&gt;)] &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:blue;"&gt;public&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;class&lt;/span&gt;&lt;span style="font-size:11px;"&gt; TextFileProcessor : ContentProcessor&amp;lt;TInput, TOutput&amp;gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    { &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;override&lt;/span&gt;&lt;span style="font-size:11px;"&gt; TOutput Process(TInput input, ContentProcessorContext context) &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;        { &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;            &lt;span style="color:blue;"&gt;return&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt;&lt;span style="font-size:11px;"&gt; String((&lt;/span&gt;&lt;span style="color:blue;"&gt;char&lt;/span&gt;&lt;span style="font-size:11px;"&gt; [])input); &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;        } &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    } &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt; &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:green;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    &lt;span style="color:green;"&gt;/// This class will be instantiated by the XNA Framework Content Pipeline&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:green;"&gt;/// to import a file from disk into the specified type, TImport.&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    &lt;span style="color:green;"&gt;/// &lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:green;"&gt;/// This should be part of a Content Pipeline Extension Library project.&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    &lt;span style="color:green;"&gt;/// &lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:green;"&gt;/// TODO: change the ContentImporter attribute to specify the correct file&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    &lt;span style="color:green;"&gt;/// extension, display name, and default processor for this importer.&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:green;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    [ContentImporter(&lt;span style="color:blue;"&gt;&amp;quot;.TXT&amp;quot;&lt;/span&gt;&lt;span style="font-size:11px;"&gt;, DisplayName = &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;quot;TextFileExtension.TextFileImporter&amp;quot;&lt;/span&gt;&lt;span style="font-size:11px;"&gt;, DefaultProcessor = &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;quot;TextFileExtension.TextFileProcessor&amp;quot;&lt;/span&gt;&lt;span style="font-size:11px;"&gt;)] &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    &lt;span style="color:blue;"&gt;public&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;class&lt;/span&gt;&lt;span style="font-size:11px;"&gt; TextFileImporter : ContentImporter&amp;lt;TImport&amp;gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;    { &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;override&lt;/span&gt;&lt;span style="font-size:11px;"&gt; TImport Import(&lt;/span&gt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;&lt;span style="font-size:11px;"&gt; filename, ContentImporterContext context) &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;        { &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;            &lt;span style="color:blue;"&gt;char&lt;/span&gt;&lt;span style="font-size:11px;"&gt;[] result = &lt;/span&gt;&lt;span style="color:blue;"&gt;null&lt;/span&gt;&lt;span style="font-size:11px;"&gt;; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;            FileStream fs = File.OpenRead(filename); &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;            StreamReader sr = &lt;span style="color:blue;"&gt;new&lt;/span&gt;&lt;span style="font-size:11px;"&gt; StreamReader(fs); &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt; &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;            BinaryReader binReader = &lt;span style="color:blue;"&gt;new&lt;/span&gt;&lt;span style="font-size:11px;"&gt; BinaryReader(File.OpenRead(filename)); &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;            &lt;span style="color:blue;"&gt;try&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;            { &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;                &lt;span style="color:blue;"&gt;byte&lt;/span&gt;&lt;span style="font-size:11px;"&gt;[] sizeArray = &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;byte&lt;/span&gt;&lt;span style="font-size:11px;"&gt;[2]; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;                &lt;span style="color:blue;"&gt;int&lt;/span&gt;&lt;span style="font-size:11px;"&gt; count = binReader.Read(sizeArray, 0, 2); &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;                &lt;span style="color:blue;"&gt;if&lt;/span&gt;&lt;span style="font-size:11px;"&gt; (count != 0) &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;                { &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;                    binReader.BaseStream.Seek(0, SeekOrigin.Begin); &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;                    result = binReader.ReadChars((&lt;span style="color:blue;"&gt;int&lt;/span&gt;&lt;span style="font-size:11px;"&gt;)fs.Length); &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;                } &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;            } &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;            &lt;span style="color:blue;"&gt;catch&lt;/span&gt;&lt;span style="font-size:11px;"&gt; (EndOfStreamException e) &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;            { &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;                Console.WriteLine(&lt;span style="color:blue;"&gt;&amp;quot;{0} caught and ignored. &amp;quot;&lt;/span&gt;&lt;span style="font-size:11px;"&gt; + &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;                    &lt;span style="color:blue;"&gt;&amp;quot;Using default values.&amp;quot;&lt;/span&gt;&lt;span style="font-size:11px;"&gt;, e.GetType().Name); &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;            } &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;            &lt;span style="color:blue;"&gt;finally&lt;/span&gt;&lt;span style="font-size:11px;"&gt; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;            { &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;                binReader.Close(); &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;            } &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;            &lt;span style="color:blue;"&gt;return&lt;/span&gt;&lt;span style="font-size:11px;"&gt; result; &lt;/span&gt;&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;        } &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;    } &lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td style="background-color:#f7f7f7;"&gt;} &lt;/td&gt;        &lt;/tr&gt;    &lt;/table&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Just add a reference to that project in the content folder and set your text file to &amp;quot;compile&amp;quot; and the importer/processor to TextFileProcessor/TextFileImporter&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is for 3.1 of course, as it doesn&amp;#39;t implement any ContentTypeWriter (I think that 3.1 automatically generate writers, but it might work on 3.0 because Strings might not need a custom writer... But what do I know...)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</description></item><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/224478.aspx</link><pubDate>Tue, 08 Sep 2009 22:19:16 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:224478</guid><dc:creator>TooMuchCaffeine</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/224478.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=224478</wfw:commentRss><description>Bryon, Craig - just wanted to add my thanks. This was driving me mad but a search of the forums brought me to your advice. My game is now running smoothly again.</description></item><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/133328.aspx</link><pubDate>Thu, 29 Jan 2009 12:10:15 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:133328</guid><dc:creator>nickE</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/133328.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=133328</wfw:commentRss><description>hi craig.&amp;nbsp; it worked after i followed Bryon&amp;#39;s method. thanx a lot you guys. :-)&lt;br /&gt;</description></item><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/132474.aspx</link><pubDate>Tue, 27 Jan 2009 12:56:27 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:132474</guid><dc:creator>Craig Martin</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/132474.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=132474</wfw:commentRss><description>The right thing to do is use Byrons method.&lt;br /&gt;
&lt;br /&gt;
When you open the file at runtime you need to specify the path from the
&amp;#39;Working Directory&amp;#39;. When running in debug mode, by default the &amp;#39;Working Directioy&amp;#39; is \...\bin\x86\Debug\&amp;#39;. So if you put SomeFile.txt in your Content folder,
then at build time it will be copied to the \...\bin\x86\Debug\Content folder, so you need to open @&amp;quot;Content\SomeFile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If you put SomeFile.txt in the root directory of your project,
then at build time it will be copied to the \...\bin\x86\Debug folder, so you just need to open @&amp;quot;SomeFile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If you put SomeFile.txt in your Content\Maps\Special folder,
then at build time it will be copied to the \...\bin\x86\Debug\Content\Maps\Special folder, so you need to open @&amp;quot;Content\Maps\Special\SomeFile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description></item><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/132467.aspx</link><pubDate>Tue, 27 Jan 2009 12:31:07 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:132467</guid><dc:creator>nickE</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/132467.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=132467</wfw:commentRss><description>hello MrLeebo&lt;br /&gt;
&lt;br /&gt;
i pasted the code in the \...\bin\x86\Debug\ not in the \...\bin\x86\Debug\Content\. so whats the difference? &lt;br /&gt;
&lt;br /&gt;
what&amp;#39;s the right thing to do here? :-)&lt;br /&gt;</description></item><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/132013.aspx</link><pubDate>Mon, 26 Jan 2009 05:49:39 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:132013</guid><dc:creator>MrLeebo</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/132013.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=132013</wfw:commentRss><description>It will cause problems if you leave it like that. Most likely your code is searching \...\bin\x86\Debug\ for the file but you&amp;#39;re sending it to \...\bin\x86\Debug\Content\&lt;br /&gt;
&lt;br /&gt;
Either search in the place you put it or put it in the place you&amp;#39;re searching.</description></item><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/131938.aspx</link><pubDate>Sun, 25 Jan 2009 23:14:57 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:131938</guid><dc:creator>nickE</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/131938.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=131938</wfw:commentRss><description>Hi byron&lt;br /&gt;
&lt;br /&gt;
i was able to solve the problem but in a very unusual way. I just thought, the program was looking for the text file in the following directory:&lt;br /&gt;
&lt;br /&gt;
C:\Users\Nico\Documents\Visual Studio 2008\Projects\ZombieSmashers\MapEditor\bin\x86\Debug&lt;br /&gt;
&lt;br /&gt;
so i copied my text file into that directory and it worked. but i was just worried if it&amp;#39;ll cause some bugs later on  in the project. Your opinions are fully appreciated bro.&lt;br /&gt;
&lt;br /&gt;
thnx in advance.</description></item><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/131807.aspx</link><pubDate>Sun, 25 Jan 2009 14:48:47 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:131807</guid><dc:creator>nickE</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/131807.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=131807</wfw:commentRss><description>hi byron!&lt;br /&gt;
&lt;br /&gt;
I also have the same errors when adding text files in my projects. but when i followd your solution to the problem, another exception appeared. here is the copy of the exception:&lt;br /&gt;
&lt;br /&gt;
System.IO.FileNotFoundException was unhandled&lt;br /&gt;
  Message=&amp;quot;Could not find file &amp;#39;C:\\Users\\Nico\\Documents\\Visual Studio 2008\\Projects\\ZombieSmashers\\MapEditor\\bin\\x86\\Debug\\maps&amp;#39;.&amp;quot;&lt;br /&gt;
  Source=&amp;quot;mscorlib&amp;quot;&lt;br /&gt;
  FileName=&amp;quot;C:\\Users\\Nico\\Documents\\Visual Studio 2008\\Projects\\ZombieSmashers\\MapEditor\\bin\\x86\\Debug\\maps&amp;quot;&lt;br /&gt;
  StackTrace:&lt;br /&gt;
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)&lt;br /&gt;
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)&lt;br /&gt;
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)&lt;br /&gt;
       at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)&lt;br /&gt;
       at System.IO.StreamReader..ctor(String path)&lt;br /&gt;
       at MapEditor.MapClasses.Map.ReadSegmentDefinitions() in C:\Users\Nico\Documents\Visual Studio 2008\Projects\ZombieSmashers\MapEditor\MapClasses\Map.cs:line 24&lt;br /&gt;
       at MapEditor.MapClasses.Map..ctor() in C:\Users\Nico\Documents\Visual Studio 2008\Projects\ZombieSmashers\MapEditor\MapClasses\Map.cs:line 20&lt;br /&gt;
       at MapEditor.Game1.Initialize() in C:\Users\Nico\Documents\Visual Studio 2008\Projects\ZombieSmashers\MapEditor\Game1.cs:line 48&lt;br /&gt;
       at Microsoft.Xna.Framework.Game.Run()&lt;br /&gt;
       at MapEditor.Program.Main(String[] args) in C:\Users\Nico\Documents\Visual Studio 2008\Projects\ZombieSmashers\MapEditor\Program.cs:line 14&lt;br /&gt;
  InnerException: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Could you helpo me out? what could possibly be wrong here?&lt;br /&gt;
Thanx in advance..:-)</description></item><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/128018.aspx</link><pubDate>Tue, 13 Jan 2009 12:49:11 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:128018</guid><dc:creator>akira32</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/128018.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=128018</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;Byron Nelson:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;I&amp;#39;ve got some text files in my content directory.   I just drop them in, open properites, set &lt;strong&gt;Build Action to None&lt;/strong&gt;, Copy to Output Directory to &amp;quot;Copy Always&amp;quot; (( mine change often )) and leave the other fields blank &amp;amp; it works fine for me.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;
&lt;br /&gt;
Thank you,Byron Nelson!! I had solved this problem by your way.</description></item><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/127757.aspx</link><pubDate>Mon, 12 Jan 2009 17:14:03 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:127757</guid><dc:creator>Byron Nelson</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/127757.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=127757</wfw:commentRss><description>I&amp;#39;ve got some text files in my content directory.   I just drop them in, open properites, set &lt;strong&gt;Build Action to None&lt;/strong&gt;, Copy to Output Directory to &amp;quot;Copy Always&amp;quot; (( mine change often )) and leave the other fields blank &amp;amp; it works fine for me.</description></item><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/127747.aspx</link><pubDate>Mon, 12 Jan 2009 16:51:30 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:127747</guid><dc:creator>akira32</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/127747.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=127747</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;Count:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Add the text file to the Content folder in your project workspace. Set its &amp;#39;Copy to Output Folder&amp;#39; property. Then you can load it from &amp;quot;Content/myfilename.txt&amp;quot; in the game.&lt;br /&gt;
&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;
&lt;br /&gt;
If I just add text file to Content and do not select Content Importer and Content Processor, it will appear the error as below:&lt;br /&gt;
&lt;br /&gt;
Content\aaa.txt : error : Cannot autodetect which importer to use for &amp;quot;aaa.txt&amp;quot;. There are no importers which handle this file type. Specify the importer that handles this file type in your project.&lt;br /&gt;
Done building project &amp;quot;Content.contentproj&amp;quot; -- FAILED.</description></item><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/127504.aspx</link><pubDate>Sun, 11 Jan 2009 22:07:03 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:127504</guid><dc:creator>MrLeebo</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/127504.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=127504</wfw:commentRss><description>If it&amp;#39;s just going to be a text string file, you could also use a Resource file instead (.resx) since then you&amp;#39;ll get compile-time validation on the string keys and a resource file can store other objects like pictures. This way you can support language translation of in-game textures such as sign posts.</description></item><item><title>Re: How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/127494.aspx</link><pubDate>Sun, 11 Jan 2009 21:37:45 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:127494</guid><dc:creator>Count</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/127494.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=127494</wfw:commentRss><description>Add the text file to the Content folder in your project workspace. Set its &amp;#39;Copy to Output Folder&amp;#39; property. Then you can load it from &amp;quot;Content/myfilename.txt&amp;quot; in the game.&lt;br /&gt;</description></item><item><title>How to I add a text file to content</title><link>http://forums.xna.com/forums/thread/127112.aspx</link><pubDate>Sat, 10 Jan 2009 07:54:55 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:127112</guid><dc:creator>akira32</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/127112.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=127112</wfw:commentRss><description>How to I add a text file to content?&lt;br /&gt;
How to set the Content Importer and the Content Processor for text file?&lt;br /&gt;
&lt;br /&gt;
string output = System.IO.File.ReadAllText(&amp;quot;FileContainingAllMyGameText.txt&amp;quot;);&lt;br /&gt;</description></item></channel></rss>