public void Handle(NetworkAdapterDomain domain)
 {
     foreach (var adapter in domain.GetNetworkAdapters())
     {
         adapter.MediaSubType = RegistryUtil.GetValueListByCondition(@"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\" + adapter.Guid + @"\Connection", "MediaSubType");
     }
 }
Example #2
0
 public void Handle(NetworkAdapterDomain domain)
 {
     foreach (var adapter in domain.GetNetworkAdapters())
     {
         adapter.LowerRange = RegistryUtil.GetValueListByCondition(@"SYSTEM\ControlSet001\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\" + adapter.Index.ToString("D4") + @"\Ndi\Interfaces", "LowerRange");
     }
 }
Example #3
0
        public void Handle(NetworkAdapterDomain domain)
        {
            var fileName        = AppDomain.CurrentDomain.BaseDirectory + DateTime.Now.ToString("yyyyMMdd") + ".txt";
            var physicalAdapter = "";

            foreach (var adapter in domain.GetNetworkAdapters())
            {
                var content = string.Format("{0}  {1} {2} {3} {4} {5} {6} {7} {8}",
                                            adapter.Characteristics,
                                            adapter.Index,
                                            adapter.Guid,
                                            adapter.LowerRange,
                                            adapter.MacAddress,
                                            adapter.MediaSubType,
                                            adapter.NetEnabled,
                                            adapter.PhysicalAdapter,
                                            adapter.AdapterType);
                Console.WriteLine(content);
                File.AppendAllText(fileName, content + Environment.NewLine);
                if (adapter.AdapterType == EnumAdapterType.无线物理网卡 ||
                    adapter.AdapterType == EnumAdapterType.线物理网卡)
                {
                    physicalAdapter += content + Environment.NewLine;
                }
            }
            Console.WriteLine("==============================");
            Console.WriteLine("启用中的物理网卡:");
            Console.WriteLine(physicalAdapter);
        }
 public void Handle(NetworkAdapterDomain domain)
 {
     foreach (var adapter in domain.GetNetworkAdapters())
     {
         adapter.Characteristics = RegistryUtil.GetValueListByCondition(@"SYSTEM\ControlSet001\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\" + adapter.Index.ToString("D4"), "Characteristics");
         //转换成16进制
         //int value;
         //Int32.TryParse(adapter.Characteristics, out value);
         //adapter.Characteristics = value.ToString("x");
     }
 }
 public void Handle(NetworkAdapterDomain domain)
 {
     foreach (var adapter in domain.GetNetworkAdapters())
     {
         if (adapter.NetEnabled &&
             adapter.PhysicalAdapter &&
             CheckoutPhysicalAdapter(adapter.Characteristics))
         {
             if (adapter.MediaSubType == "2" &&
                 adapter.LowerRange != null &&
                 (adapter.LowerRange.ToLower().Contains("wifi") ||
                  adapter.LowerRange.Contains("wlan")))
             {
                 adapter.AdapterType = EnumAdapterType.无线物理网卡;
             }
             else
             {
                 adapter.AdapterType = EnumAdapterType.线物理网卡;
             }
         }
     }
 }