private static BattlEyeLoginCredentials GetLoginCredentials(string[] args)
{
BattlEyeLoginCredentials loginCredentials = new BattlEyeLoginCredentials();
loginCredentials.Host = null;
loginCredentials.Port = 0;
loginCredentials.Password = "";
for (int i = 0; i < args.Length; i = i + 2)
{
switch (args[i])
{
case "-host":
{
try
{
IPAddress ip = Dns.GetHostAddresses(args[i + 1])[0];
loginCredentials.Host = ip;
}
catch
{
Console.WriteLine("No valid host given!");
}
break;
}
case "-port":
{
int value;
if (int.TryParse(args[i + 1], out value))
{
loginCredentials.Port = value;
}
else
{
Console.WriteLine("No valid port given!");
}
break;
}
case "-password":
{
if (args[i + 1] != "")
{
loginCredentials.Password = args[i + 1];
}
else
{
Console.WriteLine("No password given!");
}
break;
}
}
}
return loginCredentials;
}