Exemplo n.º 1
0
 public static async void ChangeMode(NetForwardMode mode, Action <bool> callback)
 {
     await Task.Run(() => {
         NetworkAdapterInstaller.InstallMode = mode;
         if (mode != NetForwardMode.Adapter)
         {
             callback(NetworkAdapterInstaller.DisableLoopAdapters());
             return;
         }
         NetworkAdapterInstaller.SendMessage("正在启用虚拟网卡模式..");
         callback(NetworkAdapterInstaller.DisableRedirection());
     });
 }
Exemplo n.º 2
0
 public static async void CloseNetwork()
 {
     await Task.Run(() => {
         try
         {
             NetworkAdapterInstaller.DisableRedirection();
             NetworkAdapterInstaller.DisableLoopAdapters();
         }
         catch
         {
         }
     });
 }