コード例 #1
0
        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);
        }
コード例 #2
0
 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)));
     }
 }
コード例 #3
0
        public Stream DirectDownload(DirectDownloadParameter directDownloadParameter)
        {
            CheckParameter(directDownloadParameter != null, "directDownloadParameter is required");

            return(DoDirectDownload(directDownloadParameter).Wait());
        }