/// <summary> /// Attempts to find the specified directory within any file system. /// </summary> /// <param name="directoryName">The full path and name of the directory to find.</param> /// <returns>The directory or null if it isn't found.</returns> public static Directory Find(FOS_System.String directoryName) { FileSystemMapping theMapping = FileSystemManager.GetMapping(directoryName); if (theMapping == null) { return(null); } directoryName = theMapping.RemoveMappingPrefix(directoryName); directoryName = directoryName.ToUpper(); Base baseListing = theMapping.TheFileSystem.GetListing(directoryName); if (baseListing == null) { return(null); } else { if (baseListing is Directory) { return((Directory)baseListing); } else { return(null); } } }
/// <summary> /// Opens the specified file. /// </summary> /// <param name="fileName">The full path to the file to open.</param> /// <returns>The file listing or null if not found.</returns> public static File Open(FOS_System.String fileName) { FileSystemMapping theMapping = FileSystemManager.GetMapping(fileName); if (theMapping == null) { return(null); } fileName = theMapping.RemoveMappingPrefix(fileName); fileName = fileName.ToUpper(); Base baseListing = theMapping.TheFileSystem.GetListing(fileName); if (baseListing == null) { return(null); } else { if (baseListing is File) { return((File)baseListing); } else { return(null); } } }
/// <summary> /// Determines whether the specified partition has any file system mappings associated with it. /// </summary> /// <param name="part">The partition to check.</param> /// <returns>Whether there are any file system mappings for the partition.</returns> public static bool HasMapping(Partition part) { for (int i = 0; i < FileSystemMappings.Count; i++) { FileSystemMapping mapping = (FileSystemMapping)FileSystemMappings[i]; if (mapping.TheFileSystem.ThePartition == part) { return(true); } } return(false); }
/// <summary> /// Gets the file system mapping for the specified path. /// </summary> /// <param name="aPath">The path to get the mapping for.</param> /// <returns>The file system mapping or null if none exists.</returns> public static FileSystemMapping GetMapping(FOS_System.String aPath) { FileSystemMapping result = null; for (int i = 0; i < FileSystemMappings.Count; i++) { FileSystemMapping aMapping = (FileSystemMapping)FileSystemMappings[i]; if (aMapping.PathMatchesMapping(aPath)) { result = aMapping; break; } } return(result); }