public IDropboxResult ExecuteTask(IDropboxClient client) { try { var listFolderArg = new ListFolderArg(_path, _recursive, _includeMediaInfo, _includeDeleted); var listFolderResult = client.ListFolderAsync(listFolderArg).Result; return(new DropboxListFolderSuccesResult(listFolderResult)); } catch (Exception exception) { Dev2Logger.Error(exception.Message, GlobalConstants.WarewolfError); var hasInnerExc = exception.InnerException != null; if (hasInnerExc) { if (exception.InnerException.Message.Contains("not_found")) { return(new DropboxFailureResult(new DropboxFileNotFoundException())); } if (exception.InnerException.Message.Contains("malformed")) { return(new DropboxFailureResult(new DropboxFileMalformdedException())); } return(exception.InnerException.Message.Contains("not_file") ? new DropboxFailureResult(new DropboxPathNotFileFoundException()) : new DropboxFailureResult(exception.InnerException)); } return(new DropboxFailureResult(exception)); } }
public IDropboxResult ExecuteTask(IDropboxClient client) { try { var deleteAsync = client.DeleteAsync(_dropboxPath).Result as FileMetadata; return(new DropboxDeleteSuccessResult(deleteAsync)); } catch (Exception exception) { Dev2Logger.Error(exception.Message, GlobalConstants.WarewolfError); return(exception.InnerException != null ? new DropboxFailureResult(exception.InnerException) : new DropboxFailureResult(exception)); } }
protected void SetupDropboxClient(string accessToken) { if (_dropboxClient != null) { return; } var httpClient = new HttpClient(new WebRequestHandler { ReadWriteTimeout = 10 * 1000 }) { Timeout = TimeSpan.FromMinutes(20) }; _dropboxClient = _dropboxClientFactory.New(accessToken, httpClient); }
public IDropboxResult ExecuteTask(IDropboxClient client) { try { using (var stream = new MemoryStream(File.ReadAllBytes(_fromPath))) { var uploadAsync = client.UploadAsync(_dropboxPath, _writeMode, true, null, false, stream).Result; return(new DropboxUploadSuccessResult(uploadAsync)); } } catch (Exception exception) { Dev2Logger.Error(exception.Message, GlobalConstants.WarewolfError); return(exception.InnerException != null ? new DropboxFailureResult(exception.InnerException) : new DropboxFailureResult(exception)); } }
public TestDsfDropBoxUploadActivity(IDropboxSingleExecutor <IDropboxResult> singleExecutor, IDropboxClient dropboxClient ) : base(new MyClass(dropboxClient)) { DropboxSingleExecutor = singleExecutor; }
public MyClass(IDropboxClient dropboxClient) { _dropboxClient = dropboxClient; }
public DsfDropBoxDeleteActivityMock(IDropboxSingleExecutor <IDropboxResult> singleExecutor, IDropboxClient dropboxClient ) : base(new MyClass(dropboxClient)) { DropboxSingleExecutor = singleExecutor; }
public DsfDropBoxDownloadActivityMockForFiles(IDropboxClient clientWrapper) : base(new MockDropBoxClientFactory(clientWrapper)) { _clientWrapper = clientWrapper; }
public MockDropBoxClientFactory(IDropboxClient mockIDropboxClient) { _mockIDropboxClient = mockIDropboxClient; }