init lserp cs 5.0
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Management;
|
||||
|
||||
namespace Zhaizj.Framework.Utils
|
||||
{
|
||||
public class MacGet
|
||||
{
|
||||
public static string GetNetCardMacAddress()
|
||||
{
|
||||
ManagementClass mc;
|
||||
ManagementObjectCollection moc;
|
||||
mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
|
||||
moc = mc.GetInstances();
|
||||
string str = "";
|
||||
foreach (ManagementObject mo in moc)
|
||||
{
|
||||
if ((bool)mo["IPEnabled"] == true)
|
||||
str = mo["MacAddress"].ToString();
|
||||
}
|
||||
str = str.Replace(':', '-');
|
||||
return str;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user