コード例 #1
0
ファイル: PM.cs プロジェクト: CID6/D2D-App
 public void Output()
 {
     //Console.Clear();
     Console.WriteLine(CPUName);
     CPUSensors.ForEach(Console.WriteLine);
     if (MOBOName != null)
     {
         Console.WriteLine(MOBOName);
     }
     MOBOSensors.ForEach(Console.WriteLine);
     if (RAMName != null)
     {
         Console.WriteLine(RAMName);
     }
     RAMSensors.ForEach(Console.WriteLine);
     Console.WriteLine(GPUATIName);
     GPUATISensors.ForEach(Console.WriteLine);
     Console.WriteLine(GPUNVName);
     GPUNVSensors.ForEach(Console.WriteLine);
     for (int i = 0; i < HDDReadsC.Count; i++)
     {
         Console.WriteLine(HDDNames[i] + " Size: " + HDDSizes[i] + "GB");
         Console.WriteLine("Read: " + (HDDReadsC[i].NextValue() / 1024 / 1024).ToString("0.00") + "MB/S");
         Console.WriteLine("Write: " + (HDDWritesC[i].NextValue() / 1024 / 1024).ToString("0.00") + "MB/S");
     }
     //HDDNames.ForEach(Console.WriteLine);
     //HDDSizes.ForEach(Console.WriteLine);
     // Console.ReadKey();
 }
コード例 #2
0
ファイル: PM.cs プロジェクト: CID6/D2D-App
 public void ClearAllLists()
 {
     CPUSensors.Clear();
     MOBOSensors.Clear();
     GPUATISensors.Clear();
     GPUNVSensors.Clear();
     //HDDNames.Clear();
     RAMSensors.Clear();
 }
コード例 #3
0
ファイル: PM.cs プロジェクト: CID6/D2D-App
        public void GetInfo()
        {
            ClearAllLists();
            foreach (IHardware hardware in hardwares)
            {
                //hardware.Update();
                if (hardware.HardwareType == HardwareType.CPU)
                {
                    CPUName = "Processor: " + hardware.Name;

                    foreach (ISensor sensor in hardware.Sensors)
                    {
                        if (sensor.SensorType == SensorType.Load)
                        {
                            CPUSensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault().ToString("0.") + "%");
                        }
                        if (sensor.SensorType == SensorType.Temperature && sensor.Name == "CPU Package")
                        {
                            CPUSensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault().ToString("0.") + "°C");
                        }
                    }
                }

                if (hardware.HardwareType == HardwareType.Mainboard)
                {
                    MOBOName = "Motherboard: " + hardware.Name;

                    //foreach (ISensor sensor in hardware.Sensors)
                    //{
                    //    if (sensor.SensorType == SensorType.Voltage) { MOBOSensors.Clear(); MOBOSensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault() + "V"); }
                    //    if (sensor.SensorType == SensorType.Temperature) { MOBOSensors.Clear(); MOBOSensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault().ToString("0.") + "°C"); }
                    //}
                }

                if (hardware.HardwareType == HardwareType.RAM)
                {
                    // RAMName = hardware.Name;
                    foreach (ISensor sensor in hardware.Sensors)
                    {
                        //if (sensor.SensorType == SensorType.Load) { RAMSensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault() + "%"); }
                        //if (sensor.SensorType == SensorType.Data) { RAMSensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault() + "GB"); }
                        if (sensor.SensorType == SensorType.Data)
                        {
                            if (sensor.Name == "Used Memory")
                            {
                                RAMUsed = sensor.Value.GetValueOrDefault();
                            }
                            if (sensor.Name == "Available Memory")
                            {
                                RAMLeft = sensor.Value.GetValueOrDefault();
                            }
                            //RAMTotal = RAMUsed + RAMLeft;
                            //RAMUsed = Math.Round(RAMUsed, 2);
                            // RAMTotal = Math.Round(RAMTotal, 2);
                        }
                    }
                    RAMSensors.Add("Memory Used/Memory Total " + RAMUsed.ToString("0.00") + "GB/" + RAMTotal + "GB");
                }

                //if (hardware.HardwareType == HardwareType.HDD)
                //{
                //    HDDName = hardware.Name;
                //    foreach (ISensor sensor in hardware.Sensors)
                //    {
                //        if (sensor.SensorType == SensorType.Load) { HDDSensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault() + "%"); }//used in %
                //        if (sensor.SensorType == SensorType.Data) HDDSensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault() + " GB"); // data written in GB (SSD)
                //        if (sensor.SensorType == SensorType.Temperature) HDDSensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault() + "°C"); // temp
                //    }
                //}

                if (hardware.HardwareType == HardwareType.GpuAti)
                {
                    GPUATIName = hardware.Name;
                    foreach (ISensor sensor in hardware.Sensors)
                    {
                        if (sensor.SensorType == SensorType.Load)
                        {
                            GPUATISensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault().ToString("0.") + "%");
                        }
                        if (sensor.SensorType == SensorType.Temperature && (!sensor.Name.Contains("VRM") && (!sensor.Name.Contains("Hot Spot"))))
                        {
                            GPUATISensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault() + "°C");
                        }
                    }
                }

                if (hardware.HardwareType == HardwareType.GpuNvidia)
                {
                    GPUNVName = hardware.Name;
                    foreach (ISensor sensor in hardware.Sensors)
                    {
                        if (sensor.SensorType == SensorType.Load)
                        {
                            GPUNVSensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault() + "%");
                        }
                        if (sensor.SensorType == SensorType.Temperature)
                        {
                            GPUNVSensors.Add(sensor.Name + ": " + sensor.Value.GetValueOrDefault() + "°C");
                        }
                    }
                }
            }
        }