資源簡(jiǎn)介
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Diagnostics;
using?System.Drawing;
using?System.Linq;
using?System.Management;
using?System.Net;
using?System.Net.NetworkInformation;
using?System.Net.Sockets;
using?System.Text;
using?System.Text.Regularexpressions;
using?System.Threading;
using?System.Threading.Tasks;
using?System.Windows.Forms;
namespace?IP
{
????public?partial?class?IP變更工具?:?Form
????{
???????????
????????List?networkAdapter?=?new?List();
????????public?IP變更工具()
????????{
????????????InitializeComponent();
????????}
????????///?
????????///?獲取所有適配器類(lèi)型,適配器被禁用則不能獲取到
????????///?
????????///?
????????public?void?GetAllNetworkAdapters()?//如果適配器被禁用則不能獲取到
????????{
????????????NetworkInterface[]?adapters?=?NetworkInterface.GetAllNetworkInterfaces();
????????????foreach?(NetworkInterface?adapter?in?adapters)
????????????{
????????????????if?(adapter.OperationalStatus.ToString()?==?“Up“)
????????????????{
????????????????????if?(adapter.NetworkInterfaceType?==?NetworkInterfaceType.Ethernet?||?adapter.NetworkInterfaceType?==?NetworkInterfaceType.Wireless80211)
????????????????????{
????????????????????????if?(adapter.Name.ToString().Contains(“VMware“)?==?false)
??????????????????????{
????????????????????????????IPInterfaceProperties?ips?=?adapter.GetIPProperties();
????????????????????????????string?description?=?adapter.Name;//描述
????????????????????????????string?networkInterfaceType?=?adapter.NetworkInterfaceType.ToString();
????????????????????????????string?speed?=?adapter.Speed?/?1000?/?1000?+?“MB“;
????????????????????????????PhysicalAddress?macAddress?=?adapter.GetPhysicalAddress();?//物理地址集合
????????????????????????????string?networkInterfaceID?=?adapter.Id;//網(wǎng)絡(luò)適配器標(biāo)識(shí)符
????????????????????????????GatewayIPAddressInformationCollection?getwaryes?=?ips.GatewayAddresses;?//網(wǎng)關(guān)地址集合
????????????????????????????UnicastIPAddressInformationCollection?ipAddresses?=?ips.UnicastAddresses;?//IP地址集合
???????????????????????????
????????????????????????????IPAddressCollection?dhcpServerAddresses?=?ips.DhcpServerAddresses;//DHCP地址集合
????????????????????????????bool?IsDhcpEnabled?=?ips.GetIPv4Properties()?==?null???false?:?ips.GetIPv4Properties().IsDhcpEnabled;?//是否啟用DHCP服務(wù)
????????????????????????????IPInterfaceProperties?adapterProperties?=?adapter.GetIPProperties();//獲取IPInterfaceProperties實(shí)例??
????????????????????????????IPAddressCollection?dnsAddresses?=?adapterProperties.DnsAddresses;
????????????????????????????comboBox1.Items.Add(description);
???????????????????????????//?MessageBox.Show(adapter.OperationalStatus.ToString());
????????????????????????????networkAdapter.Add(new?NetworkAdapter(description?networkInterfaceType?speed?macAddress?networkInterfaceID?getwaryes?ipAddresses?dhcpServerAddresses?IsDhcpEnabled?dnsAddresses));
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????目錄???????????0??2020-10-26?19:27??.vs\
?????目錄???????????0??2020-10-26?19:27??.vs\IP\
?????目錄???????????0??2020-10-26?19:27??.vs\IP\v16\
?????文件???????46592??2020-10-30?14:58??.vs\IP\v16\.suo
?????目錄???????????0??2020-10-26?19:27??.vs\IP\v16\Server\
?????目錄???????????0??2020-10-26?19:27??.vs\IP\v16\Server\sqlite3\
?????文件???????????0??2020-01-27?16:45??.vs\IP\v16\Server\sqlite3\db.lock
?????文件??????606208??2020-02-26?17:26??.vs\IP\v16\Server\sqlite3\storage.ide
?????文件????????1111??2020-01-27?16:44??IP.sln
?????目錄???????????0??2020-10-26?19:27??IP\
?????文件?????????187??2020-01-27?16:44??IP\App.config
?????目錄???????????0??2020-10-26?19:27??IP\bin\
?????目錄???????????0??2020-10-26?19:27??IP\bin\Debug\
?????文件???????23552??2020-10-30?14:57??IP\bin\Debug\IP.exe
?????文件?????????187??2020-01-27?16:44??IP\bin\Debug\IP.exe.config
?????文件???????52736??2020-10-30?14:57??IP\bin\Debug\IP.pdb
?????目錄???????????0??2020-01-27?21:12??IP\bin\Release\
?????文件???????14007??2020-05-07?14:57??IP\Form1.cs
?????文件???????13736??2020-01-30?23:30??IP\Form1.Designer.cs
?????文件????????5817??2020-01-30?23:30??IP\Form1.resx
?????文件????????4037??2020-01-30?19:28??IP\IP.csproj
?????文件????????1819??2020-01-30?20:27??IP\net.cs
?????目錄???????????0??2020-10-26?19:27??IP\obj\
?????目錄???????????0??2020-10-30?14:58??IP\obj\Debug\
?????文件?????????523??2020-01-28?18:07??IP\Program.cs
?????目錄???????????0??2020-10-26?19:27??IP\Properties\
?????文件????????3301??2020-01-28?12:29??IP\Properties\app.manifest
?????文件????????1296??2020-01-27?16:44??IP\Properties\AssemblyInfo.cs
?????文件????????2817??2020-01-27?16:44??IP\Properties\Resources.Designer.cs
?????文件????????5612??2020-01-27?16:44??IP\Properties\Resources.resx
?????文件????????1089??2020-01-27?16:44??IP\Properties\Settings.Designer.cs
............此處省略2個(gè)文件信息
評(píng)論
共有 條評(píng)論