예제 #1
0
        public void InitRAM(IHardware board)
        {
            List<OHMSensor> _sensorList = new List<OHMSensor>();

            ISensor _ramClock = _hardware.Sensors.Where(s => s.SensorType == SensorType.Clock).FirstOrDefault();

            if (_ramClock != null)
            {
                Clock = new OHMSensor(_ramClock, DataType.Clock, "Clock", true);
                _sensorList.Add(Clock);
            }

            ISensor _voltage = null;

            if (board != null)
            {
                _voltage = board.SubHardware.SelectMany(h => h.Sensors).Where(s => s.SensorType == SensorType.Voltage && s.Name.Contains("RAM")).FirstOrDefault();
            }

            if (_voltage == null)
            {
                _voltage = _hardware.Sensors.Where(s => s.SensorType == SensorType.Voltage).FirstOrDefault();
            }

            if (_voltage != null)
            {
                Voltage = new OHMSensor(_voltage, DataType.Voltage, "Voltage");
                _sensorList.Add(Voltage);
            }

            ISensor _loadSensor = _hardware.Sensors.Where(s => s.SensorType == SensorType.Load && s.Index == 0).FirstOrDefault();

            if (_loadSensor != null)
            {
                Load = new OHMSensor(_loadSensor, DataType.Percent, "Load");
                _sensorList.Add(Load);
            }

            ISensor _usedSensor = _hardware.Sensors.Where(s => s.SensorType == SensorType.Data && s.Index == 0).FirstOrDefault();

            if (_usedSensor != null)
            {
                Used = new OHMSensor(_usedSensor, DataType.Gigabyte, "Used");
                _sensorList.Add(Used);
            }

            ISensor _availSensor = _hardware.Sensors.Where(s => s.SensorType == SensorType.Data && s.Index == 1).FirstOrDefault();

            if (_availSensor != null)
            {
                Available = new OHMSensor(_availSensor, DataType.Gigabyte, "Free");
                _sensorList.Add(Available);
            }

            Sensors = _sensorList.ToArray();
        }
예제 #2
0
 public MainboardMonitor(IHardware board)
     : base(board)
 {
     List<OHMSensor> _sensorList = new List<OHMSensor>();
     BoardTemperatures = new OHMSensor[0];
     BoardFanRPM = new OHMSensor[0];
     BoardFanPercent = new OHMSensor[0];
     HddTemperatures = new OHMSensor[0];
     if (board != null)
     {
         initBoardTemperatures(board, _sensorList);
         initBoardFanRpm(board, _sensorList);
         initBoardFanPercent(board, _sensorList);
     }
     Sensors = _sensorList.ToArray();
 }
예제 #3
0
        private void InitClocks( List<OHMSensor> _sensorList)
        {
            ISensor[] coreClocks =
                _hardware.Sensors.Where(s => s.SensorType == SensorType.Clock && s.Name.Contains("CPU")).ToArray();

            if (coreClocks.Length > 0)
            {

                    int cores = coreClocks.Max(s => s.Index);
                    CoreClocks = new OHMSensor[cores];
                    for (int i = 1; i <= cores; i++)
                    {
                        ISensor coreClock = coreClocks.Where(s => s.Index == i).FirstOrDefault();

                        if (coreClock != null)
                        {
                            CoreClocks[i - 1] = new OHMSensor(coreClock, DataType.Clock, string.Format("Core {0}", i - 1),
                                true);
                            _sensorList.Add(CoreClocks[i - 1]);
                        }
                    }

            }
        }
예제 #4
0
 public OptionalOhmSensor(OHMSensor value)
 {
     this.value = value;
 }
