Пример #1
0
        /// <summary>
        /// Gets Processor Information 
        /// </summary>
        /// <returns>
        /// A <see cref="CPUInfo"/>
        /// </returns>
        public override CPUInfo GetCPUInfo()
        {
            CPUInfo ci = new CPUInfo();
            ci.Name = "Unknown";
            ci.Speed = 0;
            ci.Vendor = "Unknown";
            ci.UUID = "Unknown";

            // TODO get CPU information

            return ci;
        }
Пример #2
0
 /// <summary>
 /// Returns current CPU information.
 /// </summary>
 /// <returns>CPU inforomation.</returns>
 public override CPUInfo GetCPUInfo()
 {
     CPUInfo ci = new CPUInfo();
     ci.Name = "Unknown";
     ci.Speed = 0;
     ci.Vendor = "Unknown";
     ci.UUID = "Unknown";
     string Key = "Win32_Processor";
     ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from " + Key);
     foreach (ManagementObject share in searcher.Get())
     {
         foreach (PropertyData PC in share.Properties)
         {
             if (PC.Name == "Name")
             {
                 ci.Name = PC.Value.ToString();
             }
             if (PC.Name == "CurrentClockSpeed")
             {
                 ci.Speed = Double.Parse(PC.Value.ToString());
             }
             if (PC.Name == "Manufacturer")
             {
                 ci.Vendor = PC.Value.ToString();
             }
             if (PC.Name == "ProcessorId")
             {
                 ci.UUID = PC.Value.ToString();
             }
         }
     }
     return ci;
 }