예제 #1
0
 /// <summary>
 /// 获取当前类对象的一个实例
 /// </summary>
 public static MachineInfoHelper I()
 {
     if (Instance == null)
     {
         Instance = new MachineInfoHelper();
     }
     return(Instance);
 }
예제 #2
0
        //用法示例
        private string example()
        {
            string            Info = "";
            MachineInfoHelper info = MachineInfoHelper.I();       //获取主机的对象信息


            Info  = "\r\n主机名:" + Dns.GetHostName(); //获取主机名称
            Info += "\r\n系统类型:" + info.GetSystemType();
            Info += "\r\n物理内存:" + info.GetPhysicalMemory();


            Info += "\r\n\r\n本地IP:";
            string[] LocalIp = info.GetLocalIpAddress();
            foreach (string ip in LocalIp)
            {
                Info += "\r\n" + ip;
            }


            Info += "\r\n\r\n外网IP:";
            string[] ExternalIp = info.GetExtenalIpAddress();
            foreach (string ip in ExternalIp)
            {
                Info += "\r\n" + ip;
            }


            Info += "\r\n\r\nMAC:";
            Info += "\r\n" + info.GetNetCardMACAddress();
            //Info += "\r\n" + info.GetMacAddress(LocalIp[0]);


            Info += "\r\n";
            Info += "\r\nCPU序列号:" + info.GetCPUSerialNumber();
            //Info += "\r\nCPU编号:" + info.GetCPUID();
            //Info += "\r\nCPU版本信息:" + info.GetCPUVersion();
            //Info += "\r\nCPU名称信息:" + info.GetCPUName();
            //Info += "\r\nCPU制造厂商:" + info.GetCPUManufacturer();
            //Info += "\r\n主板制造厂商:" + info.GetBoardManufacturer();


            //Info += "\r\n主板序列号:" + info.GetBIOSSerialNumber();
            //Info += "\r\n硬盘序列号:" + info.GetHardDiskSerialNumber();
            //Info += "\r\n显卡PNPDeviceID:\r\n" + info.GetVideoPNPID();
            //Info += "\r\n声卡PNPDeviceID:\r\n" + info.GetSoundPNPID();


            return(Info);
        }