예제 #5
0
        private void InitTemperature(IHardware board, List<OHMSensor> _sensorList)
        {
            List<ISensor> cpuTemperatures = _hardware.Sensors.Where(s => s.SensorType == SensorType.Temperature).ToList();
            List<ISensor> boardTemperatures = board.Sensors.Where(s => s.SensorType == SensorType.Temperature).ToList();
            boardTemperatures.AddRange(board.SubHardware.SelectMany(s => s.Sensors).Where(s => s.SensorType == SensorType.Temperature));
            List<ISensor> boardCpuTemperatures = boardTemperatures.Where(s => s.Name.Contains("CPU")).ToList();

            if (board.SubHardware.ToList().Any(h => h.Name.Contains("IT8712F")))
            {
                PackageTemperature = new OHMSensor(boardTemperatures.First(), DataType.Celcius, "Package");
                _sensorList.Add(PackageTemperature);
                return;
            }

            if (cpuTemperatures.Count > 0)
            {
                if (cpuTemperatures.Count == 1)
                {
                    PackageTemperature = new OHMSensor(cpuTemperatures[0], DataType.Celcius, "Package");
                    _sensorList.Add(PackageTemperature);
                }
                else
                {
                    PackageTemperature = new OHMSensor(cpuTemperatures.FirstOrDefault(s => s.Name.Contains("Package")), DataType.Celcius, "Package");
                    Temperatures =
                        cpuTemperatures.Where(sensor => !sensor.Name.Contains("Package"))
                            .Select(r => new OHMSensor(r, DataType.Celcius, string.Format("Core {0}", r.Index))).ToArray();
                    if (PackageTemperature != null)
                    {
                        _sensorList.Add(PackageTemperature);
                    }
                    if (Temperatures.Length > 0)
                    {
                        _sensorList.AddRange(Temperatures);
                    }
                }
            }
            else if (boardCpuTemperatures.Count > 0)
            {
                if (boardCpuTemperatures.Count == 1)
                {
                    PackageTemperature = new OHMSensor(cpuTemperatures[0], DataType.Celcius, "Package");
                    _sensorList.Add(PackageTemperature);
                }
                //else: haven't seen any IO circuits that report core temperatures
            }
        }
예제 #6
0
        private void InitLoad(List<OHMSensor> _sensorList)
        {
            ISensor[] loadSensors = _hardware.Sensors.Where(s => s.SensorType == SensorType.Load).ToArray();

            if (loadSensors.Length > 0)
            {
                ISensor totalCpu = loadSensors.Where(s => s.Index == 0).FirstOrDefault();

                if (totalCpu != null)
                {
                    TotalLoad = new OHMSensor(totalCpu, DataType.Percent, "Load");
                    _sensorList.Add(TotalLoad);
                }

                    int cores = loadSensors.Max(s => s.Index);
                    CoreLoads = new OHMSensor[cores];
                    for (int i = 1; i <= cores; i++)
                    {
                        ISensor coreLoad = loadSensors.Where(s => s.Index == i).FirstOrDefault();

                        if (coreLoad != null)
                        {
                            CoreLoads[i - 1] = new OHMSensor(coreLoad, DataType.Percent, string.Format("Core {0}", i - 1));
                            _sensorList.Add(CoreLoads[i - 1]);
                        }
                    }

            }
        }
예제 #7
0
        private void InitFans(IHardware board, List<OHMSensor> _sensorList)
        {
            List<ISensor> fans = _hardware.Sensors.Where(s => s.SensorType == SensorType.Fan).ToList();
            fans.AddRange(board.Sensors.Where(s => s.SensorType == SensorType.Fan && s.Name.Contains("CPU")));
            fans.AddRange(board.SubHardware.SelectMany(h => h.Sensors).Where(s => s.SensorType == SensorType.Fan && s.Name.Contains("CPU")));

            List<ISensor> controls = _hardware.Sensors.Where(s => s.SensorType == SensorType.Fan).ToList();
            controls.AddRange(board.Sensors.Where(s => s.SensorType == SensorType.Control && s.Name.Contains("CPU")));
            controls.AddRange(board.SubHardware.SelectMany(h => h.Sensors).Where(s => s.SensorType == SensorType.Control && s.Name.Contains("CPU")));

            if (fans.Count < 0)
            {
                FanRPM = new OHMSensor(fans.FirstOrDefault(), DataType.RPM, "Fan");
                _sensorList.Add(FanRPM);
            }
            else
            {
                List<ISensor> fansLastResort = board.Sensors.Where(s => s.SensorType == SensorType.Fan).ToList();
                fansLastResort.AddRange(board.SubHardware.SelectMany(h => h.Sensors).Where(s => s.SensorType == SensorType.Fan));
                if (fansLastResort.Count > 0)
                {
                    FanRPM = new OHMSensor(fansLastResort.FirstOrDefault(), DataType.RPM, "Fan");
                    _sensorList.Add(FanRPM);
                }

            }
            if (controls.Count < 0)
            {
                FanPercent = new OHMSensor(controls.FirstOrDefault(), DataType.Percent, "Fan");
                _sensorList.Add(FanPercent);
            }
            else
            {
                List<ISensor> controlsLastResort = board.Sensors.Where(s => s.SensorType == SensorType.Control).ToList();
                controlsLastResort.AddRange(board.SubHardware.SelectMany(h => h.Sensors).Where(s => s.SensorType == SensorType.Control));
                if (controlsLastResort.Count > 0)
                {
                    FanPercent = new OHMSensor(controlsLastResort.FirstOrDefault(), DataType.Percent, "Fan");
                    _sensorList.Add(FanPercent);
                }

            }
        }
