public static void deleteFirewall(string appPath) { StringBuilder strCMD = new StringBuilder(); string appName = ToolForUrl.getDirEndName(appPath, true); strCMD.AppendFormat("netsh advfirewall firewall delete rule name=\"{0}\" program=\"{1}\"", appName, appPath); cmd(strCMD.ToString(), true); }
public static void addFirewall(string appPath) { StringBuilder strCMD = new StringBuilder(); string appName = ToolForUrl.getDirEndName(appPath, true); strCMD.AppendFormat("/netsh advfirewall firewall add rule name=\"{0}\" dir=in action=allow program=\"{1}\" enable=yes", appName, appPath); cmd(strCMD.ToString(), true); }