public static void RefreshSourceFileCache(this ReferencedFileSave instance, bool buildOnMissingFile, out string error) { error = null; string verboseError = ""; string fullName = ProjectManager.MakeAbsolute(instance.Name, true); try { // If it has a SourceFile, then no need to throw an error here, it will be built if (!FileManager.FileExists(fullName) && string.IsNullOrEmpty(instance.SourceFile)) { } else { instance.SourceFileCache = ContentParser.GetSourceReferencingFilesReferencedByAsset(fullName, TopLevelOrRecursive.Recursive, ErrorBehavior.ContinueSilently, ref error, ref verboseError); bool hasErrorOccurred = !string.IsNullOrEmpty(error); if (!string.IsNullOrEmpty(verboseError)) { int m = 3; } // If the file doesn't exist, no reason to do this, just build it if (hasErrorOccurred) { bool forceError = false; if (buildOnMissingFile && (!string.IsNullOrEmpty(instance.SourceFile) || instance.SourceFileCache.Count != 0)) { string subError = instance.PerformExternalBuild(runAsync: false); if (!string.IsNullOrEmpty(subError)) { error += "\nTried to build the file, but also got this error:\n" + subError; // This will be returned through the "out" //ErrorReporter.ReportError(fullName, error, forceError); } else if (System.IO.File.Exists(fullName)) { } } else { string message = ""; if (!FileManager.FileExists(fullName)) { message = "Could not find the file\n\n" + fullName + "\n\n" + "Glue will not be able to properly track dependencies and add the necessary files " + "to your project until this file is added.\n\nThis often happens if someone forgot to " + "check something in to Subversion."; } else { message = "Error tracking dependencies for\n\n" + fullName + "\n\nError details:\n\n" + error; } error = message; } } } ContentParser.EliminateDuplicateSourceReferencingFiles(instance.SourceFileCache); } catch (Exception e) { error = "Error getting referenced files for\n\n" + fullName + "\n\nError:\n\n" + e.ToString(); } }