Beispiel #1
0
 private static void Help(WalletBackend wallet)
 {
     if (wallet.isViewWallet)
     {
         Menu.PrintCommands(DefaultCommands.BasicViewWalletCommands());
     }
     else
     {
         Menu.PrintCommands(DefaultCommands.BasicCommands());
     }
 }
Beispiel #2
0
        /* Get the startup action, e.g. open, create */
        private static LaunchAction GetAction()
        {
            /* Grab the command list */
            var commands = DefaultCommands.StartupCommands();

            PrintCommands(commands);

            string command = ParseCommand(commands, commands,
                                          "[What would you like to do?]: ");

            switch (command)
            {
            case "create":
            {
                return(LaunchAction.Create);
            }

            case "open":
            {
                return(LaunchAction.Open);
            }

            case "seed_restore":
            {
                return(LaunchAction.SeedRestore);
            }

            case "key_restore":
            {
                return(LaunchAction.KeyRestore);
            }

            case "view_wallet":
            {
                return(LaunchAction.ViewWallet);
            }

            case "exit":
            {
                return(LaunchAction.Exit);
            }

            /* This should never happen */
            default:
            {
                throw new NotImplementedException(
                          "Command was defined but not hooked up!"
                          );
            }
            }
        }
Beispiel #3
0
        public static void MainLoop(WalletBackend wallet)
        {
            /* Show the available commands */
            if (wallet.isViewWallet)
            {
                PrintCommands(DefaultCommands.BasicViewWalletCommands());
            }
            else
            {
                PrintCommands(DefaultCommands.BasicCommands());
            }

            while (true)
            {
                string command;

                if (wallet.isViewWallet)
                {
                    command = ParseCommand(
                        DefaultCommands.BasicViewWalletCommands(),
                        DefaultCommands.AllViewWalletCommands(),
                        GetPrompt(wallet)
                        );
                }
                else
                {
                    command = ParseCommand(
                        DefaultCommands.BasicCommands(),
                        DefaultCommands.AllCommands(),
                        GetPrompt(wallet)
                        );
                }

                /* If exit command is given, quit */
                if (CommandImplementations.HandleCommand(command, wallet))
                {
                    return;
                }
            }
        }
Beispiel #4
0
        private static void Advanced(WalletBackend wallet)
        {
            if (wallet.isViewWallet)
            {
                Menu.PrintCommands(
                    DefaultCommands.AdvancedViewWalletCommands(),

                    /* The offset to print the number from, e.g. help is
                     * command numbers 1-7 or whatever, advanced is command
                     * numbers 8-19 */
                    DefaultCommands.BasicViewWalletCommands().Count()
                    );
            }
            else
            {
                Menu.PrintCommands(
                    DefaultCommands.AdvancedCommands(),
                    /* Offset */
                    DefaultCommands.BasicCommands().Count()
                    );
            }
        }