private void PopulateValidIPs() { foreach (var ip in Dns.GetHostEntry(Dns.GetHostName()).AddressList) { if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { comboBoxServerIP.Items.Add(ip.ToString()); } } if (File.Exists(Settings.CustomIPsFile)) { foreach (var line in File.ReadAllLines(Settings.CustomIPsFile)) { if (AddServerIpForm.IsValidIP(line)) { comboBoxServerIP.Items.Add(line); } } } if (comboBoxServerIP.Items.Count > 0) { comboBoxServerIP.SelectedIndex = 0; } }
private bool IsValidIP() { return(AddServerIpForm.IsValidIP(textBoxPS4IP.Text)); }