Exemple #1
0
        public Task <Stream> SpaceOpenDataStreamAsync(ApiSession apiSession, string remoteFilePath, CancellationToken cancellationToken)
        {
            if (apiSession == null)
            {
                throw new ArgumentNullException(nameof(apiSession));
            }

            return(Wrapped(async(token) =>
            {
                Action <FileTransferProgressEventArgs> onReceiveProgress = (data) =>
                {
                    OnDataDownloadProgress?.Invoke(this, data);
                };
                var apiResult = await _lowLevelApiClient.WebFilesDownloadFileAsync(apiSession, remoteFilePath, onReceiveProgress, token);
                return MapOrFail(apiResult, (data) => data.Stream);
            }, cancellationToken, OperationType.FileTransfer));
        }
Exemple #2
0
 private void DownloadProgress_StateChanged(object sender, FileTransferProgressEventArgs e)
 {
     OnDataDownloadProgress?.Invoke(this, e);
 }