privatestring[]GetMoc()
{
string[]str=newstring[3];
ManagementClassmcCpu=newManagementClass("win32_Processor");
ManagementObjectCollectionmocCpu=mcCpu.GetInstances();
foreach(ManagementObjectminmocCpu)
{
str[0]=m["ProcessorId"].ToString();
}
ManagementClassmcHD=newManagementClass("win32_logicaldisk");
ManagementObjectCollectionmocHD=mcHD.GetInstances();
foreach(ManagementObjectminmocHD)
{
if(m["DeviceID"].ToString()=="C:")
{
str[1]=m["VolumeSerialNumber"].ToString();
break;
}
}
ManagementClassmcMAC=newManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollectionmocMAC=mcMAC.GetInstances();
foreach(ManagementObjectminmocMAC)
{
if((bool)m["IPEnabled"])
{
str[2]=m["MacAddress"].ToString();
break;
}
}
returnstr;
}
时间: 2024-11-05 12:21:49