示例#1
0
        public override int ExecuteOperation()
        {
            var destination = _destination;

            if (!_pathWrapper.IsPathRooted(_destination.Path) && _whereToPut != null)
            {
                destination = ActivityIOFactory.CreatePathFromString(_whereToPut + "\\" + _destination.Path, _destination.Username, _destination.Password, _destination.PrivateKeyFile);
            }
            _fileLock.EnterWriteLock();
            try
            {
                using (_currentStream)
                {
                    if (_impersonatedUser != null)
                    {
                        return(ExecuteOperationWithAuth(_currentStream, destination));
                    }
                    return(WriteData(_currentStream, destination));
                }
            }
            finally
            {
                _fileLock.ExitWriteLock();
                _impersonatedUser?.Undo();
            }
        }
示例#2
0
 public override IList <IActivityIOPath> ExecuteOperationWithAuth()
 {
     using (_impersonatedUser)
     {
         try
         {
             if (!Dev2ActivityIOPathUtils.IsStarWildCard(_newPath))
             {
                 return(AddDirsToResults(GetDirectoriesForType(_newPath, string.Empty, _type, _dirWrapper), _path));
             }
             var baseDir = Dev2ActivityIOPathUtils.ExtractFullDirectoryPath(_newPath);
             var pattern = Dev2ActivityIOPathUtils.ExtractFileName(_newPath);
             return(AddDirsToResults(GetDirectoriesForType(baseDir, pattern, _type, _dirWrapper), _path));
         }
         catch (Exception ex)
         {
             Dev2Logger.Error(ex, GlobalConstants.WarewolfError);
             throw new Exception(string.Format(ErrorResource.DirectoryNotFound, _path.Path));
         }
         finally
         {
             _impersonatedUser.Undo();
         }
     }
 }
示例#3
0
 public override bool ExecuteOperationWithAuth()
 {
     using (_impersonatedUser)
     {
         try
         {
             if (_handleOverwrite == null)
             {
                 _dirWrapper.CreateDirectory(_path.Path);
                 return(true);
             }
             if (DirectoryExist(_path, _dirWrapper))
             {
                 _handleOverwrite.ExecuteOperation();
             }
             _dirWrapper.CreateDirectory(_path.Path);
             return(true);
         }
         catch (Exception exception)
         {
             Dev2Logger.Error(exception, GlobalConstants.WarewolfError);
             throw;
         }
         finally
         {
             _impersonatedUser.Undo();
         }
     }
 }
示例#4
0
 public override int ExecuteOperationWithAuth(Stream src, IActivityIOPath dst)
 {
     using (_impersonatedUser)
     {
         try
         {
             return(WriteData(src, dst));
         }
         finally
         {
             _impersonatedUser.Undo();
         }
     }
 }
示例#5
0
 public override bool ExecuteOperationWithAuth()
 {
     using (_impersonatedUser)
     {
         try
         {
             return(PathIs(_path, _fileWrapper, _dirWrapper) == enPathType.Directory ? _dirWrapper.Exists(_path.Path) : _fileWrapper.Exists(_path.Path));
         }
         catch (Exception ex)
         {
             Dev2Logger.Error(ex.Message, GlobalConstants.Warewolf);
             return(false);
         }
         finally
         {
             _impersonatedUser?.Undo();
         }
     }
 }
示例#6
0
 public override bool ExecuteOperationWithAuth()
 {
     using (_impersonatedUser)
     {
         try
         {
             return(_deleteHelper.Delete(_path.Path));
         }
         catch (Exception ex)
         {
             Dev2Logger.Error(ex.Message, GlobalConstants.Warewolf);
             return(false);
         }
         finally
         {
             _impersonatedUser?.Undo();
         }
     }
 }
示例#7
0
 public override Stream ExecuteOperationWithAuth()
 {
     using (_impersonatedUser)
     {
         try
         {
             return(new MemoryStream(_fileWrapper.ReadAllBytes(_path.Path)));
         }
         catch (Exception exception)
         {
             Dev2Logger.Error(exception.Message, GlobalConstants.WarewolfError);
             throw new Exception(exception.Message, exception);
         }
         finally
         {
             _impersonatedUser.Undo();
         }
     }
 }