Example #1
0
        /// <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;
                }
            }
        }
Example #2
0
        /// <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;
                }
            }
        }
Example #3
0
 /// <summary>
 /// Determines whether the specified path starts with this
 /// mapping's prefix.
 /// </summary>
 /// <param name="aPath">The path to check.</param>
 /// <returns>
 /// Whether the specified path starts with this
 /// mapping's prefix.
 /// </returns>
 public bool PathMatchesMapping(FOS_System.String aPath)
 {
     return aPath.ToUpper().StartsWith(prefix);
 }