Example #1
0
        public void Download(string txId)
        {
            txId = txId.Trim(' ', '\r', '\n');

            var fileData = _block.DownloadTxInputFile(txId);

            if (fileData == null)
            {
                throw new InvalidDataException($"The transaction ID {txId} was not found");
            }

            // Now check for headers

            var fileName = Path.Combine(Settings.Default.OutputPath, Path.ChangeExtension(txId, fileData.Extension));

            File.Delete(fileName);
            File.WriteAllBytes(fileName, fileData.Data);

            _messages.Add($"File saved to {fileName}");
        }