int TestIPv6() { string line = "ping bt.neu6.edu.cn"; string output; CmdHelper.RunCmd(line, out output); Regex regex = new Regex("2001"); if (regex.IsMatch(output)) { textBox2.AppendText("IPv6 connected!\n"); textBox2.ScrollToCaret(); return(1); } textBox2.AppendText("IPv6 disconnected!\n"); textBox2.ScrollToCaret(); return(0); }
void ResetNetwork() { //interfacename = "以太网"; string line1 = "netsh interface set interface " + interfacename + " DISABLED"; string line2 = "netsh interface set interface " + interfacename + " ENABLED"; string output1; CmdHelper.RunCmd(line1, out output1); textBox2.AppendText("executing command " + line1 + "\n"); textBox2.ScrollToCaret(); // System.Threading.Thread.Sleep(1000); string output2; CmdHelper.RunCmd(line2, out output2); textBox2.AppendText("executing command " + line2 + "\n"); textBox2.ScrollToCaret(); }