添加Tap-Driver

Signed-off-by: Amazing_DM <amazingdmdd@gmail.com>
This commit is contained in:
Amazing_DM
2020-02-06 13:14:52 +08:00
parent 1d38ea1746
commit f5c6632a92
3 changed files with 17 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.NetworkInformation;
@@ -145,8 +146,20 @@ namespace Netch.Utils
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);