Finish menu + fix operand bug

This commit is contained in:
Substitute 2021-02-12 12:46:36 -05:00
parent 18ea465b93
commit c544f574b3

View File

@ -34,7 +34,7 @@ auto onClientMessaged(networked& client, std::string& message)
int operation = std::stoi(message); int operation = std::stoi(message);
sscout << "OPCode is " << operation << ".\n"; sscout << "OPCode is " << operation << ".\n";
if (math::is_between<0,7>(operation)) if (math::is_between<0,7>(operation))
client.send_message(net::system(commands[operation])); client.send_message(net::system(commands[operation-1]));
else else
badOperand(); badOperand();
}catch(std::invalid_argument& invalid_number) { badOperand(); } }catch(std::invalid_argument& invalid_number) { badOperand(); }
@ -58,7 +58,7 @@ auto execute_as_client(std::string ipaddress, std::uint16_t port)
{ {
while(true) while(true)
{ {
auto operation = get_input<int>("Pick Command\n\t1. Date\n\t2. \n\t3. \n\t4. Netstat\n\t5.\n\t6.\n\t7. Exit\n:>", "Invalid Selection", math::is_between<0, 8>); auto operation = get_input<int>("Pick Command\n\t1. Date\n\t2. Uptime\n\t3. Memory Use\n\t4. Netstat\n\t5. Current Users\n\t6. Running Processes\n\t7. Exit\n:>", "Invalid Selection", math::is_between<0, 8>);
if (operation == 7) if (operation == 7)
break; break;
auto num_clients = get_input<int>("Enter number of clients. (1-25): ", "Invalid Amount", math::is_between<0, 26>); auto num_clients = get_input<int>("Enter number of clients. (1-25): ", "Invalid Amount", math::is_between<0, 26>);