public async Task StoreDecryptedTransactionData <T>(TransactionDownloadData <T> transactionData) where T : Operation { if ((Flags & TransactionDownloadManagerFlags.DecrytpedTransactionStorage) != 0) { var decryptedData = transactionData.GetDecryptedData(); if (decryptedData != null) { await Task.Run((Action)(() => { var transactionId = transactionData.Transaction.OperationId; var decrytedStorage = _decryptedAttachementsStorage.Value; var data = decryptedData.ToByteArray(); if (decrytedStorage.ContainsIndex(transactionId)) { decrytedStorage.UpdateEntry(transactionId, (byte[])data); } else { decrytedStorage.AddEntry(transactionId, (byte[])data); } decrytedStorage.Commit(); })); } } }
void RetrieveDecrytpedTransactionStorage <T>(TransactionDownloadData <T> transactionData) where T : Operation { if ((Flags & TransactionDownloadManagerFlags.DecrytpedTransactionStorage) != 0) { var transaction = transactionData.Transaction; var transactionId = transaction.OperationId; if (transactionData.GetDecryptedData() == null) { var decrytedStorage = _decryptedAttachementsStorage.Value; if (decrytedStorage.ContainsIndex(transactionId)) { var data = decrytedStorage.GetBlockData(transactionId); if (data != null) { try { var attachements = new TransactionAttachements(new Unpacker(data)); transactionData.UpdateDecryptedData(attachements); } catch { } } } } } }