PC_Info/WindowsFormsApplication1/DAL/HardInfoClass.cs
(开头部分) 45KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Management; //需要在解决方案中引用System.Management.DLL文件
using System.Collections;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using DAL;
using System.Linq;
using System.Drawing.Printing;
namespace WindowsFormsApplication1.DAL
{
public sealed class HardInfoClass
{
//引入函数库
[DllImport("kernel32.dll")]
private static extern int GetVolumeInformation(
string lpRootPathName,
string lpVolumeNameBuffer,
int nVolumeNameSize,
ref int lpVolumeSerialNumber,
int lpMaximumComponentLength,
int lpFileSystemFlags,
string lpFileSystemNameBuffer,
int nFileSystemNameSize
);
#region 静态变量
static CpuInfo cpu;
static MotherBoard motherBoard;
static BiosInfo bios;
static PhysicalDiskInfo physicalDisk;
const string PROCESSOR = "Select * From Win32_Processor";
const string PROCESSOR2 = "Win32_Processor";
const string BASEBOARD = "Select * From Win32_BaseBoard";
const string BASEBOARD2 = "Win32_BaseBoard";
const string BIOS = "Select * From Win32_BIOS";
const string BIOS2 = "Win32_BIOS";
const string DISKDRIVE = "Select * From Win32_DiskDrive";
const string DISKDRIVE2 = "Win32_DiskDrive";
static Hashtable Table = null;
#endregion
//构造函数
public HardInfoClass()
{
//
// TODO: 在此处添加构造函数逻辑
//
Table = new Hashtable();
}
//测试
public Hashtable GetAllInfos(Informations info)
{
ManagementClass mcls = new ManagementClass(info.ToString());
foreach (ManagementObject mo in mcls.GetInstances())
{
foreach (PropertyData pd in mo.Properties)
{
后面还有 1094 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
