protected virtual bool CheckOutput(string fileName) { var directoryName = Path.GetDirectoryName(fileName); if (!string.IsNullOrEmpty(Path.GetPathRoot(directoryName)) && !Directory.Exists(directoryName)) { //TODO: Bad .Result if (!NetworkDrive.IsRemotePath(directoryName) || !NetworkDrive.ConnectRemotePath(directoryName).Result) { try { Directory.CreateDirectory(directoryName); } catch { throw new DirectoryNotFoundException(string.Format("Directory not found: {0}", directoryName)); } } } if (File.Exists(fileName)) { return(false); } return(true); }
protected virtual async Task CheckPath() { if (!string.IsNullOrEmpty(Path.GetPathRoot(this.PlaylistItem.FileName)) && !File.Exists(this.PlaylistItem.FileName)) { if (!NetworkDrive.IsRemotePath(this.PlaylistItem.FileName) || !await NetworkDrive.ConnectRemotePath(this.PlaylistItem.FileName).ConfigureAwait(false)) { throw new FileNotFoundException(string.Format("File not found: {0}", this.PlaylistItem.FileName), this.PlaylistItem.FileName); } } }
protected virtual async Task CheckPaths(IEnumerable <string> paths) { foreach (var path in paths) { if (!NetworkDrive.IsRemotePath(path)) { continue; } await NetworkDrive.ConnectRemotePath(path).ConfigureAwait(false); } }
protected virtual bool CheckInput(string fileName) { if (!string.IsNullOrEmpty(Path.GetPathRoot(fileName)) && !File.Exists(fileName)) { //TODO: Bad .Result if (!NetworkDrive.IsRemotePath(fileName) || !NetworkDrive.ConnectRemotePath(fileName).Result) { throw new FileNotFoundException(string.Format("File not found: {0}", fileName), fileName); } } return(true); }