示例#1
0
        /// <summary>
        /// Get information exchange list
        /// </summary>
        /// <param name="parameters">
        /// Parameter Index
        /// </param>
        /// <returns></returns>
        public static bool ListExchange(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.ListExchange(out ExchangeList exchanges);
                if (result.Result)
                {
                    Console.WriteLine(PrintUtil.PrintExchangeList(exchanges));
                }

                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 exchange list
        /// </summary>
        /// <param name="parameters">
        /// Parameter Index
        /// [0] : Offset
        /// [1] : Limit
        /// </param>
        /// <returns></returns>
        public static bool ListExchangePaginated(string command, string[] parameters)
        {
            string[] usage = new string[] {
                string.Format("{0} [command option] <offset> <limit> \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.ListExchangePaginated(offset,
                                                                   limit,
                                                                   out ExchangeList exchanges);
                if (result.Result)
                {
                    Console.WriteLine(PrintUtil.PrintExchangeList(exchanges));
                }

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

            return(true);
        }