Beispiel #1
0
        private static async Task <CloudBankUtils> recieveFromSkywallet()
        {
            CloudBankUtils sender = new CloudBankUtils(myKeys, cli);
            await sender.RecieveFromSkywallet();

            return(sender);
        }
Beispiel #2
0
        static async Task withdraw()
        {
            CloudBankUtils receiver;

            if (receiptHolder == null)
            {
                receiver = new CloudBankUtils(myKeys, cli);
            }
            else
            {
                receiver = receiptHolder;
            }

            Console.Out.WriteLine("How many CloudCoins are you withdrawing?");
            int amount = reader.readInt();
            await receiver.getStackFromCloudBank(amount);

            if (receiver.haveStackFromWithdrawal)
            {
                receiver.saveStackToFile(AppDomain.CurrentDomain.BaseDirectory);
            }
            else
            {
                Console.Out.WriteLine("Failed to withdraw");
            }
        }//end deposit
Beispiel #3
0
        /* Show coins will populate the CloudBankUtils with the totals of each denominations
         * These totals are public properties that can be accessed */
        static async Task showCoins()
        {
            CloudBankUtils cbu = new CloudBankUtils(myKeys, cli);
            await cbu.showCoins();

            Console.Out.WriteLine("Ones in our bank:" + cbu.onesInBank);
            Console.Out.WriteLine("Five in our bank:" + cbu.fivesInBank);
            Console.Out.WriteLine("Twenty Fives in our bank:" + cbu.twentyFivesInBank);
            Console.Out.WriteLine("Hundreds in our bank:" + cbu.hundredsInBank);
            Console.Out.WriteLine("Two Hundred Fifties in our bank:" + cbu.twohundredfiftiesInBank);
        }//end show coins
Beispiel #4
0
        }//end deposit

        private static async Task <CloudBankUtils> transferBetweenSkywallets()
        {
            CloudBankUtils sender = new CloudBankUtils(myKeys, cli);

            Console.Out.WriteLine("Which skywallet are you sending to?");
            string sw = reader.readString();

            Console.Out.WriteLine("How Much?");
            int amount = reader.readInt();
            await sender.TransferBetweenSkywallets(amount, sw);

            return(sender);
        }
Beispiel #5
0
        }//end deposit

        static async Task <CloudBankUtils> sendtoSkywallet()
        {
            CloudBankUtils sender = new CloudBankUtils(myKeys, cli);

            Console.Out.WriteLine("Which skywallet are you sending to?");
            string sw = reader.readString();

            Console.Out.WriteLine("How Much?");
            int amount = reader.readInt();
            await sender.SendToSkywallet(amount, sw);

            return(sender);
        }//end deposit
Beispiel #6
0
        }//end show coins

        /* Deposit allow you to send a stack file to the CloudBank */
        static async Task <CloudBankUtils> depositAsync()
        {
            CloudBankUtils sender = new CloudBankUtils(myKeys, cli);

            Console.Out.WriteLine("What is the path to your stack file?");
            //string path = reader.readString();
            string path = AppDomain.CurrentDomain.BaseDirectory;

            path += reader.readString();
            Console.Out.WriteLine("Loading " + path);
            sender.loadStackFromFile(path);
            await sender.sendStackToCloudBank();

            return(sender);
        }//end deposit
Beispiel #7
0
        } // End main

        /* STATIC METHODS */
        public static async Task run()
        {
            bool restart = false;

            while (!restart)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Out.WriteLine("");
                //  Console.Out.WriteLine("========================================");
                Console.Out.WriteLine("");
                Console.Out.WriteLine("Commands Available:");
                Console.ForegroundColor = ConsoleColor.White;
                int commandCounter = 1;
                foreach (String command in commandsAvailable)
                {
                    Console.Out.WriteLine(commandCounter + (". " + command));
                    commandCounter++;
                }
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Out.Write(prompt);
                Console.ForegroundColor = ConsoleColor.White;
                int commandRecieved = reader.readInt(1, 13);


                switch (commandRecieved)
                {
                case 1:
                    loadKeys();
                    break;

                case 2:
                    await showCoins();

                    break;

                case 3:
                    receiptHolder = await depositAsync();

                    break;

                case 4:
                    await withdraw();

                    break;

                case 5:
                    await receipt();

                    break;

                case 6:
                    await writeCheck();

                    break;

                case 7:
                    await GetCheck();

                    break;

                case 8:
                    await Echo();

                    break;

                case 9:
                    await bankPrintWelcome();

                    break;

                case 10:
                    receiptHolder = await sendtoSkywallet();

                    break;

                case 11:
                    receiptHolder = await recieveFromSkywallet();

                    break;

                case 12:
                    receiptHolder = await transferBetweenSkywallets();

                    break;

                case 13:
                    Console.Out.WriteLine("Goodbye!");
                    Environment.Exit(0);
                    break;

                default:
                    Console.Out.WriteLine("Command failed. Try again.");
                    break;
                } // end switch
            }     // end while
        }         // end run method
Beispiel #8
0
 private static async Task Echo()
 {
     CloudBankUtils cbu = new CloudBankUtils(myKeys, cli);
     await cbu.echoFromBank();
 }
Beispiel #9
0
        }         // end run method

        private static async Task bankPrintWelcome()
        {
            CloudBankUtils cbu = new CloudBankUtils(myKeys, cli);
            await cbu.printWelcomeFromBank();
        }
Beispiel #10
0
        }//end deposit

        static async Task receipt2()
        {
            var x = new CloudBankUtils(myKeys);
            await x.getReceipt(myKeys.publickey);
        }