public AsyncTask DirectDownloadAsync(DirectDownloadParameter directDownloadParameter, AsyncCallbacks <Stream> asyncCallbacks = null) { CheckParameter(directDownloadParameter != null, "directDownloadParameter is required"); var asyncTask = new AsyncTask(); AsyncUtils.ProcessFirstItem(DoDirectDownload(directDownloadParameter), asyncCallbacks, asyncTask); return(asyncTask); }
private IObservable <Stream> DoDirectDownload(DirectDownloadParameter downloadParam) { try { var result = GetOptionalBlockchainTransaction(downloadParam.TransactionHash) .Select(transferTransaction => transferTransaction != null ? RetrieveProximaxMessagePayloadService.GetMessagePayload(transferTransaction, downloadParam.AccountPrivateKey) : null) .SelectMany(messagePayload => GetDataByteStream(messagePayload, downloadParam.DataHash, downloadParam.PrivacyStrategy, downloadParam.ValidateDigest, downloadParam.Digest)).Wait(); return(Observable.Return(result)); } catch (Exception ex) { return(Observable.Throw <Stream>(new DirectDownloadFailureException("Direct download failed.", ex))); } }
public Stream DirectDownload(DirectDownloadParameter directDownloadParameter) { CheckParameter(directDownloadParameter != null, "directDownloadParameter is required"); return(DoDirectDownload(directDownloadParameter).Wait()); }