/// <summary> /// Gets a directory on this drive /// </summary> /// <returns>null if not found otherwise the directory</returns> /// <exception cref="ArgumentNullException">name is required</exception> public async Task <Directory> GetDirectory(string name) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(nameof(name)); } if (IsReservedDirectoryName(name)) { return(null); } string path = $"{_path}{name}"; return(await BrickExplorer.GetDirectory(path)); }
/// <summary> /// Checks if directory exists /// </summary> /// <param name="name">name of the directory</param> /// <returns><c>true</c> if exists otherwise <c>false</c></returns> public async Task <bool> DirectoryExists(string name) { if (string.IsNullOrWhiteSpace(name)) { return(false); } if (IsReservedDirectoryName(name)) { return(false); } string path = $"{_path}{name}"; return(await BrickExplorer.Exists(path)); }
/// <summary> /// Method creates new directory. Any existing directory will not be overriden. /// </summary> /// <param name="name">The name of the directory</param> /// <returns><c>Directory</c> if exists otherwise <c>null</c></returns> public async Task <Directory> CreateDirectory(string name) { if (string.IsNullOrWhiteSpace(name)) { return(null); } if (IsReservedDirectoryName(name)) { return(null); } string path = $"{_path}{name}"; bool success = await BrickExplorer.CreateDirectory(path); if (success) { return(new Directory(path)); } return(null); }
/// <summary> /// Gets all directories on this drive /// </summary> /// <returns></returns> public async Task <Directory[]> GetDirectories() { Directory[] directories = await BrickExplorer.GetDirectories(_path); return(directories.Where(d => !IsReservedDirectoryName(d.Name)).ToArray()); }