static void InterpretBatchCommand(string cmd, BlockChainClassLib.CommandProcessor cmdProc) { string[] cmdArgs = cmd.ToLower().Split(' '); switch (cmdArgs[0]) { case "transfer": Transfer(cmdArgs, cmdProc); break; case "history": string txList = cmdProc.history(cmdArgs[1]); Console.Write(txList); break; case "balance": cmdProc.Wallet_Balance(); break; case "test": Test(cmdArgs, cmdProc); break; case "exit": exit = true; break; } }
//Wallet sub functions static void Wallet(string[] cmdArgs, BlockChainClassLib.CommandProcessor cmdProc) { switch (cmdArgs[1]) { case "list": int i = 0; System.Console.WriteLine("wallet entries:-"); List <WalletLib.WalletEntry> entries = cmdProc.Wallet_ListEntries(); foreach (WalletLib.WalletEntry wa in entries) { System.Console.WriteLine(i.ToString("000") + ") " + wa.address + " = " + wa.amount); i++; } System.Console.WriteLine(""); break; case "select": i = int.Parse(cmdArgs[2]); cmdProc.Wallet_SelectAddress(i); break; case "add": cmdProc.Wallet_CreateAddress(); break; case "load": cmdProc.Wallet_Load(); break; case "save": cmdProc.Wallet_Save(); break; case "balance": cmdProc.Wallet_Balance(); break; } }