public IEnumerable <string> GetFilesReferencedBy(string absoluteName, EditorObjects.Parsing.TopLevelOrRecursive topLevelOrRecursive) { #if GLUE return(FileReferenceManager.Self.GetFilesReferencedBy(absoluteName, topLevelOrRecursive)); #else throw new NotImplementedException(); #endif }
public void GetFilesReferencedBy(string file, EditorObjects.Parsing.TopLevelOrRecursive depth, List <string> listToFill) { if (CanFileReferenceContent(file)) { listToFill.AddRange( ContentParser.GetFilesReferencedByAsset(file)); } }
public List <string> GetFilesReferencedBy(string absoluteName, EditorObjects.Parsing.TopLevelOrRecursive topLevelOrRecursive) { List <string> toReturn = new List <string>(); GetFilesReferencedBy(absoluteName, topLevelOrRecursive, listToFill: toReturn); return(toReturn); }
public List <string> GetFilesNeededOnDiskBy(string absoluteName, EditorObjects.Parsing.TopLevelOrRecursive topLevelOrRecursive) { List <string> topLevelOnly = null; bool handledByCache = false; string standardized = FileManager.Standardize(absoluteName); if (filesNeededOnDisk.ContainsKey(standardized)) { // compare dates: bool isOutOfDate = File.Exists(standardized) && //File.GetLastWriteTime(standardized) > filesNeededOnDisk[standardized].LastWriteTime; // Do a != in case the user reverts a file File.GetLastWriteTime(standardized) != filesNeededOnDisk[standardized].LastWriteTime; if (!isOutOfDate) { handledByCache = true; topLevelOnly = filesNeededOnDisk[standardized].References; } } if (!handledByCache) { // todo: do we want to change this to use topLevelOnly = ContentParser.GetFilesReferencedByAsset(absoluteName, TopLevelOrRecursive.TopLevel); PluginManager.GetFilesNeededOnDiskBy(absoluteName, TopLevelOrRecursive.TopLevel, topLevelOnly); // let's remove ../ if we can: for (int i = 0; i < topLevelOnly.Count; i++) { topLevelOnly[i] = FlatRedBall.IO.FileManager.RemoveDotDotSlash(topLevelOnly[i]); } filesNeededOnDisk[standardized] = new FileReferenceInformation { LastWriteTime = File.Exists(standardized) ? File.GetLastWriteTime(standardized) : DateTime.MinValue, References = topLevelOnly }; } List <string> toReturn = new List <string>(); toReturn.AddRange(topLevelOnly); if (topLevelOrRecursive == TopLevelOrRecursive.Recursive) { foreach (var item in topLevelOnly) { toReturn.AddRange(GetFilesNeededOnDiskBy(item, TopLevelOrRecursive.Recursive)); } } return(toReturn); }
public IEnumerable <FilePath> GetFilePathsReferencedBy(string absoluteName, EditorObjects.Parsing.TopLevelOrRecursive topLevelOrRecursive) { return(GetFilesReferencedBy(absoluteName, topLevelOrRecursive).Select(item => new FilePath(item))); }
public IEnumerable <FilePath> GetFilePathsReferencedBy(ReferencedFileSave file, EditorObjects.Parsing.TopLevelOrRecursive topLevelOrRecursive) { var absolute = GlueCommands.GetAbsoluteFileName(file); return(GetFilesReferencedBy(absolute, topLevelOrRecursive).Select(item => new FilePath(item))); }
public IEnumerable <string> GetFilesReferencedBy(ReferencedFileSave file, EditorObjects.Parsing.TopLevelOrRecursive topLevelOrRecursive) { var absolute = GlueCommands.GetAbsoluteFileName(file); return(GetFilesReferencedBy(absolute, topLevelOrRecursive)); }
public IEnumerable <string> GetFilesReferencedBy(string absoluteName, EditorObjects.Parsing.TopLevelOrRecursive topLevelOrRecursive) { return(FileReferenceManager.Self.GetFilesReferencedBy(absoluteName, topLevelOrRecursive)); }
public void GetFilesReferencedBy(string absoluteName, EditorObjects.Parsing.TopLevelOrRecursive topLevelOrRecursive, List <string> listToFill) { List <string> topLevelOnly = null; bool handledByCache = false; string standardized = FileManager.Standardize(absoluteName); if (fileReferences.ContainsKey(standardized)) { // compare dates: bool isOutOfDate = File.Exists(standardized) && //File.GetLastWriteTime(standardized) > fileReferences[standardized].LastWriteTime; // Do a != in case the user reverts a file File.GetLastWriteTime(standardized) != fileReferences[standardized].LastWriteTime; if (!isOutOfDate) { handledByCache = true; topLevelOnly = fileReferences[standardized].References; } } if (!handledByCache) { bool succeeded = false; try { topLevelOnly = ContentParser.GetFilesReferencedByAsset(absoluteName, TopLevelOrRecursive.TopLevel); succeeded = true; } // August 26, 2017 // I used to have this throw an error when a file was missing, but plugins may not know to handle it, so let's just print // output instead catch (FileNotFoundException e) { PluginManager.ReceiveError(e.ToString()); } if (succeeded) { var response = PluginManager.GetFilesReferencedBy(absoluteName, TopLevelOrRecursive.TopLevel, topLevelOnly); if (response.Succeeded) { // let's remove ../ if we can: for (int i = 0; i < topLevelOnly.Count; i++) { topLevelOnly[i] = FlatRedBall.IO.FileManager.RemoveDotDotSlash(topLevelOnly[i]); } var referenceInfo = new FileReferenceInformation { LastWriteTime = File.Exists(standardized) ? File.GetLastWriteTime(standardized) : DateTime.MinValue, References = topLevelOnly }; try { fileReferences[standardized] = referenceInfo; } catch (Exception e) { int m = 3; throw e; } if (FilesWithFailedGetReferenceCalls.ContainsKey(absoluteName)) { FilesWithFailedGetReferenceCalls.Remove(absoluteName); } } else { FilesWithFailedGetReferenceCalls[absoluteName] = response; // todo - need to raise an event here on parse error: PluginManager.HandleFileReadError(absoluteName, response); } } } // topLevelOnly could be null if a file wasn't found if (topLevelOnly != null) { var newFiles = topLevelOnly.Except(listToFill).ToList(); listToFill.AddRange(newFiles); if (topLevelOrRecursive == TopLevelOrRecursive.Recursive) { foreach (var item in newFiles) { GetFilesReferencedBy(item, TopLevelOrRecursive.Recursive, listToFill); } } } }