/// <summary>
/// 返回本机的mac物理路径
/// </summary>
/// <returns></returns>
private string GetMac()
{
string mac = null;
//[DllImport("System.Management.dll")]
ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration");
ManagementObjectCollection queryCollection = query.Get();
foreach (ManagementObject mo in queryCollection)
{
if (mo["IPEnabled"].ToString() == "True")
mac = mo["MacAddress"].ToString();
}
return (mac);
}
/// 返回本机的mac物理路径
/// </summary>
/// <returns></returns>
private string GetMac()
{
string mac = null;
//[DllImport("System.Management.dll")]
ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration");
ManagementObjectCollection queryCollection = query.Get();
foreach (ManagementObject mo in queryCollection)
{
if (mo["IPEnabled"].ToString() == "True")
mac = mo["MacAddress"].ToString();
}
return (mac);
}