Public String [] getlocalmachineinfo (string type)
{
Switch (type. toupper ())
{
Case "ip ":
Iphostentry IPHE = new iphostentry ();
IPHE = DNS. gethostentry (DNS. gethostname ());
String [] resultip = new string [IPHE. Addresslist. Length];
For (INT I = 0; I <IPHE. Addresslist. length; I ++)
{
Resultip [I] = IPHE. Addresslist [I]. tostring ();
}
Return resultip;
Break;
Case "Mac ":
Managementclass MC;
Managementobjectcollection MOC;
MC = new managementclass ("win32_networkadapterconfiguration ");
MoC = mc. getinstances ();
Int J = 0;
Foreach (managementobject Mo in MoC)
{
If (bool) Mo ["ipenabled"] = true)
{
J = J + 1;
}
}
String [] resultmac = new string [J];
J = 0;
Foreach (managementobject Mo in MoC)
{
If (bool) Mo ["ipenabled"] = true)
{
Resultmac [J] = Mo ["macaddress"]. tostring (). Replace (":","");
J = J + 1;
}
}
Return resultmac;
Break;
Case "HDD ":
Managementobject disk;
Disk = new managementobject ("win32_logicaldisk.deviceid = \" C :\"");
Disk. Get ();
String [] resulthdd = new string [1];
Resulthdd [0] = disk. getpropertyvalue ("volumeserialnumber"). tostring ();
Return resulthdd;
Break;
Case "user ":
Managementclass mcuser = new managementclass ("win32_computersystem ");
Managementobjectcollection mocuser = mcuser. getinstances ();
Int K = 0;
Foreach (managementobject Mo in mocuser)
{
K = k + 1;
}
String [] resultuser = new string [k];
K = 0;
Foreach (managementobject Mo in mocuser)
{
Resultuser [k] = Mo ["username"]. tostring ();
K = k + 1;
}
Return resultuser;
Break;
Default:
String [] resultnull = new string [1];
Return resultnull;
Break;
}
}