示例#1
0
        public void createFan(ref List <BaseSensor> fanList)
        {
            bool isNvAPIWrapper = OptionManager.getInstance().IsNvAPIWrapper;

            int num = 2;

            for (int i = 0; i < mGigabyteSmartGuardianFanControlModule.FanControlCount; i++)
            {
                string originName;
                mGigabyteSmartGuardianFanControlModule.GetFanControlTitle(i, out originName);
                if (originName.Equals("PCH") == true)
                {
                    continue;
                }

                var name = originName;
                while (this.isExistFan(ref fanList, name) == true)
                {
                    name = originName + " #" + num++;
                }

                var fan = new GigabyteFanSpeed(name, i);
                fan.onGetGigabyteFanSpeedHandler += onGetGigabyteFanSpeed;
                fanList.Add(fan);
            }

            int gpuNum = 1;

            for (int i = 0; i < mGigabyteAmdRadeonGraphicsModuleList.Count; i++)
            {
                var name = "GPU Fan #" + gpuNum++;
                while (this.isExistFan(ref fanList, name) == true)
                {
                    name = "GPU Fan #" + gpuNum++;
                }

                var fan = new GigabyteAmdGpuFanSpeed(name, i);
                fan.onGetGigabyteAmdFanSpeedHandler += onGetGigabyteAmdFanSpeed;
                fanList.Add(fan);
            }

            if (isNvAPIWrapper == false)
            {
                for (int i = 0; i < mGigabyteNvidiaGeforceGraphicsModuleList.Count; i++)
                {
                    var name = "GPU Fan #" + gpuNum++;
                    while (this.isExistFan(ref fanList, name) == true)
                    {
                        name = "GPU Fan #" + gpuNum++;
                    }

                    var fan = new GigabyteNvidiaFanSpeed(name, i);
                    fan.onGetGigabyteNvidiaFanSpeedHandler += onGetGigabyteNvidiaFanSpeed;
                    fanList.Add(fan);
                }
            }
        }
示例#2
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);
            }
        }