private void getCurrentHosts(string hostname) { string ip = Hosts.getIPByDomain(hostname); label3.Text = ip; label4.ForeColor = Color.Black; label4.Text = "(测试中...)"; testSingleHttpWithIp(ip, MaximumTimeout); }
private void button4_Click(object sender, EventArgs e) { if (MessageBox.Show("确定要清除Steam的hosts吗?", "SteamHosts", MessageBoxButtons.YesNo) == DialogResult.Yes) { Hosts.removeHostsItem(Hostname); string result = Hosts.removeHostsItem("steamcommunity.com"); if (result.Equals("OK")) { MessageBox.Show("清除Steam hosts成功!", "SteamHosts"); } else { MessageBox.Show("清除Steam hosts失败!原因:" + result, "SteamHosts"); } getCurrentHosts(Hostname); } }