Esempio n. 1
0
 protected virtual bool FileExists(string fullPath)
 {
     Debug.Assert(fullPath != null);
     Debug.Assert(PathUtilities.IsAbsolute(fullPath));
     return(File.Exists(fullPath));
 }
Esempio n. 2
0
 public static string ResolveRelativePath(string path, string basePath, string baseDirectory)
 {
     Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory));
     return(ResolveRelativePath(PathUtilities.GetPathKind(path), path, basePath, baseDirectory));
 }
Esempio n. 3
0
 /// <summary>
 /// Enumerates files in the specified directory and subdirectories whose name matches the given pattern.
 /// </summary>
 /// <param name="directory">Full path of the directory to enumerate.</param>
 /// <param name="fileNamePattern">File name pattern. May contain wildcards '*' (matches zero or more characters) and '?' (matches any character).</param>
 /// <param name="searchOption">Specifies whether to search the specified <paramref name="directory"/> only, or all its subdirectories as well.</param>
 /// <returns>Sequence of file paths.</returns>
 public virtual IEnumerable <string> EnumerateFiles(string directory, string fileNamePattern, SearchOption searchOption)
 {
     Debug.Assert(PathUtilities.IsAbsolute(directory));
     return(Directory.EnumerateFiles(directory, fileNamePattern, searchOption));
 }
Esempio n. 4
0
        public static Stream OpenAsyncRead(string fullPath)
        {
            Debug.Assert(PathUtilities.IsAbsolute(fullPath));

            return(RethrowExceptionsAsIOException(() => new FileStream(fullPath, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, FileOptions.Asynchronous)));
        }