示例#1
0
        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);
         }
     }
 }
示例#3
0
 protected virtual async Task CheckPaths(IEnumerable <string> paths)
 {
     foreach (var path in paths)
     {
         if (!NetworkDrive.IsRemotePath(path))
         {
             continue;
         }
         await NetworkDrive.ConnectRemotePath(path).ConfigureAwait(false);
     }
 }
示例#4
0
 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);
 }