請教各位:
目前寫一段程式碼可以得知個人電腦的設備,想請教有語法可以用C#抓到紅色框框的資料?
winOS.Text = RuntimeInformation.OSDescription 目前得知此語法可以抓到WIN10
再麻煩大家的幫忙了謝謝
UserName.Text = Environment.MachineName;
ManagementClass mc = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
CPU.Text = mo["Name"].ToString();//抓電腦名稱
}
ManagementClass disk = new ManagementClass("Win32_LogicalDisk");
ManagementObjectCollection wmifind = disk.GetInstances();
foreach (ManagementObject mobj in wmifind)
{
long size = long.Parse(mobj["Size"].ToString());
HD.Text = "實際大小: " + size/(1024*1024*1024)+"GB";//抓取硬碟大小
}
ManagementClass cimobject1 = new ManagementClass("Win32_PhysicalMemory");
ManagementObjectCollection moc1 = cimobject1.GetInstances();
foreach (ManagementObject mo1 in moc1)
{
double Rams = ((Math.Round(Int64.Parse(mo1.Properties["Capacity"].Value.ToString()) / 1024 / 1024 / 1024.0, 1)));// 抓取記憶體大小
Ram.Text = Rams.ToString()+"GB";
}
winOS.Text = RuntimeInformation.OSDescription;//抓取WINDOWS 10專業版