Skip to content

Commit

Permalink
1.增加一些硬件信息获取
Browse files Browse the repository at this point in the history
2.优化excel导出
  • Loading branch information
ldqk committed Oct 18, 2022
1 parent 3834487 commit 60157a5
Show file tree
Hide file tree
Showing 18 changed files with 541 additions and 357 deletions.
35 changes: 35 additions & 0 deletions Masuit.Tools.Abstractions/Hardware/BiosInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace Masuit.Tools.Hardware;

/// <summary>
/// BIOS信息
/// </summary>
public class BiosInfo
{
private static readonly BiosInfo _local = SystemInfo.GetBiosInfo();

/// <summary>
/// 本地实例
/// </summary>
public static BiosInfo Local => _local;

/// <summary>
/// ID
/// </summary>
public string ID { get; set; }

/// <summary>
/// 序列号
/// </summary>
public string SerialNumber { get; set; }

/// <summary>
/// 型号
/// </summary>
public string Model { get; set; }

/// <summary>
/// 制造商
/// </summary>
public string Manufacturer { get; set; }

}
29 changes: 21 additions & 8 deletions Masuit.Tools.Abstractions/Hardware/CpuInfo.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
namespace Masuit.Tools.Hardware
using System.Collections.Generic;

namespace Masuit.Tools.Hardware
{
/// <summary>
/// CPU模型
/// </summary>
public class CpuInfo
{
private static readonly List<CpuInfo> _locals = SystemInfo.GetCpuInfo();

/// <summary>
/// 本地实例
/// </summary>
public static List<CpuInfo> Locals => _locals;

/// <summary>
/// 获取CPU核心数
/// </summary>
public static int ProcessorCount => SystemInfo.ProcessorCount;

/// <summary>
/// 获取CPU占用率 %
/// </summary>
public static float CpuLoad => SystemInfo.CpuLoad;

/// <summary>
/// 设备ID
/// </summary>
Expand Down Expand Up @@ -40,11 +59,6 @@ public class CpuInfo
/// </summary>
public int NumberOfLogicalProcessors { get; set; }

/// <summary>
/// CPU使用率
/// </summary>
public double CpuLoad { get; set; }

/// <summary>
/// CPU位宽
/// </summary>
Expand All @@ -53,12 +67,11 @@ public class CpuInfo
/// <summary>
/// 核心温度
/// </summary>
public double Temperature { get; set; }
public double Temperature => SystemInfo.GetCPUTemperature();

/// <summary>
/// 序列号
/// </summary>
public string SerialNumber { get; set; }
}
#pragma warning restore 1591
}
35 changes: 28 additions & 7 deletions Masuit.Tools.Abstractions/Hardware/DiskInfo.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
namespace Masuit.Tools.Hardware
using System.Collections.Generic;

namespace Masuit.Tools.Hardware;

/// <summary>
/// 磁盘信息
/// </summary>
public class DiskInfo
{
public class DiskInfo
{
public string SerialNumber { get; set; }
public string Model { get; set; }
public float Total { get; set; }
}
private static readonly List<DiskInfo> _locals = SystemInfo.GetDiskInfo();

/// <summary>
/// 本地实例
/// </summary>
public static List<DiskInfo> Locals => _locals;
/// <summary>
/// 序列号
/// </summary>
public string SerialNumber { get; set; }

/// <summary>
/// 型号
/// </summary>
public string Model { get; set; }

/// <summary>
/// 总容量
/// </summary>
public float Total { get; set; }
}
2 changes: 2 additions & 0 deletions Masuit.Tools.Abstractions/Hardware/RamInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/// </summary>
public class RamInfo
{
public static RamInfo Local => SystemInfo.GetRamInfo();

/// <summary>
/// 可用物理内存
/// </summary>
Expand Down
Loading

0 comments on commit 60157a5

Please sign in to comment.