示例#1
0
        public void createControl(ref List <BaseControl> controlList)
        {
            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.isExistControl(ref controlList, name) == true)
                {
                    name = originName + " #" + 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);

                var control = new GigabyteFanControl(name, i, value);
                control.onSetGigabyteControlHandler += onSetGigabyteControl;
                controlList.Add(control);
            }

            int gpuNum = 1;

            for (int i = 0; i < mGigabyteAmdRadeonGraphicsModuleList.Count; i++)
            {
                this.lockBus();
                var info = new GraphicsFanSpeedInfo();
                mGigabyteAmdRadeonGraphicsModuleList[i].GetFanSpeedInfo(ref info);
                this.unlockBus();

                var name = "GPU Fan #" + gpuNum++;
                while (this.isExistControl(ref controlList, name) == true)
                {
                    name = "GPU Fan #" + gpuNum++;
                }

                var control = new GigabyteAmdGpuFanControl(name, i, info.MinPercent, info.MaxPercent);
                control.onSetGigabyteAmdControlHandler += onSetGigabyteAmdControl;
                controlList.Add(control);

                this.addChangeValue(control.getMinSpeed(), control);
            }

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

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

                    var name = "GPU Fan #" + gpuNum++;
                    while (this.isExistControl(ref controlList, name) == true)
                    {
                        name = "GPU Fan #" + gpuNum++;
                    }

                    var control = new GigabyteNvidiaGpuFanControl(name, i, minPercent, maxPercent);
                    control.onSetGigabyteNvidiaControlHandler += onSetGigabyteNvidiaControl;
                    controlList.Add(control);

                    this.addChangeValue(control.getMinSpeed(), control);
                }
            }
        }
示例#2
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);
            }
        }