Beispiel #1
0
 /// <summary>
 /// Deletes the directory that is referred to by the specified path.
 /// </summary>
 /// <param name="path"></param>
 public static void Delete(string path)
 {
     if (string.IsNullOrWhiteSpace(path))
     {
         return;
     }
     PathOp.CheckInvalidPathChars(path);
     PathOp.ResolveFileSystem(ref path).DeleteDirectory(path);
 }
Beispiel #2
0
 /// <summary>
 /// Returns whether the specified path refers to an existing directory.
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 public static bool Exists(string path)
 {
     if (string.IsNullOrWhiteSpace(path))
     {
         return(false);
     }
     PathOp.CheckInvalidPathChars(path);
     return(PathOp.ResolveFileSystem(ref path).DirectoryExists(path));
 }
Beispiel #3
0
 /// <summary>
 /// Creates a directory tree matching the specified directory path.
 /// </summary>
 /// <param name="path"></param>
 public static void Create(string path)
 {
     if (string.IsNullOrWhiteSpace(path))
     {
         throw new ArgumentException("The specified path is null or whitespace-only.");
     }
     PathOp.CheckInvalidPathChars(path);
     PathOp.ResolveFileSystem(ref path).CreateDirectory(path);
 }
Beispiel #4
0
 /// <summary>
 /// Opens an existing file at the specified path and returns a <see cref="System.IO.Stream"/> to it.
 /// </summary>
 /// <param name="path"></param>
 /// <param name="mode"></param>
 public static Stream Open(string path, FileAccessMode mode)
 {
     if (string.IsNullOrWhiteSpace(path))
     {
         throw new ArgumentException("The specified path is null or whitespace-only.");
     }
     PathOp.CheckInvalidPathChars(path);
     return(PathOp.ResolveFileSystem(ref path).OpenFile(path, mode));
 }