예제 #1
0
        public void Load()
        {
            var Watch = new Stopwatch();

            Watch.Start();

            try
            {
                var Searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
                CPU = new CPUInfo(Searcher.Get().Cast <ManagementBaseObject>().First());
            }
            catch
            {
                CPU = new CPUInfo();
            }
            Global.Logger.Log(ConsoleColor.Cyan, LogType.WMI, null, "Loading Processor data took " + Watch.ElapsedMilliseconds + "ms");
            Watch.Restart();

            try
            {
                var Searcher = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem");
                OS = new OsInfo(Searcher.Get().Cast <ManagementBaseObject>().FirstOrDefault());
            }
            catch
            {
                OS = new OsInfo();
            }
            Global.Logger.Log(ConsoleColor.Cyan, LogType.WMI, null, "Loading Operating System data took " + Watch.ElapsedMilliseconds + "ms");
            Watch.Restart();

            try
            {
                var Searcher = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem");
                MemInfo = new MemInfo(Searcher.Get().Cast <ManagementBaseObject>().FirstOrDefault());
            }
            catch
            {
                MemInfo = new MemInfo();
            }
            Global.Logger.Log(ConsoleColor.Cyan, LogType.WMI, null, "Loading Memory data took " + Watch.ElapsedMilliseconds + "ms");
            Watch.Restart();

            try
            {
                var Searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
                VideoCardInfo = new VideoCardInfo(Searcher.Get().Cast <ManagementBaseObject>().FirstOrDefault());
            }
            catch
            {
                VideoCardInfo = new VideoCardInfo();
            }
            Global.Logger.Log(ConsoleColor.Cyan, LogType.WMI, null, "Loading Video card data took " + Watch.ElapsedMilliseconds + "ms");
            Watch.Stop();
            Watch = null;
        }
예제 #2
0
        public void Load()
        {
            Logger.Log(LogType.SysInfo, ConsoleColor.Magenta, null, "Loading system information...");

            CPU           = new CPUInfo();       // 0ms
            OS            = new OsInfo();        // 0ms
            MemInfo       = new MemInfo();       // 7-8ms
            VideoCardInfo = new VideoCardInfo(); // 1ms

            Logger.Log(LogType.SysInfo, ConsoleColor.Magenta, null, "System information loaded!");
        }