一旦我们的软件投入使用,“关键”机器信息将被记录并用于调试目的。
“关键”信息可能包括对调试应用程序“通常”很重要的数据。它可能包括:
- 操作系统
- 已安装 Windows 更新
- 硬件信息:CPU、内存、硬盘
- 正在运行的进程/服务
- 当前用户帐户
很抱歉提出如此含糊的问题,我相信使用 WMI 编写自定义问题相当简单。但是,如果已经有一个库/框架旨在执行此类操作,那么最好不要重新发明轮子。
最佳答案
试试这样的东西,伪代码!
private StringBuilder GetSystemInformationString()
{
StringBuilder sb = new StringBuilder();
PropertyInfo[] properties = typeof(System.Windows.Forms.SystemInformation).GetProperties();
if (properties != null && properties.Length > 0)
{
foreach (PropertyInfo pin in properties)
{
sb.Append(System.Environment.NewLine);
sb.Append(pin.Name + " : " + pin.GetValue(pin, null));
}
}
return sb;
}
为了内存可以使用这样的东西:
(System.Diagnostics.Process.GetCurrentProcess().WorkingSet64 / 1024).ToString() + " Kb";
问候。
关于c# - 为调试目的获取 "critical"机器信息的库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6762103/