diff --git a/Netch/Netch.csproj b/Netch/Netch.csproj index e836d1494d..13e1bdfb7c 100644 --- a/Netch/Netch.csproj +++ b/Netch/Netch.csproj @@ -68,7 +68,7 @@ - + \ No newline at end of file diff --git a/Netch/Resources/zh-CN b/Netch/Resources/zh-CN index e8a83b004d..016c48aadc 100644 --- a/Netch/Resources/zh-CN +++ b/Netch/Resources/zh-CN @@ -128,6 +128,7 @@ "Global Bypass IPs": "全局直连 IP", "Port value illegal. Try again.": "端口值非法。请重试。", "Check update when opened": "打开软件时检查更新", + "TUN/TAP driver is not detected. Is it installed now?": "未检测到TUN/TAP驱动,是否现在安装?", "Profile": "配置名", "Profiles": "配置", diff --git a/Netch/Utils/Configuration.cs b/Netch/Utils/Configuration.cs index 2319e8d45e..ce322dc7e3 100644 --- a/Netch/Utils/Configuration.cs +++ b/Netch/Utils/Configuration.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.IO; using System.Net; using System.Net.NetworkInformation; @@ -145,8 +146,20 @@ public static bool SearchOutbounds() Global.TUNTAP.ComponentID = TUNTAP.GetComponentID(); if (string.IsNullOrEmpty(Global.TUNTAP.ComponentID)) { - MessageBox.Show(i18N.Translate("Please install TAP-Windows and create an TUN/TAP adapter manually"), i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); - return false; + if (MessageBox.Show(i18N.Translate("TUN/TAP driver is not detected. Is it installed now?"), i18N.Translate("Information"), MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) + { + //安装Tap Driver + Process installProcess = new Process(); + installProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + installProcess.StartInfo.FileName = Path.Combine("bin/tap-driver", "install.bat"); + installProcess.Start(); + installProcess.WaitForExit(); + installProcess.Close(); + + Global.TUNTAP.ComponentID = TUNTAP.GetComponentID(); + } + //MessageBox.Show(i18N.Translate("Please install TAP-Windows and create an TUN/TAP adapter manually"), i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); + // return false; } var name = TUNTAP.GetName(Global.TUNTAP.ComponentID);