TestComputerInfoForm.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Y.Utils.WindowsUtils.InfoUtils;
  10. namespace Y.Test.Views
  11. {
  12. public partial class TestComputerInfoForm : Form
  13. {
  14. public TestComputerInfoForm()
  15. {
  16. InitializeComponent();
  17. }
  18. private void TestComputerInfoForm_Load(object sender, EventArgs e)
  19. {
  20. Print("UserName: " + Environment.UserName);
  21. Print("UserDomainName: " + Environment.UserDomainName);
  22. Print("TickCount: " + Environment.TickCount);
  23. Print("ProcessorCount: " + Environment.ProcessorCount);
  24. Print("OSVersion: " + Environment.OSVersion);
  25. Print("MachineName: " + Environment.MachineName);
  26. Print("Is64BitOperatingSystem: " + Environment.Is64BitOperatingSystem);
  27. Print("-------------------------");
  28. Print("CPUID: " + ComputerInfoTool.CPUID());
  29. Print("CPU信息: " + ComputerInfoTool.CPUModel());
  30. Print("显卡信息: " + string.Join(",", ComputerInfoTool.GraphicsCardModel()));
  31. Print("声卡信息: " + string.Join(",", ComputerInfoTool.SoundCardModel()));
  32. Print("内存: " + ComputerInfoTool.AvailablePhysicalMemory() + " / " + ComputerInfoTool.TotalPhysicalMemory());
  33. Print("硬盘ID: " + ComputerInfoTool.GetHDiskID("C"));
  34. Print("硬盘信息: " + string.Join(",", ComputerInfoTool.HardDiskModel()));
  35. Print("操作系统: " + ComputerInfoTool.GetOS());
  36. Print("系统类型: " + ComputerInfoTool.GetSystemType());
  37. Print("系统安装日期: " + ComputerInfoTool.GetSystemInstallDate());
  38. Print("登录用户名: " + ComputerInfoTool.GetLoginUserName());
  39. Print("计算机名: " + ComputerInfoTool.GetComputerName());
  40. Print("系统所有用户名: " + string.Join(",", ComputerInfoTool.GetSysUserNames()));
  41. Print("主板: " + ComputerInfoTool.GetBoardManufacturer());
  42. Print("主板: " + ComputerInfoTool.GetBoardProduct());
  43. Print("主板序列号: " + ComputerInfoTool.GetBoardSerialNumber());
  44. }
  45. private void Print(string s)
  46. {
  47. textBox1.AppendText(s);
  48. textBox1.AppendText(Environment.NewLine);
  49. }
  50. }
  51. }