public T LoadFromProject <T>(string assetName) { string oldRelativePath = FileManager.RelativeDirectory; FlatRedBall.IO.FileManager.RelativeDirectory = FileManager.GetDirectory(assetName); #if DEBUG bool shouldCheckForXnb = true; #if ANDROID if (typeof(T) == typeof(Song)) { shouldCheckForXnb = false; } #endif string fileToCheckFor = assetName + ".xnb"; if (shouldCheckForXnb && !FileManager.FileExists(fileToCheckFor)) { string errorString = "Could not find the file " + fileToCheckFor + "\n"; #if !WINDOWS_8 List <string> filesInDirectory = FileManager.GetAllFilesInDirectory(FileManager.GetDirectory(assetName), null, 0); errorString += "Found the following files:\n\n"; foreach (string s in filesInDirectory) { errorString += FileManager.RemovePath(s) + "\n"; } #endif throw new FileNotFoundException(errorString); } #endif #if XNA4 && !MONOGAME if (!FileManager.IsRelative(assetName)) { assetName = FileManager.MakeRelative( assetName, System.Windows.Forms.Application.StartupPath + "/"); } #endif #if USES_DOT_SLASH_ABOLUTE_FILES T asset; if (assetName.StartsWith(@".\") || assetName.StartsWith(@"./")) { asset = base.Load <T>(assetName.Substring(2)); } else { asset = base.Load <T>(assetName); } #else T asset = base.Load <T>(assetName); #endif if (!mAssets.ContainsKey(assetName)) { mAssets.Add(assetName, asset); } FileManager.RelativeDirectory = oldRelativePath; return(AdjustNewAsset(asset, assetName)); }