예제 #1
0
        /// <summary>
        /// Create an instance of an IFile from the given local path.
        /// Note that this creates a new LocalDirectory object each time it is
        /// called. If you are opening a lot of files from one directory, it's more
        /// efficient to grab the directory with Util.LocalDir(), then get each
        /// file from there.
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        public static IFile LocalFile(string file)
        {
            IDirectory d = new Local.LocalDirectory(Path.GetDirectoryName(file));
            IFile      f = d.GetFile(Path.GetFileName(file));

            return(f);
        }
예제 #2
0
 public override bool TryGetDirectory(string name, out IDirectory dir)
 {
     if (dirs.TryGetValue(name, out dir))
     {
         return(true);
     }
     else if (Directory.Exists(Path.Combine(path, name)))
     {
         dir = new LocalDirectory(Path.Combine(path, name));
         AddDir(dir);
         return(true);
     }
     return(false);
 }
예제 #3
0
        /// <summary>
        /// Opens a directory from the local filesystem as an IDirectory
        /// </summary>
        /// <param name="dir">Path to the directory.</param>
        /// <returns>An IDirectory representing the local directory.</returns>
        public static IDirectory LocalDir(string dir)
        {
            IDirectory d = new Local.LocalDirectory(dir);

            return(d);
        }