I'm building a content editor for an XNA game and I've got my Content Readers and Writers ready. In my editor, I'll be iterating over all the files in my folder to display a list of objects in my editor window. I've got the things set up, but I'm stuck with what I'll do after getting the file list of my content folder.
All the files have the XNB extension, and the only (non-hacky) way to read them is to use the XNA Content Reader. But I'd like to know the content type of the files (is it a map or a game object template or anything from lots of other types that I've defined) in advance without loading them all one by one and trying to load each with each of the possible content types, it is practically impossible (or let's say, worst programming practice ever).
How can I get something like this functionality:
ContentManager.ContentTypeOf(string assetPath);
that returns a type, so I can know in advance what to load (and not load) where. It won't be a good idea to load all the maps of the game just to edit a single object template. There must be a practical way to distinguish the types of the content files.
Ok, after not finding any trivial solution with actually reading the files, I've decided to organize the files into a folder hierarchy, and I now know what file is what. It does the job at least. May not be the most feasible solution, but, it works.