private void btnScan_Click_1(object sender, EventArgs e) { if (_hostScanner.IsScanning) { _hostScanner.Cancel(); ChangeScanState(ScanState.Cancel); } else { List <IpV4Address> range; if (rbtnCustomRange.Checked) { try { range = NetworkUtilities.GetIpRange(tbIpRange.Text); } catch (FormatException) { MessageBox.Show("IP range string is invalid.", "Scan Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { range = _networkInfo.SubnetRange; } ChangeScanState(ScanState.Scan); _hostScanner.Scan(range); } }
public void ParsePageTest() { var hostScanner = new HostScanner(); var hosts = hostScanner.Scan("here 123.45.67.89:3128 there 13.24.35.46 : 57 and everywhere 98.76.54.32 1").ToArray(); Assert.IsTrue(hosts.Contains(new ProxyServer(ProxyProtocol.HttpConnect, IPAddress.Parse("123.45.67.89"), 3128))); Assert.IsTrue(hosts.Contains(new ProxyServer(ProxyProtocol.HttpConnect, IPAddress.Parse("13.24.35.46"), 57))); Assert.IsTrue(hosts.Contains(new ProxyServer(ProxyProtocol.HttpConnect, IPAddress.Parse("98.76.54.32"), 1))); }