// notice: this is a workaround solution private void GeneralConcole() { bool isExit = false; while (!isExit) { Console.WriteLine("[General Console]"); Console.WriteLine("1. List all clients"); Console.WriteLine("2. Interface mode"); Console.WriteLine("3. Establish new connection"); Console.WriteLine("4. Shutdown all"); Console.WriteLine("5. List all Listeners"); Console.WriteLine("6. Build new Listener"); Console.WriteLine("7. Listener mode"); // manage listeners Console.WriteLine("8. Exit"); Console.WriteLine("9. Crypto Console"); Console.WriteLine("10. Manage protocols"); if (!_protocolOptions.SecondLowAESProtocolState.Enabled) { Console.WriteLine("[Warning] Second lowest AES is not enabled"); } if (!_protocolOptions.FirstLowAESProtocolState.Enabled) { Console.WriteLine("[Warning] First lowest AES is not enabled"); } Console.Write("> "); string sel = Console.ReadLine(); switch (sel) { case "1": ListAllClients(); break; case "2": // manage client Console.WriteLine("Enter the index of the client"); Console.Write("> "); int index; try { index = int.Parse(Console.ReadLine()); } catch (FormatException) { Console.WriteLine("[Error] Invalid Input"); break; } try { InterfaceMenu(_sockController.GetSockList().Clients[index]); } catch (ArgumentOutOfRangeException) { Console.WriteLine("[Error] Index Out Of Range"); break; } break; case "3": // Establish new connection BuildClientConsole(); break; case "4": ShutdownAll(); break; case "5": ListAllListeners(); break; case "6": BuildListenerConsole(); break; case "7": Console.WriteLine("Enter the index of the listener"); Console.Write("> "); int listenerIndex; try { listenerIndex = int.Parse(Console.ReadLine()); } catch (FormatException) { Console.WriteLine("[Error] Invalid Input"); break; } try { ListenerMenu(_sockController.GetSockList().Listeners[listenerIndex]); } catch (ArgumentOutOfRangeException) { Console.WriteLine("[Error] Index Out Of Range"); break; } break; case "8": ShutdownAll(); isExit = true; break; case "9": CryptoConsole(); break; case "10": ProtocolConsole(); break; default: break; } } }