From eb269e7e1c47085730684cc87fb53e43a3565500 Mon Sep 17 00:00:00 2001 From: Jeffrey Quesnelle Date: Fri, 6 Oct 2017 09:54:21 -0400 Subject: [PATCH] adds command line parameter to specify first block file --- Sources/BitcoinBlockchainSample/Program.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/BitcoinBlockchainSample/Program.cs b/Sources/BitcoinBlockchainSample/Program.cs index 9e086c6..56547ef 100644 --- a/Sources/BitcoinBlockchainSample/Program.cs +++ b/Sources/BitcoinBlockchainSample/Program.cs @@ -14,7 +14,7 @@ public static class Program { private static int Main(string[] args) { - if (args.Length != 1) + if (args.Length < 1) { Console.Error.WriteLine("Invalid command line. Run \"BitcoinBlockchainSample /?\" for usage."); } @@ -26,14 +26,14 @@ private static int Main(string[] args) } else { - ParseBlockchainFiles(args[0]); + ParseBlockchainFiles(args[0], args.Length > 1 ? args[1] : null); } } return 0; } - private static void ParseBlockchainFiles(string pathToBlockchain) + private static void ParseBlockchainFiles(string pathToBlockchain, string firstBlock) { BlockchainStatistics overallStatistics = new BlockchainStatistics(); BlockchainStatistics blockFileStatistics = new BlockchainStatistics(); @@ -44,7 +44,7 @@ private static void ParseBlockchainFiles(string pathToBlockchain) // to its constructor. // TIP: Class IBlockchainParser provides several constructors that are useful // in different scenarios. - IBlockchainParser blockchainParser = new BlockchainParser(pathToBlockchain); + IBlockchainParser blockchainParser = new BlockchainParser(pathToBlockchain, firstBlock); // Call blockchainParser.SetBlockId is the blockchain uses a value different than the standard one // for the "BlockId" field of each block. For example on testnet / testnet3. @@ -124,7 +124,7 @@ private static void TypeHelp() Console.WriteLine(" basic functions of the BitcoinBlockchain class library."); Console.WriteLine(); Console.WriteLine("USAGE:"); - Console.WriteLine(" BitcoinBlockchainSample.exe /? | Path_To_Blockchain_Files"); + Console.WriteLine(" BitcoinBlockchainSample.exe /? | Path_To_Blockchain_Files [First_Block_File]"); } } }