Skip to content
This repository

Modified MetroHelper.AppDataFileExists to correctly work with files insi... #858

Merged
merged 1 commit into from over 1 year ago

3 participants

Ananth Tom Spilman Steve 'Sly' Williams
Ananth

...de nested folders.

The current code doesn't handle cases where a the file is nested inside folders correctly. This methods handles that case and doesn't incorrectly throw a ContentLoadException.

Tom Spilman
Collaborator

We to be honest that method and its caller should not exist to begin with.

MetroHelper.AppDataFileExists() is only used from the ContentManager.Normalize<>() calls. That is the old junk used to work around the content pipeline and allow the ContentManager to process files not packaged in XNBs. That system is an abomination that still lives because the content pipeline tools have not been finished yet.

That said... the Windows Metro code does not require that hack. You can completely use the stock XNA content pipeline tools in VS2010 to build content for a Metro MonoGame game.

IMO MetroHelper.cs should be removed and the Normalize() methods and the fallback to use them in the ContentManager should all be #if out for WinRT.

Ananth

I see. IMO, the problem with doing that is - we'll HAVE to use the XNA content pipeline, which probably means installing XNA Game Studio which has known compatibility problems with Windows 8. I prefer using the raw assets and am doing so for all platforms except Windows+XNA. Also - can we add a contentproj reference to a Metro game? If not, asset import will become a two stage process - first run them through the content processor and THEN add them to the project. I can see that modifying/editing assets will be a pain given that workflow, as opposed to just rebuilding them after modifying the linked (copy to output if newer) asset.

In either case - I needed it to even get my PNG assets loaded and therefore would like to see this change in the main repo so I can add it as a submodule as opposed to my own fork. Do let me know how to proceed! Thanks!

Steve 'Sly' Williams
Collaborator
Tom Spilman
Collaborator

we'll HAVE to use the XNA content pipeline

You will have to use the content pipeline with MonoGame within the next few months.

XNA Game Studio which has known compatibility problems with Windows 8

We use it on Windows 8 just fine. Making it install correctly is simple and documented.

http://blogs.msdn.com/b/astebner/archive/2012/02/29/10274694.aspx

can we add a contentproj reference to a Metro game?

Not at the moment... the WP8 SDK will allow it, but for now you need to create a VS2010 project and copy the content over when your done.

Ananth

Ok, that sounds good - I would be ok to get rid of these changes when a proper content pipeline in put in place. As it is, the current code doesn't work in certain cases that's definitely a problem.

Steve 'Sly' Williams KonajuGames merged commit ebd4da6 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 12, 2012
Ananth ananthonline Modified MetroHelper.AppDataFileExists to correctly work with files i…
…nside nested folders.
f6d4626
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 5 deletions. Show diff stats Hide diff stats

  1. +2 5 MonoGame.Framework/Windows8/MetroHelper.cs
7 MonoGame.Framework/Windows8/MetroHelper.cs
@@ -16,16 +16,13 @@ static public bool AppDataFileExists(string fileName)
16 16
17 17 try
18 18 {
19   - var localFolder = ApplicationData.Current.LocalFolder;
20   - var storageFile = await localFolder.GetFileAsync(fileName);
  19 + var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(fileName);
  20 + return file == null ? false : true;
21 21 }
22 22 catch (FileNotFoundException)
23 23 {
24 24 return false;
25 25 }
26   -
27   - return true;
28   -
29 26 }).Result;
30 27
31 28 return result;

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.