초기 커밋.
This commit is contained in:
33
JWH/EXTENSIONS/ExtensionNetwork.cs
Normal file
33
JWH/EXTENSIONS/ExtensionNetwork.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JWH
|
||||
{
|
||||
|
||||
public static class ExtensionNetwork
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Get PhysicalAddress (MAC Address)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetPhysicalAddress()
|
||||
{
|
||||
|
||||
List<NetworkInterface> list = new List<NetworkInterface>();
|
||||
foreach(NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
|
||||
{
|
||||
if (nic.OperationalStatus == OperationalStatus.Up)
|
||||
list.Add(nic);
|
||||
}
|
||||
|
||||
return list[0].GetPhysicalAddress().ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user