예제 #1
0
        public void createFan(ref List <HardwareDevice> deviceList)
        {
            Monitor.Enter(mLock);
            for (int i = 0; i < mHWInfoCategoryList.Count; i++)
            {
                var category       = mHWInfoCategoryList[i];
                var hardwareDevice = new HardwareDevice(category.Name);

                int deviceCount = category.getDeviceCount();
                for (int j = 0; j < deviceCount; j++)
                {
                    var device = category.getDevice(j);
                    if (device == null)
                    {
                        continue;
                    }

                    if (device.Unit.Equals("RPM") == true)
                    {
                        var fan = new HWInfoFanSpeed(device.ID, device.Name, category.ID, device.ID);
                        hardwareDevice.addDevice(fan);
                    }
                }

                if (hardwareDevice.DeviceList.Count > 0)
                {
                    deviceList.Add(hardwareDevice);
                }
            }
            Monitor.Exit(mLock);
        }
예제 #2
0
        public void createTemp(ref List <HardwareDevice> deviceList)
        {
            var device = new HardwareDevice("Gigabyte");

            if (OptionManager.getInstance().IsGigabyteMotherboard == true)
            {
                this.lockBus();
                try
                {
                    var pHwMonitoredDataList = new HardwareMonitoredDataCollection();
                    mGigabyteHardwareMonitorControlModule.GetCurrentMonitoredData(SensorTypes.Temperature, ref pHwMonitoredDataList);
                    for (int i = 0; i < pHwMonitoredDataList.Count; i++)
                    {
                        string name = pHwMonitoredDataList[i].Title;
                        string id   = string.Format("{0}/{1}/{2}", mIDPrefixTemperature, name, pHwMonitoredDataList[i].DeviceUUID);

                        mGigabyteTemperatureList.Add(pHwMonitoredDataList[i].Value);

                        var sensor = new GigabyteTemp(id, name, i);
                        sensor.onGetGigabyteTemperatureHandler += onGetGigabyteTemperature;
                        device.addDevice(sensor);
                    }
                }
                catch { }
                this.unlockBus();
            }

            if (OptionManager.getInstance().IsGigabyteGpu == true)
            {
                for (int i = 0; i < mGigabyteAmdRadeonGraphicsModuleList.Count; i++)
                {
                    string name   = mGigabyteAmdRadeonGraphicsModuleList[i].ProductName;
                    string id     = string.Format("{0}/{1}/{2}", mIDPrefixTemperature, name, i);
                    var    sensor = new GigabyteAmdGpuTemp(id, name, i);
                    sensor.onGetGigabyteAmdTemperatureHandler += onGetGigabyteAmdTemperature;
                    device.addDevice(sensor);
                }

                for (int i = 0; i < mGigabyteNvidiaGeforceGraphicsModuleList.Count; i++)
                {
                    string name   = mGigabyteNvidiaGeforceGraphicsModuleList[i].ProductName;
                    string id     = string.Format("{0}/{1}/{2}", mIDPrefixTemperature, name, i);
                    var    sensor = new GigabyteNvidiaGpuTemp(id, name, i);
                    sensor.onGetGigabyteNvidiaTemperatureHandler += onGetGigabyteNvidiaTemperature;
                    device.addDevice(sensor);
                }
            }

            if (device.DeviceList.Count > 0)
            {
                deviceList.Add(device);
            }
        }
예제 #3
0
        public void createTemp(ref List <HardwareDevice> deviceList)
        {
            var hardwareArray = mComputer.Hardware;

            for (int i = 0; i < hardwareArray.Length; i++)
            {
                string hardwareName = (hardwareArray[i].Name.Length > 0) ? hardwareArray[i].Name : "Unknown";
                var    device       = new HardwareDevice(hardwareName);

                var sensorArray = hardwareArray[i].Sensors;
                for (int j = 0; j < sensorArray.Length; j++)
                {
                    if (sensorArray[j].SensorType != SensorType.Temperature)
                    {
                        continue;
                    }

                    string id     = string.Format("{0}{1}", mIDPrefixTemperature, sensorArray[j].Identifier.ToString());
                    string name   = (sensorArray[j].Name.Length > 0) ? sensorArray[j].Name : "Temperature";
                    var    sensor = new OHMTemp(id, sensorArray[j], name);
                    device.addDevice(sensor);
                }

                var subHardwareArray = hardwareArray[i].SubHardware;
                for (int j = 0; j < subHardwareArray.Length; j++)
                {
                    var subSensorList = subHardwareArray[j].Sensors;
                    for (int k = 0; k < subSensorList.Length; k++)
                    {
                        if (subSensorList[k].SensorType != SensorType.Temperature)
                        {
                            continue;
                        }

                        string id     = string.Format("{0}{1}", mIDPrefixTemperature, subSensorList[k].Identifier.ToString());
                        string name   = (subSensorList[k].Name.Length > 0) ? subSensorList[k].Name : "Temperature";
                        var    sensor = new OHMTemp(id, subSensorList[k], name);
                        device.addDevice(sensor);
                    }
                }

                if (device.DeviceList.Count > 0)
                {
                    deviceList.Add(device);
                }
            }
        }
