TestComputerInfoForm.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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: " + ComputerInfoTool.UserName());
  21. Print("登录用户名: " + ComputerInfoTool.UserName2());
  22. Print("UserDomainName: " + ComputerInfoTool.UserDomainName());
  23. Print("TickCount: " + ComputerInfoTool.TickCount());
  24. Print("ProcessorCount: " + ComputerInfoTool.ProcessorCount());
  25. Print("OSVersion: " + ComputerInfoTool.OSVersion());
  26. Print("Is64BitOperatingSystem: " + ComputerInfoTool.Is64BitOperatingSystem());
  27. Tuple<string, string> cpuinfo = ComputerInfoTool.CpuInfo();
  28. Print("CPU 序列号 " + cpuinfo.Item1 + " 型号 " + cpuinfo.Item2);
  29. Print("显卡信息: " + string.Join(",", ComputerInfoTool.GraphicsCardModel()));
  30. Print("声卡信息: " + string.Join(",", ComputerInfoTool.SoundCardModel()));
  31. Print("内存: " + ComputerInfoTool.AvailablePhysicalMemory() + " / " + ComputerInfoTool.TotalPhysicalMemory());
  32. List<Tuple<string, string>> harddiskinfo = ComputerInfoTool.HardDiskInfo();
  33. harddiskinfo.ForEach(x =>
  34. {
  35. Print("硬盘 序列号 " + x.Item1 + " 型号 " + x.Item2);
  36. });
  37. var osinfo = ComputerInfoTool.OsInfo();
  38. Print("操作系统: " + osinfo.Item1 + " " + osinfo.Item2+" "+osinfo.Item3);
  39. Print("系统类型: " + ComputerInfoTool.SystemType());
  40. Print("计算机名: " + ComputerInfoTool.MachineName());
  41. Print("系统所有用户名: " + string.Join(",", ComputerInfoTool.UserNames()));
  42. var boardinfo = ComputerInfoTool.BoardInfo();
  43. Print("主板 制造商 " + boardinfo.Item1 + " 型号 " + boardinfo.Item2 + " 序列号 " + boardinfo.Item3);
  44. }
  45. private void Print(string s)
  46. {
  47. textBox1.AppendText(s);
  48. textBox1.AppendText(Environment.NewLine);
  49. }
  50. }
  51. }