private static BattlEyeLoginCredentials GetLoginCredentials()
{
IPAddress host = null;
int port = 0;
string password = "";
do
{
string input;
Console.Write("Enter IP address or hostname: ");
input = Console.ReadLine();
try
{
IPAddress ip = Dns.GetHostAddresses(input)[0];
host = ip;
}
catch { /* try again */ }
} while (host == null);
do
{
int value;
string input;
Console.Write("Enter port number: ");
input = Console.ReadLine();
if (int.TryParse(input, out value))
{
port = value;
}
} while (port == 0);
do
{
Console.Write("Enter RCon password: ");
string input = Console.ReadLine();
if (input != "")
{
password = input;
}
} while (password == "");
var loginCredentials = new BattlEyeLoginCredentials
{
Host = host,
Port = port,
Password = password,
};
return loginCredentials;
}