Exemplo n.º 1
0
        private static bool EnableAdapter(string string_0)
        {
            List <ManagementBaseObject> managementBaseObjects = NetworkAdapterInstaller.QueryAdapterByPnp(string_0);

            if (managementBaseObjects.Count <= 0)
            {
                NetworkAdapterInstaller.SendErrorMessage(string.Format("未找到网卡{0},网卡启动失败", string_0));
                return(false);
            }
            NetworkAdapterInstaller.SendMessage(string.Format("找到虚拟网卡{0}", managementBaseObjects[0]["Caption"]));
            NetworkAdapterInstaller.RunCmd(string.Format("devcon.exe /r enable @{0}", string_0), new Action <Process>(NetworkAdapterInstaller.DEBUGWriteToConsole));
            return(true);
        }