/// <summary>
        /// Represents the main entry point in the command line tool.
        /// </summary>
        /// <param name="args">
        /// Contains the command line arguments.
        /// For a complete description of the command line arguments see method TypeHelpPage.
        /// </param>
        /// <returns>
        /// 0 - Success.
        /// 1 - Error.
        /// </returns>
        private static int Main(string[] args)
        {
            int result = 1; // Assume error.

            try
            {
                ParameterParser <DatabaseGeneratorParameters> parameterParser = new ParameterParser <DatabaseGeneratorParameters>(DatabaseGeneratorParameters.ParameterListRules);
                DatabaseGeneratorParameters parameters = parameterParser.ParseParameters(args);

                if (parameters.IsHelpSpecified)
                {
                    TypeHelpPage();
                    result = 0; // Success.
                }
                else
                {
                    Console.WriteLine(GetApplicationNameAndVersion());

                    if (parameters.IsShowDbSchemaSpecified)
                    {
                        TypeDbSchema();
                        result = 0; // Success.
                    }
                    else if (parameters.IsRunValidationSpecified)
                    {
                        AutoValidator autoValidator = new AutoValidator(
                            parameters.SqlServerName,
                            parameters.SqlDbName,
                            parameters.SqlUserName,
                            parameters.SqlPassword);

                        result = autoValidator.Validate() ? 0 : 1;
                    }
                    else
                    {
                        Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Active threads: {0}", parameters.Threads));
                        Console.WriteLine();

                        DatabaseConnection databaseConnection = DatabaseConnection.CreateSqlServerConnection(parameters.SqlServerName, parameters.SqlDbName, parameters.SqlUserName, parameters.SqlPassword);
                        DatabaseGenerator  databaseGenerator  = new DatabaseGenerator(parameters, databaseConnection);
                        databaseGenerator.GenerateAndPopulateDatabase().Wait();

                        result = 0; // Success.
                    }
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }

            Console.WriteLine();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
            //// TypePeakMemoryUsage();

            return(result);
        }
        static int Main(string[] args)
        {
            int result = 1; // Assume error.

            try
            {
                ParameterParser <DatabaseGeneratorParameters> parameterParser = new ParameterParser <DatabaseGeneratorParameters>(DatabaseGeneratorParameters.ParameterListRules);
                DatabaseGeneratorParameters parameters = parameterParser.ParseParameters(args);

                if (parameters.IsHelpSpecified)
                {
                    TypeHelpPage();
                    result = 0; // Success.
                }
                else
                {
                    Console.WriteLine(GetApplicationNameAndVersion());

                    if (parameters.IsShowDbSchemaSpecified)
                    {
                        TypeDbSchema();
                        result = 0; // Success.
                    }
                    else
                    {
                        Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Active threads: {0}", parameters.Threads));
                        Console.WriteLine();

                        DatabaseConnection databaseConnection = DatabaseConnection.CreateSqlServerConnection(parameters.SqlServerName, parameters.SqlDbName, parameters.SqlUserName, parameters.SqlPassword);
                        DatabaseGenerator  databaseGenerator  = new DatabaseGenerator(parameters, databaseConnection);
                        databaseGenerator.GenerateAndPopulateDatabase().Wait();

                        //一般情况下,只是调用GenerateAndPopulateDatabase(),将数据存入数据库,
                        //但有时为了做图方便及其他,为每个TX_IN直接添加对应的SourceTranceactionId,则
                        //把UpdateSourceTransactionId()的注释删除。为建立索引,如果数据库已经建好的,一定要
                        //把GenerateAndPopulateDatabase()注释掉,否则会浪费很多时间。
                        //同理UpdateTransactionOutputAddressId()函数是为每个TXOUT的比特币地址设置一个ID值,相同的ADDR具有相同的ID
                        //选择性调用

                        //databaseGenerator.UpdateSourceTransactionId();
                        //databaseGenerator.UpdateTransactionOutputAddressId();

                        result = 0; // Success.
                    }
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }

            Console.WriteLine();

            //// TypePeakMemoryUsage();

            return(result);
        }