Пример #1
0
        /// <summary>
        /// Get information proposal list
        /// </summary>
        /// <param name="parameters">
        /// Parameter Index
        /// </param>
        /// <returns></returns>
        public static bool ListProposal(string command, string[] parameters)
        {
            string[] usage = new string[] {
                string.Format("{0} [command option] \n", command)
            };

            string[] command_option = new string[] { HelpCommandOption.Help };

            if (parameters != null)
            {
                OutputHelpMessage(usage, null, command_option, null);
                return(true);
            }

            try
            {
                RpcApiResult result = RpcApi.ListProposal(out ProposalList proposals);
                if (result.Result)
                {
                    Console.WriteLine(PrintUtil.PrintProposalsList(proposals));
                }

                OutputResultMessage(command, result.Result, result.Code, result.Message);
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message + "\n\n" + e.StackTrace);
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Get information proposal list
        /// </summary>
        /// <param name="parameters">
        /// Parameter Index
        /// [0] : Offset
        /// [1] : Limit
        /// </param>
        /// <returns></returns>
        public static bool ListProposalPaginated(string command, string[] parameters)
        {
            string[] usage = new string[] {
                string.Format("{0} [command option] \n", command)
            };

            string[] command_option = new string[] { HelpCommandOption.Help };

            if (parameters == null || parameters.Length != 2)
            {
                OutputHelpMessage(usage, null, command_option, null);
                return(true);
            }

            try
            {
                int offset = int.Parse(parameters[0]);
                int limit  = int.Parse(parameters[1]);

                RpcApiResult result = RpcApi.ListProposalPaginated(offset,
                                                                   limit,
                                                                   out ProposalList proposals);
                if (result.Result)
                {
                    Console.WriteLine(PrintUtil.PrintProposalsList(proposals));
                }

                OutputResultMessage(command, result.Result, result.Code, result.Message);
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message + "\n\n" + e.StackTrace);
            }

            return(true);
        }