예제 #4
0
        public void createControl(ref List <HardwareDevice> deviceList)
        {
            var device = new HardwareDevice("Gigabyte");

            if (OptionManager.getInstance().IsGigabyteMotherboard == true)
            {
                int num = 1;
                this.lockBus();
                try
                {
                    for (int i = 0; i < mGigabyteSmartGuardianFanControlModule.FanControlCount; i++)
                    {
                        string name;
                        mGigabyteSmartGuardianFanControlModule.GetFanControlTitle(i, out name);
                        if (name.Length == 0)
                        {
                            name = "Fan Control #" + num++;
                        }

                        var config = new SmartFanControlConfig();
                        mGigabyteSmartGuardianFanControlModule.Get(i, ref config);

                        double pwm   = (double)config.FanConfig.StartPWM;
                        int    value = (int)Math.Round(pwm / 255.0f * 100.0f);

                        string id      = string.Format("{0}/{1}/{2}", mIDPrefixControl, name, i);
                        var    control = new GigabyteFanControl(id, name, i, value);
                        control.onSetGigabyteControlHandler += onSetGigabyteControl;
                        device.addDevice(control);
                    }
                }
                catch { }
                this.unlockBus();
            }

            if (OptionManager.getInstance().IsGigabyteGpu == true)
            {
                int num = 1;
                for (int i = 0; i < mGigabyteAmdRadeonGraphicsModuleList.Count; i++)
                {
                    var info = new GraphicsFanSpeedInfo();
                    mGigabyteAmdRadeonGraphicsModuleList[i].GetFanSpeedInfo(ref info);

                    string name = mGigabyteAmdRadeonGraphicsModuleList[i].DisplayName;
                    if (name.Length == 0)
                    {
                        name = "GPU Fan Control #" + num++;
                    }

                    string id      = string.Format("{0}/{1}/{2}", mIDPrefixControl, name, i);
                    var    control = new GigabyteAmdGpuFanControl(id, name, i, info.MinPercent, info.MaxPercent);
                    control.onSetGigabyteAmdControlHandler += onSetGigabyteAmdControl;
                    device.addDevice(control);
                }

                for (int i = 0; i < mGigabyteNvidiaGeforceGraphicsModuleList.Count; i++)
                {
                    var info = new GraphicsCoolerSetting();
                    mGigabyteNvidiaGeforceGraphicsModuleList[i].GetFanSpeedInfo(ref info);
                    info.Support = true;
                    info.Manual  = true;

                    int minPercent = (int)Math.Ceiling(info.Config.Minimum);
                    int maxPercent = (int)Math.Ceiling(info.Config.Maximum);

                    string name = mGigabyteNvidiaGeforceGraphicsModuleList[i].DisplayName;
                    if (name.Length == 0)
                    {
                        name = "GPU Fan Control #" + num++;
                    }

                    string id      = string.Format("{0}/{1}/{2}", mIDPrefixControl, name, i);
                    var    control = new GigabyteNvidiaGpuFanControl(id, name, i, minPercent, maxPercent);
                    control.onSetGigabyteNvidiaControlHandler += onSetGigabyteNvidiaControl;
                    device.addDevice(control);
                }
            }

            if (device.DeviceList.Count > 0)
            {
                deviceList.Add(device);
            }
        }
예제 #5
0
        public void createFan(ref List <HardwareDevice> deviceList)
        {
            var device = new HardwareDevice("Gigabyte");

            if (OptionManager.getInstance().IsGigabyteMotherboard == true)
            {
                int num = 1;
                this.lockBus();
                try
                {
                    for (int i = 0; i < mGigabyteSmartGuardianFanControlModule.FanControlCount; i++)
                    {
                        string name;
                        mGigabyteSmartGuardianFanControlModule.GetFanControlTitle(i, out name);
                        if (name.Length == 0)
                        {
                            name = "Fan #" + num++;
                        }

                        string id  = string.Format("{0}/{1}/{2}", mIDPrefixFan, name, i);
                        var    fan = new GigabyteFanSpeed(id, name, i);
                        fan.onGetGigabyteFanSpeedHandler += onGetGigabyteFanSpeed;
                        device.addDevice(fan);
                    }
                }
                catch { }
                this.unlockBus();
            }

            if (OptionManager.getInstance().IsGigabyteGpu == true)
            {
                int num = 1;
                for (int i = 0; i < mGigabyteAmdRadeonGraphicsModuleList.Count; i++)
                {
                    string name = mGigabyteAmdRadeonGraphicsModuleList[i].DisplayName;
                    if (name.Length == 0)
                    {
                        name = "GPU Fan #" + num++;
                    }

                    string id  = string.Format("{0}/{1}/{2}", mIDPrefixFan, name, i);
                    var    fan = new GigabyteAmdGpuFanSpeed(name, i);
                    fan.onGetGigabyteAmdFanSpeedHandler += onGetGigabyteAmdFanSpeed;
                    device.addDevice(fan);
                }

                for (int i = 0; i < mGigabyteNvidiaGeforceGraphicsModuleList.Count; i++)
                {
                    string name = mGigabyteNvidiaGeforceGraphicsModuleList[i].DisplayName;
                    if (name.Length == 0)
                    {
                        name = "GPU Fan #" + num++;
                    }

                    string id  = string.Format("{0}/{1}/{2}", mIDPrefixFan, name, i);
                    var    fan = new GigabyteNvidiaFanSpeed(id, name, i);
                    fan.onGetGigabyteNvidiaFanSpeedHandler += onGetGigabyteNvidiaFanSpeed;
                    device.addDevice(fan);
                }
            }

            if (device.DeviceList.Count > 0)
            {
                deviceList.Add(device);
            }
        }