예제 #8
0
        public void InitGPU()
        {
            if (_hardware.HardwareType == HardwareType.GpuNvidia)
            {
                Vendor = "NVIDIA";
            }
            else if (_hardware.HardwareType == HardwareType.GpuAti)
            {
                Vendor = "AMD";
            }
            else
            {
                Vendor = "Unkown";
            }

            List<OHMSensor> _sensorList = new List<OHMSensor>();

            ISensor _coreClock = _hardware.Sensors.FirstOrDefault(s => s.SensorType == SensorType.Clock && s.Index == 0);

            if (_coreClock != null)
            {
                CoreClock = new OHMSensor(_coreClock, DataType.Clock, "Core", true);
                _sensorList.Add(CoreClock);
            }

            ISensor _memoryClock = _hardware.Sensors.FirstOrDefault(s => s.SensorType == SensorType.Clock && s.Index == 1);

            if (_memoryClock != null)
            {
                MemoryClock = new OHMSensor(_memoryClock, DataType.Clock, "VRAM", true);
                _sensorList.Add(MemoryClock);
            }

            ISensor _coreLoad = _hardware.Sensors.FirstOrDefault(s => s.SensorType == SensorType.Load && s.Index == 0);

            if (_coreLoad != null)
            {
                CoreLoad = new OHMSensor(_coreLoad, DataType.Percent, "Core");
                _sensorList.Add(CoreLoad);
            }

            ISensor _memoryLoad = _hardware.Sensors.FirstOrDefault(s => s.SensorType == SensorType.Load && s.Index == 3);

            if (_memoryLoad != null)
            {
                MemoryLoad = new OHMSensor(_memoryLoad, DataType.Percent, "VRAM");
                _sensorList.Add(MemoryLoad);
            }

            ISensor _voltage = _hardware.Sensors.FirstOrDefault(s => s.SensorType == SensorType.Voltage && s.Index == 0);

            if (_voltage != null)
            {
                Voltage = new OHMSensor(_voltage, DataType.Voltage, "Voltage");
                _sensorList.Add(Voltage);
            }

            ISensor _tempSensor = _hardware.Sensors.FirstOrDefault(s => s.SensorType == SensorType.Temperature && s.Index == 0);

            if (_tempSensor != null)
            {
                Temperature = new OHMSensor(_tempSensor, DataType.Celcius, "Temp", false);
                _sensorList.Add(Temperature);
            }

            ISensor _fanSensor = _hardware.Sensors.FirstOrDefault(s => s.SensorType == SensorType.Control && s.Index == 0);

            if (_fanSensor != null)
            {
                FanPercent = new OHMSensor(_fanSensor, DataType.Percent, "Fan");
                _sensorList.Add(FanPercent);
            }

            ISensor _fanRpmSensor = _hardware.Sensors.FirstOrDefault(s => s.SensorType == SensorType.Fan && s.Index == 0);

            if (_fanRpmSensor != null)
            {
                FanRPM = new OHMSensor(_fanRpmSensor, DataType.RPM, "Fan");
                _sensorList.Add(FanRPM);
            }

            Sensors = _sensorList.ToArray();
        }
예제 #9
0
        void InitTemperature(List<OHMSensor> sensors)
        {
            ISensor tempSensor = _hardware.Sensors.FirstOrDefault(s => s.SensorType == SensorType.Temperature);

            if (tempSensor != null)
            {
                Temperature = new OHMSensor(tempSensor, DataType.Celcius, "Temp");
                sensors.Add(Temperature);
            }
        }
예제 #10
0
        void InitRemainingLife(List<OHMSensor> sensors)
        {
            ISensor sensor = _hardware.Sensors.FirstOrDefault(s => s.SensorType == SensorType.Level && s.Name == "Remaining Life");

            if (sensor != null)
            {
                RemainingLife = new OHMSensor(sensor, DataType.Percent, "Remaining life");
                sensors.Add(RemainingLife);
            }
        }