/// <summary> /// 根据 IP 地址获取物理地址 /// </summary> /// <param name="IPAddress"IP 地址></param> /// <returns>物理地址</returns> public static string GetMacByIp(string IPAddress) { List <IpInfo> ipinfos = WindowsSystemInfoAPI.GetIpInfo(); foreach (IpInfo ipinfo in ipinfos) { if (string.Compare(ipinfo.IPAddress, IPAddress, true) == 0) { return(ipinfo.MACAddress); } } return(""); }
public SystemInfo GetSystemInfo() { SystemInfo systemInfo = new SystemInfo(); try { WindowsSystemInfoAPI api = new WindowsSystemInfoAPI(); systemInfo.CpuUsage = api.CpuLoad; systemInfo.MemoryAvailable = api.MemoryAvailable; systemInfo.PhysicalMemory = api.PhysicalMemory; } catch (Exception ex) { throw ex; } return(systemInfo); }