c# - Building Content in Winform XNA -


I have been able to successfully construct my Vinophy using the content, but my question is how do you get the content The next time you open it, the editor will come back in the content, .xnb, the file is currently being saved in a temporary folder, whether by any means the content can be reloaded in the editor again and every Make the file again To?

Can I save it to the contents folder inside bin / folder and then search for folder and .xnb files on that startup and load them? Or is there any easy way to do this?

Another WinForms sample has an HTML readme file that describes how the application was created in a temporary directory Saves content and then deletes it when the program stops.

This is a significant bit:

Depending on your application, always like to use the same temporary directory name, and never delete it. This will leave files lying on your hard drive. The content creation process is incremental if your program tries to load the same content files already created during the previous content, then you will not need to complete any actual processing tasks. This level can accelerate loading times for programs like editors, who want to load the same file every time they begin.

It says that the temporary directory is removed " ContentBuilder.DeleteTempDirectory , which is called by Disposal ". Just find the call on DeleteTempDirectory and delete it.

The remade file describes in more detail how a temporary directory is selected (and why). You can modify CreateTempDirectory to better suit your application. For example, if your editor has "level" files, you can save your created content (.xnb files) in the subdirectory next to your level with the same name, so that your game can easily open the created content .


Once your files are being placed between sessions - you just have to reload them. Two obvious ways to store a list of files that are open, and reload the next session. Or just open it in your output directory:

There is some hard code to do later (not accepting a subdirectory):

  string folder = @ "C: \ TemporaryXNAFilesOrWhatever"; & Lt; Texture2D> Texture = new list & lt; Texture2D> (); ContentManager content = new ContentManager (serviceProvider, folder); String [] files = directory. Gate files (folder, "* .xnb"); Foreach (string file in file) {string assetName = path GatefileNumeric expansion (file); Textures.Add (content.Load & lt; Texture2D & gt; (assetName)); }  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -