Example #1
0
        private void createGPUControl()
        {
            // Gigabyte
            if (mIsGigabyte == true)
            {
            }

            // LibreHardwareMonitor
            else if (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor)
            {
                mLHM.createGPUFanControl(ref mControlList);
            }

            // OpenHardwareMonitor
            else
            {
                mOHM.createGPUFanControl(ref mControlList);
            }

            if (OptionManager.getInstance().IsNvAPIWrapper == true)
            {
                this.lockBus();
                try
                {
                    int gpuFanNum = 1;
                    var gpuArray  = PhysicalGPU.GetPhysicalGPUs();
                    for (int i = 0; i < gpuArray.Length; i++)
                    {
                        var e = gpuArray[i].CoolerInformation.Coolers.GetEnumerator();
                        while (e.MoveNext())
                        {
                            var          value         = e.Current;
                            int          coolerID      = value.CoolerId;
                            int          speed         = value.CurrentLevel;
                            int          minSpeed      = value.DefaultMinimumLevel;
                            int          maxSpeed      = value.DefaultMaximumLevel;
                            CoolerPolicy defaultPolicy = value.DefaultPolicy;

                            var name = "GPU Fan Control #" + gpuFanNum++;
                            while (this.isExistControl(name) == true)
                            {
                                name = "GPU Fan Control #" + gpuFanNum++;
                            }

                            var control = new NvAPIFanControl(name, i, coolerID, speed, minSpeed, maxSpeed, defaultPolicy);
                            control.onSetNvAPIControlHandler += onSetNvApiControl;
                            mControlList.Add(control);
                        }
                    }
                }
                catch { }
                this.unlockBus();
            }
        }
Example #2
0
 public override string getString()
 {
     if (OptionManager.getInstance().IsFahrenheit == true)
     {
         return(Util.getFahrenheit(Value) + " °F");
     }
     else
     {
         return(Value + " °C");
     }
 }
Example #3
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);
            }
        }
Example #4
0
        private void onFanIconTimer(object sender, EventArgs e)
        {
            if (ControlManager.getInstance().IsEnable == false || OptionManager.getInstance().IsAnimation == false)
            {
                return;
            }

            if (mFanIconIndex >= mFanIconList.Count)
            {
                mFanIconIndex = 0;
            }
            mTrayIcon.Icon = mFanIconList[mFanIconIndex++];
        }
Example #5
0
        public void createGPUFan(ref List <BaseSensor> fanList)
        {
            bool isNvAPIWrapper = OptionManager.getInstance().IsNvAPIWrapper;

            int gpuFanNum     = 1;
            var hardwareArray = mComputer.Hardware;

            for (int i = 0; i < hardwareArray.Length; i++)
            {
                if ((hardwareArray[i].HardwareType == HardwareType.GpuNvidia && isNvAPIWrapper == false) ||
                    (hardwareArray[i].HardwareType == HardwareType.GpuAti))
                {
                    var sensorArray = hardwareArray[i].Sensors;
                    for (int j = 0; j < sensorArray.Length; j++)
                    {
                        if (sensorArray[j].SensorType == OpenHardwareMonitor.Hardware.SensorType.Fan)
                        {
                            var name = "GPU Fan #" + gpuFanNum++;
                            while (this.isExistFan(ref fanList, name) == true)
                            {
                                name = "GPU Fan #" + gpuFanNum++;
                            }

                            var fan = new HardwareFanSpeed(sensorArray[j], name);
                            fanList.Add(fan);
                        }
                    }

                    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 == OpenHardwareMonitor.Hardware.SensorType.Fan)
                            {
                                var name = "GPU Fan #" + gpuFanNum++;
                                while (this.isExistFan(ref fanList, name) == true)
                                {
                                    name = "GPU Fan #" + gpuFanNum++;
                                }

                                var fan = new HardwareFanSpeed(subSensorList[k], name);
                                fanList.Add(fan);
                            }
                        }
                    }
                }
            }
        }
Example #6
0
        private void onResetButtonClick(object sender, EventArgs e)
        {
            var result = MessageBox.Show(StringLib.OptionReset, StringLib.Option, MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (result == DialogResult.Cancel)
            {
                return;
            }

            OptionManager.getInstance().reset();
            OptionManager.getInstance().write();
            this.DialogResult = DialogResult.No;
            this.Close();
        }
Example #7
0
        public void createGPUFanControl(ref List <BaseControl> controlList)
        {
            bool isNvAPIWrapper = OptionManager.getInstance().IsNvAPIWrapper;

            int gpuFanNum     = 1;
            var hardwareArray = mComputer.Hardware;

            for (int i = 0; i < hardwareArray.Length; i++)
            {
                if ((hardwareArray[i].HardwareType == HardwareType.GpuNvidia && isNvAPIWrapper == false) ||
                    (hardwareArray[i].HardwareType == HardwareType.GpuAmd))
                {
                    var sensorArray = hardwareArray[i].Sensors;
                    for (int j = 0; j < sensorArray.Length; j++)
                    {
                        if (sensorArray[j].SensorType == LibreHardwareMonitor.Hardware.SensorType.Control)
                        {
                            var name = "GPU Fan Control #" + gpuFanNum++;
                            while (this.isExistControl(ref controlList, name) == true)
                            {
                                name = "GPU Fan Control #" + gpuFanNum++;
                            }

                            var control = new HardwareControl(sensorArray[j], name);
                            controlList.Add(control);
                        }
                    }

                    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 == LibreHardwareMonitor.Hardware.SensorType.Control)
                            {
                                var name = "GPU Fan Control #" + gpuFanNum++;
                                while (this.isExistControl(ref controlList, name) == true)
                                {
                                    name = "GPU Fan Control #" + gpuFanNum++;
                                }

                                var control = new HardwareControl(subSensorList[k], name);
                                controlList.Add(control);
                            }
                        }
                    }
                }
            }
        }
Example #8
0
        private void onReloadButtonClick(object sender, EventArgs e)
        {
            HardwareManager.getInstance().stop();
            ControlManager.getInstance().reset();
            OSDManager.getInstance().reset();

            if (OptionManager.getInstance().IsHWInfo == false)
            {
                HWInfoManager.getInstance().reset();
                HWInfoManager.getInstance().write();
            }

            this.reload();
        }
Example #9
0
        public MainForm()
        {
            InitializeComponent();
            this.localizeComponent();

            this.MinimumSize = new Size(this.Width, mOriginHeight);
            this.MaximumSize = new Size(this.Width, Int32.MaxValue);

            this.FormClosing += onClosing;

            mFanIconList.Add(Properties.Resources.fan_1);
            mFanIconList.Add(Properties.Resources.fan_2);
            mFanIconList.Add(Properties.Resources.fan_3);
            mFanIconList.Add(Properties.Resources.fan_4);
            mFanIconList.Add(Properties.Resources.fan_5);
            mFanIconList.Add(Properties.Resources.fan_6);
            mFanIconList.Add(Properties.Resources.fan_7);
            mFanIconList.Add(Properties.Resources.fan_8);

            mTrayIcon.Icon                = mFanIconList[0];
            mTrayIcon.Visible             = true;
            mTrayIcon.MouseDoubleClick   += onTrayIconDBClicked;
            mDonatePictureBox.MouseClick += onDonatePictureBoxClick;

            HardwareManager.getInstance().onUpdateCallback += onUpdate;

            if (OptionManager.getInstance().read() == false)
            {
                OptionManager.getInstance().write();
            }

            if (OptionManager.getInstance().Interval < 100)
            {
                OptionManager.getInstance().Interval = 100;
            }
            else if (OptionManager.getInstance().Interval > 5000)
            {
                OptionManager.getInstance().Interval = 5000;
            }

            if (OptionManager.getInstance().IsMinimized == true)
            {
                this.Visible       = false;
                this.WindowState   = FormWindowState.Minimized;
                this.ShowInTaskbar = false;
                mIsVisible         = false;
                mIsFirstShow       = false;
            }
        }
Example #10
0
        public void startUpdate()
        {
            Monitor.Enter(mLock);
            if (mIsStart == false)
            {
                Monitor.Exit(mLock);
                return;
            }

            mUpdateTimer.Interval = OptionManager.getInstance().Interval;
            mUpdateTimer.Elapsed += onUpdateTimer;
            mUpdateTimer.Start();

            Monitor.Exit(mLock);
        }
Example #11
0
        private void createGPUFan()
        {
            // Gigabyte
            if (mIsGigabyte == true)
            {
            }

            // LibreHardwareMonitor
            else if (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor)
            {
                mLHM.createGPUFan(ref mFanList);
            }

            // OpenHardwareMonitor
            else
            {
                mOHM.createGPUFan(ref mFanList);
            }

            if (OptionManager.getInstance().IsNvAPIWrapper == true)
            {
                this.lockBus();
                try
                {
                    int gpuFanNum = 1;
                    var gpuArray  = PhysicalGPU.GetPhysicalGPUs();
                    for (int i = 0; i < gpuArray.Length; i++)
                    {
                        var e = gpuArray[i].CoolerInformation.Coolers.GetEnumerator();
                        while (e.MoveNext())
                        {
                            var value = e.Current;
                            var name  = "GPU Fan #" + gpuFanNum++;
                            while (this.isExistFan(name) == true)
                            {
                                name = "GPU Fan #" + gpuFanNum++;
                            }

                            var fan = new NvAPIFanSpeed(name, i, value.CoolerId);
                            fan.onGetNvAPIFanSpeedHandler += onGetNvAPIFanSpeed;
                            mFanList.Add(fan);
                        }
                    }
                }
                catch { }
                this.unlockBus();
            }
        }
Example #12
0
        public void createTemp(ref List <BaseSensor> sensorList)
        {
            bool isNvAPIWrapper = OptionManager.getInstance().IsNvAPIWrapper;

            // CPU, GPU
            int cpuNum        = 2;
            int gpuAmdNum     = 2;
            int gpuNvidiaNum  = 2;
            var hardwareArray = mComputer.Hardware;

            for (int i = 0; i < hardwareArray.Length; i++)
            {
                if (hardwareArray[i].HardwareType == HardwareType.Cpu)
                {
                    string name = hardwareArray[i].Name;
                    while (this.isExistTemp(ref sensorList, name) == true)
                    {
                        name = hardwareArray[i].Name + " #" + cpuNum++;
                    }
                    var sensor = new HardwareTemp(hardwareArray[i], name);
                    sensorList.Add(sensor);
                }

                if (hardwareArray[i].HardwareType == HardwareType.GpuAmd)
                {
                    string name = hardwareArray[i].Name;
                    while (this.isExistTemp(ref sensorList, name) == true)
                    {
                        name = hardwareArray[i].Name + " #" + gpuAmdNum++;
                    }
                    var sensor = new HardwareTemp(hardwareArray[i], name);
                    sensorList.Add(sensor);
                }

                else if (hardwareArray[i].HardwareType == HardwareType.GpuNvidia && isNvAPIWrapper == false)
                {
                    string name = hardwareArray[i].Name;
                    while (this.isExistTemp(ref sensorList, name) == true)
                    {
                        name = hardwareArray[i].Name + " #" + gpuNvidiaNum++;
                    }
                    var sensor = new HardwareTemp(hardwareArray[i], name);
                    sensorList.Add(sensor);
                }
            }
        }
Example #13
0
        public MainForm()
        {
            InitializeComponent();
            this.localizeComponent();

            this.FormClosing += onClosing;

            mFanIconList.Add(Properties.Resources.fan_1);
            mFanIconList.Add(Properties.Resources.fan_2);
            mFanIconList.Add(Properties.Resources.fan_3);
            mFanIconList.Add(Properties.Resources.fan_4);
            mFanIconList.Add(Properties.Resources.fan_5);
            mFanIconList.Add(Properties.Resources.fan_6);
            mFanIconList.Add(Properties.Resources.fan_7);
            mFanIconList.Add(Properties.Resources.fan_8);

            mTrayIcon.Icon              = mFanIconList[0];
            mTrayIcon.Visible           = true;
            mTrayIcon.MouseDoubleClick += onTrayIconDBClicked;
            mTrayIcon.ContextMenuStrip  = mTrayMenuStrip;

            mDonatePictureBox.MouseClick   += onDonatePictureBoxClick;
            mDonateQRPictureBox.MouseClick += onDonatePictureBoxClick;

            if (OptionManager.getInstance().read() == false)
            {
                OptionManager.getInstance().write();
            }

            if (OptionManager.getInstance().Interval < 100)
            {
                OptionManager.getInstance().Interval = 100;
            }
            else if (OptionManager.getInstance().Interval > 5000)
            {
                OptionManager.getInstance().Interval = 5000;
            }

            if (OptionManager.getInstance().IsMinimized == true)
            {
                this.Visible       = false;
                this.WindowState   = FormWindowState.Minimized;
                this.ShowInTaskbar = false;
            }
        }
Example #14
0
        private void createMotherBoardTemp()
        {
            if (mIsGigabyte == true)
            {
                return;
            }

            // LibreHardwareMonitor
            else if (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor)
            {
                mLHM.createMotherBoardTemp(ref mSensorList);
            }

            // OpenHardwareMonitor
            else
            {
                mOHM.createMotherBoardTemp(ref mSensorList);
            }
        }
Example #15
0
        public void start()
        {
            if (mIsStart == true)
            {
                return;
            }
            mIsStart = true;

            mComputer                      = new Computer();
            mComputer.CPUEnabled           = OptionManager.getInstance().IsOHMCpu;
            mComputer.MainboardEnabled     = OptionManager.getInstance().IsOHMMotherboard;
            mComputer.FanControllerEnabled = OptionManager.getInstance().IsOHMContolled;
            mComputer.GPUEnabled           = OptionManager.getInstance().IsOHMGpu;
            mComputer.HDDEnabled           = OptionManager.getInstance().IsOHMStorage;
            mComputer.RAMEnabled           = OptionManager.getInstance().IsOHMMemory;

            mComputer.Open();
            mComputer.Accept(this);
        }
Example #16
0
        public void start()
        {
            if (mIsStart == true)
            {
                return;
            }
            mIsStart = true;

            mComputer = new Computer();
            mComputer.IsCpuEnabled         = OptionManager.getInstance().IsLHMCpu;
            mComputer.IsMotherboardEnabled = OptionManager.getInstance().IsLHMMotherboard;
            mComputer.IsControllerEnabled  = OptionManager.getInstance().IsLHMContolled;
            mComputer.IsGpuEnabled         = OptionManager.getInstance().IsLHMGpu;
            mComputer.IsStorageEnabled     = OptionManager.getInstance().IsLHMStorage;
            mComputer.IsMemoryEnabled      = OptionManager.getInstance().IsLHMMemory;

            mComputer.Open();
            mComputer.Accept(this);
        }
Example #17
0
        private void onOptionButtonClick(object sender, EventArgs e)
        {
            var form = new OptionForm();

            form.OnExitHandler += onRestartProgram;
            if (form.ShowDialog() == DialogResult.OK)
            {
                HardwareManager.getInstance().restartTimer(OptionManager.getInstance().Interval);

                // start icon update
                if (OptionManager.getInstance().IsAnimation == true)
                {
                    mFanIconTimer.Start();
                }
                else
                {
                    mFanIconTimer.Stop();
                }
            }
        }
Example #18
0
        private void createControl()
        {
            // Gigabyte
            if (mIsGigabyte == true)
            {
                mGigabyte.createControl(ref mControlList);
            }

            // LibreHardwareMonitor
            else if (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor)
            {
                mLHM.createControl(ref mControlList);
            }

            // OpenHardwareMonitor
            else
            {
                mOHM.createControl(ref mControlList);
            }
        }
Example #19
0
        public OptionForm()
        {
            InitializeComponent();
            this.localizeComponent();

            mToolTip.SetToolTip(mIntervalTextBox, "100 ≤ value ≤ 5000");
            mToolTip.SetToolTip(mStartupDelayTextBox, "0 ≤ value ≤ 59");

            mIntervalTextBox.Text      = OptionManager.getInstance().Interval.ToString();
            mIntervalTextBox.KeyPress += onTextBoxKeyPress;
            mIntervalTextBox.Leave    += onTextBoxLeaves;

            mGigabyteCheckBox.Checked = OptionManager.getInstance().IsGigabyte;

            mLibraryRadioButton1.Click  += onRadioClick;
            mLibraryRadioButton2.Click  += onRadioClick;
            mLibraryRadioButton1.Checked = (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor);
            mLibraryRadioButton2.Checked = (OptionManager.getInstance().LibraryType == LibraryType.OpenHardwareMonitor);

            mDimmCheckBox.Checked = OptionManager.getInstance().IsDimm;

            mNvApiCheckBox.Checked = OptionManager.getInstance().IsNvAPIWrapper;

            mKrakenCheckBox.Checked = OptionManager.getInstance().IsKraken;
            mKrakenButton.Enabled   = (HardwareManager.getInstance().getKrakenList().Count > 0);

            mCLCCheckBox.Checked = OptionManager.getInstance().IsCLC;
            mCLCButton.Enabled   = (HardwareManager.getInstance().getCLCList().Count > 0);

            mRGBnFCCheckBox.Checked = OptionManager.getInstance().IsRGBnFC;
            mRGBnFCButton.Enabled   = (HardwareManager.getInstance().getRGBnFCList().Count > 0);

            mFahrenheitCheckBox.Checked = OptionManager.getInstance().IsFahrenheit;
            mAnimationCheckBox.Checked  = OptionManager.getInstance().IsAnimation;
            mMinimizeCheckBox.Checked   = OptionManager.getInstance().IsMinimized;

            mStartupDelayTextBox.Text = OptionManager.getInstance().DelayTime.ToString();
            mStartupCheckBox.Checked  = OptionManager.getInstance().IsStartUp;
        }
Example #20
0
        public string getUnitString()
        {
            switch (UnitType)
            {
            case OSDUnitType.Temperature:
                return((OptionManager.getInstance().IsFahrenheit == false) ? " 캜" : " 캟");

            case OSDUnitType.RPM:
                return(" RPM");

            case OSDUnitType.Percent:
                return(" %");

            case OSDUnitType.MHz:
            case OSDUnitType.kHz:
                return(" MHz");

            case OSDUnitType.KB:
            case OSDUnitType.GB:
            case OSDUnitType.MB:
                return(" MB");

            case OSDUnitType.MBPerSec:
                return(" MB/s");

            case OSDUnitType.Voltage:
                return(" V");

            case OSDUnitType.Power:
                return(" W");

            case OSDUnitType.FPS:
                return(" FPS");

            default:
                return(" ");
            }
        }
Example #21
0
        public void createOSDSensor(ref List <OSDSensor> osdList)
        {
            try
            {
                bool isNvAPIWrapper = OptionManager.getInstance().IsNvAPIWrapper;
                var  hardwareArray  = mComputer.Hardware;
                for (int i = 0; i < hardwareArray.Length; i++)
                {
                    if (isNvAPIWrapper == true && hardwareArray[i].HardwareType == HardwareType.GpuNvidia)
                    {
                        continue;
                    }

                    var sensorArray = hardwareArray[i].Sensors;
                    this.setOSDSensor(sensorArray, SensorType.Load, ref osdList);
                    this.setOSDSensor(sensorArray, SensorType.Clock, ref osdList);
                    this.setOSDSensor(sensorArray, SensorType.Voltage, ref osdList);
                    this.setOSDSensor(sensorArray, SensorType.Data, ref osdList);
                    this.setOSDSensor(sensorArray, SensorType.SmallData, ref osdList);
                    this.setOSDSensor(sensorArray, SensorType.Power, ref osdList);
                    this.setOSDSensor(sensorArray, SensorType.Throughput, ref osdList);

                    var subHardwareArray = hardwareArray[i].SubHardware;
                    for (int j = 0; j < subHardwareArray.Length; j++)
                    {
                        var subSensorArray = subHardwareArray[j].Sensors;
                        this.setOSDSensor(subSensorArray, SensorType.Load, ref osdList);
                        this.setOSDSensor(subSensorArray, SensorType.Clock, ref osdList);
                        this.setOSDSensor(subSensorArray, SensorType.Voltage, ref osdList);
                        this.setOSDSensor(subSensorArray, SensorType.Data, ref osdList);
                        this.setOSDSensor(subSensorArray, SensorType.SmallData, ref osdList);
                        this.setOSDSensor(subSensorArray, SensorType.Power, ref osdList);
                        this.setOSDSensor(subSensorArray, SensorType.Throughput, ref osdList);
                    }
                }
            }
            catch { }
        }
Example #22
0
        private void onMainLoad()
        {
            this.createComponent();
            this.ActiveControl = mFanControlButton;

            mEnableToolStripMenuItem.Checked      = ControlManager.getInstance().IsEnable;
            mEnableOSDToolStripMenuItem.Checked   = OSDManager.getInstance().IsEnable;
            mNormalToolStripMenuItem.Checked      = (ControlManager.getInstance().ModeType == MODE_TYPE.NORMAL);
            mSilenceToolStripMenuItem.Checked     = (ControlManager.getInstance().ModeType == MODE_TYPE.SILENCE);
            mPerformanceToolStripMenuItem.Checked = (ControlManager.getInstance().ModeType == MODE_TYPE.PERFORMANCE);
            mGameToolStripMenuItem.Checked        = (ControlManager.getInstance().ModeType == MODE_TYPE.GAME);

            // startUpdate
            HardwareManager.getInstance().startUpdate();

            // start icon update
            mTrayIcon.ContextMenuStrip = mTrayMenuStrip;
            mFanIconTimer          = new System.Windows.Forms.Timer();
            mFanIconTimer.Interval = 100;
            mFanIconTimer.Tick    += onFanIconTimer;
            if (OptionManager.getInstance().IsAnimation == true)
            {
                mFanIconTimer.Start();
            }

            mLoadingPanel.Visible = false;

            if (mIsVisible == true)
            {
                mIsFirstShow  = true;
                this.Location = new Point((Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2,
                                          (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2);
            }

            this.Enabled = true;
        }
Example #23
0
        private void createOSDSensor()
        {
            if (mIsGigabyte == true)
            {
            }

            // LibreHardwareMonitor
            else if (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor)
            {
                mLHM.createOSDSensor(ref mOSDSensorList);
            }

            // OpenHardwareMonitor
            else if (OptionManager.getInstance().LibraryType == LibraryType.OpenHardwareMonitor)
            {
                mOHM.createOSDSensor(ref mOSDSensorList);
            }

            if (OptionManager.getInstance().IsNvAPIWrapper == true)
            {
                this.lockBus();
                try
                {
                    var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                    for (int i = 0; i < gpuArray.Length; i++)
                    {
                        int subIndex = 0;

                        var osdSensor = new OSDSensor(OSDUnitType.kHz, "[Clock] GPU Graphics", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.kHz, "[Clock] GPU Memory", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.kHz, "[Clock] GPU Processor", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.kHz, "[Clock] GPU Video Decoding", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Core", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Frame Buffer", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Video Engine", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Bus Interface", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Memory", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.KB, "[Data] GPU Memory Free", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.KB, "[Data] GPU Memory Used", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.KB, "[Data] GPU Memory Total", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);
                    }
                }
                catch { }
                this.unlockBus();
            }
        }
Example #24
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);
            }
        }
Example #25
0
        private void initGraph()
        {
            mGraph.GraphPane.Title.IsVisible       = false;
            mGraph.GraphPane.XAxis.Title.IsVisible = false;
            mGraph.GraphPane.YAxis.Title.IsVisible = false;
            mGraph.IsEnableZoom    = false;
            mGraph.MouseDownEvent += onGraphMouseDown;
            mGraph.MouseMoveEvent += onGraphMouseMove;
            mGraph.MouseUpEvent   += onGraphMouseUp;

            // X axis
            mGraph.GraphPane.XAxis.Scale.MinorStep     = 5;
            mGraph.GraphPane.XAxis.Scale.MajorStep     = 10;
            mGraph.GraphPane.XAxis.Scale.Min           = 0;
            mGraph.GraphPane.XAxis.Scale.Max           = 100;
            mGraph.GraphPane.XAxis.MinorGrid.IsVisible = false;
            mGraph.GraphPane.XAxis.MajorGrid.IsVisible = true;
            mGraph.GraphPane.XAxis.Type = AxisType.Linear;

            mGraph.GraphPane.XAxis.ScaleFormatEvent += (pane, axis, val, index) =>
            {
                var min       = OptionManager.getInstance().IsFahrenheit == false ? 0 : 32;
                var majorStep = OptionManager.getInstance().IsFahrenheit == false ? 10 : 18;
                var temp      = min + majorStep * index;
                return(temp + (OptionManager.getInstance().IsFahrenheit == false ? "°C" : "°F"));
            };

            // Y axis
            mGraph.GraphPane.YAxis.Scale.MinorStep     = 5;
            mGraph.GraphPane.YAxis.Scale.MajorStep     = 10;
            mGraph.GraphPane.YAxis.Scale.Min           = 0;
            mGraph.GraphPane.YAxis.Scale.Max           = 100;
            mGraph.GraphPane.YAxis.Scale.Format        = "0%";
            mGraph.GraphPane.YAxis.MajorGrid.IsVisible = true;
            mGraph.GraphPane.YAxis.Type = AxisType.Linear;

            mGraph.GraphPane.CurveList.Clear();

            mNowPoint = new PointPairList();
            mNowPoint.Add(0, 0);
            mNowPointLineItem             = mGraph.GraphPane.AddCurve("Now", mNowPoint, Color.Red, SymbolType.Circle);
            mNowPointLineItem.Line.Width  = 1.0f;
            mNowPointLineItem.Symbol.Size = 10.0f;
            mNowPointLineItem.Symbol.Fill = new Fill(Color.Red);

            // line
            mPointList = new PointPairList();
            for (int i = 0; i < FanData.MAX_FAN_VALUE_SIZE_5; i++)
            {
                mPointList.Add(5 * i, 50);
            }
            mLineItem             = mGraph.GraphPane.AddCurve("Graph", mPointList, Color.Blue, SymbolType.Circle);
            mLineItem.Line.Width  = 2.0f;
            mLineItem.Symbol.Size = 10.0f;
            mLineItem.Symbol.Fill = new Fill(Color.White);

            mPresetLabel.Visible      = false;
            mPresetLoadButton.Visible = false;
            mPresetSaveButton.Visible = false;
            mUnitLabel.Visible        = false;
            mUnitComboBox.Visible     = false;
            mGraph.Visible            = false;
            mStepCheckBox.Visible     = false;
            mHysLabel.Visible         = false;
            mHysNumericUpDown.Visible = false;
        }
Example #26
0
        public OptionForm()
        {
            InitializeComponent();
            this.localizeComponent();

            if (Screen.PrimaryScreen.WorkingArea.Height < this.Height)
            {
                this.AutoScroll      = true;
                this.AutoSizeMode    = AutoSizeMode.GrowOnly;
                this.FormBorderStyle = FormBorderStyle.Sizable;
                this.Width           = this.Width + 10;
                this.Height          = this.Height - 100;

                this.MinimumSize = new Size(this.Width, 300);
                this.MaximumSize = new Size(this.Width, Int32.MaxValue);
            }

            mToolTip.SetToolTip(mIntervalTextBox, "100 ≤ value ≤ 5000");
            mToolTip.SetToolTip(mStartupDelayTextBox, "0 ≤ value ≤ 59");

            mIntervalTextBox.Text      = OptionManager.getInstance().Interval.ToString();
            mIntervalTextBox.KeyPress += onTextBoxKeyPress;
            mIntervalTextBox.Leave    += onTextBoxLeaves;

            mGigabyteCheckBox.CheckedChanged += (object sender, EventArgs e) =>
            {
                mGigabyteCPUCheckBox.Enabled = mGigabyteCheckBox.Checked;
                mGigabyteGPUCheckBox.Enabled = mGigabyteCheckBox.Checked;
            };
            mGigabyteCheckBox.Checked    = OptionManager.getInstance().IsGigabyte;
            mGigabyteCPUCheckBox.Checked = OptionManager.getInstance().IsGigabyteMotherboard;
            mGigabyteGPUCheckBox.Checked = OptionManager.getInstance().IsGigabyteGpu;
            if (mGigabyteCheckBox.Checked == false)
            {
                mGigabyteCPUCheckBox.Enabled = false;
                mGigabyteGPUCheckBox.Enabled = false;
            }

            mLHMCheckBox.CheckedChanged += (object sender, EventArgs e) =>
            {
                mLHMCPUCheckBox.Enabled        = mLHMCheckBox.Checked;
                mLHMMBCheckBox.Enabled         = mLHMCheckBox.Checked;
                mLHMGPUCheckBox.Enabled        = mLHMCheckBox.Checked;
                mLHMControllerCheckBox.Enabled = mLHMCheckBox.Checked;
                mLHMStorageCheckBox.Enabled    = mLHMCheckBox.Checked;
            };
            mLHMCheckBox.Checked           = OptionManager.getInstance().IsLHM;
            mLHMCPUCheckBox.Checked        = OptionManager.getInstance().IsLHMCpu;
            mLHMMBCheckBox.Checked         = OptionManager.getInstance().IsLHMMotherboard;
            mLHMGPUCheckBox.Checked        = OptionManager.getInstance().IsLHMGpu;
            mLHMControllerCheckBox.Checked = OptionManager.getInstance().IsLHMContolled;
            mLHMStorageCheckBox.Checked    = OptionManager.getInstance().IsLHMStorage;
            if (mLHMCheckBox.Checked == false)
            {
                mLHMCPUCheckBox.Enabled        = false;
                mLHMMBCheckBox.Enabled         = false;
                mLHMGPUCheckBox.Enabled        = false;
                mLHMControllerCheckBox.Enabled = false;
                mLHMStorageCheckBox.Enabled    = false;
            }

            mOHMCheckBox.CheckedChanged += (object sender, EventArgs e) =>
            {
                mOHMCPUCheckBox.Enabled        = mOHMCheckBox.Checked;
                mOHMMBCheckBox.Enabled         = mOHMCheckBox.Checked;
                mOHMGPUCheckBox.Enabled        = mOHMCheckBox.Checked;
                mOHMControllerCheckBox.Enabled = mOHMCheckBox.Checked;
                mOHMStorageCheckBox.Enabled    = mOHMCheckBox.Checked;
            };
            mOHMCheckBox.Checked           = OptionManager.getInstance().IsOHM;
            mOHMCPUCheckBox.Checked        = OptionManager.getInstance().IsOHMCpu;
            mOHMMBCheckBox.Checked         = OptionManager.getInstance().IsOHMMotherboard;
            mOHMGPUCheckBox.Checked        = OptionManager.getInstance().IsOHMGpu;
            mOHMControllerCheckBox.Checked = OptionManager.getInstance().IsOHMContolled;
            mOHMStorageCheckBox.Checked    = OptionManager.getInstance().IsOHMStorage;
            if (mOHMCheckBox.Checked == false)
            {
                mOHMCPUCheckBox.Enabled        = false;
                mOHMMBCheckBox.Enabled         = false;
                mOHMGPUCheckBox.Enabled        = false;
                mOHMControllerCheckBox.Enabled = false;
                mOHMStorageCheckBox.Enabled    = false;
            }

            mNvApiCheckBox.Checked = OptionManager.getInstance().IsNvAPIWrapper;

            mDimmCheckBox.Checked = OptionManager.getInstance().IsDimm;

            mKrakenCheckBox.Checked = OptionManager.getInstance().IsKraken;
            mKrakenButton.Enabled   = (HardwareManager.getInstance().KrakenList.Count > 0);

            mCLCCheckBox.Checked = OptionManager.getInstance().IsCLC;
            mCLCButton.Enabled   = (HardwareManager.getInstance().CLCList.Count > 0);

            mRGBnFCCheckBox.Checked = OptionManager.getInstance().IsRGBnFC;
            mRGBnFCButton.Enabled   = (HardwareManager.getInstance().RGBnFCList.Count > 0);

            mFahrenheitCheckBox.Checked = OptionManager.getInstance().IsFahrenheit;
            mAnimationCheckBox.Checked  = OptionManager.getInstance().IsAnimation;
            mMinimizeCheckBox.Checked   = OptionManager.getInstance().IsMinimized;

            mStartupDelayTextBox.Text = OptionManager.getInstance().DelayTime.ToString();
            mStartupCheckBox.Checked  = OptionManager.getInstance().IsStartUp;
        }
Example #27
0
        private void onOKButtonClick(object sender, EventArgs e)
        {
            int interval = int.Parse(mIntervalTextBox.Text);

            if (interval < 100)
            {
                interval = 100;
            }
            else if (interval > 5000)
            {
                interval = 5000;
            }

            int delayTime = int.Parse(mStartupDelayTextBox.Text);

            if (delayTime < 0)
            {
                delayTime = 0;
            }
            else if (delayTime > 59)
            {
                delayTime = 59;
            }

            var  optionManager = OptionManager.getInstance();
            bool isRestart     = false;

            if ((optionManager.IsGigabyte != mGigabyteCheckBox.Checked) ||
                (mGigabyteCheckBox.Checked == true && optionManager.IsGigabyteMotherboard != mGigabyteCPUCheckBox.Checked) ||
                (mGigabyteCheckBox.Checked == true && optionManager.IsGigabyteGpu != mGigabyteGPUCheckBox.Checked) ||

                (optionManager.IsLHM != mLHMCheckBox.Checked) ||
                (mLHMCheckBox.Checked == true && optionManager.IsLHMCpu != mLHMCPUCheckBox.Checked) ||
                (mLHMCheckBox.Checked == true && optionManager.IsLHMMotherboard != mLHMMBCheckBox.Checked) ||
                (mLHMCheckBox.Checked == true && optionManager.IsLHMGpu != mLHMGPUCheckBox.Checked) ||
                (mLHMCheckBox.Checked == true && optionManager.IsLHMContolled != mLHMControllerCheckBox.Checked) ||
                (mLHMCheckBox.Checked == true && optionManager.IsLHMStorage != mLHMStorageCheckBox.Checked) ||

                (optionManager.IsOHM != mOHMCheckBox.Checked) ||
                (mOHMCheckBox.Checked == true && optionManager.IsOHMCpu != mOHMCPUCheckBox.Checked) ||
                (mOHMCheckBox.Checked == true && optionManager.IsOHMMotherboard != mOHMMBCheckBox.Checked) ||
                (mOHMCheckBox.Checked == true && optionManager.IsOHMGpu != mOHMGPUCheckBox.Checked) ||
                (mOHMCheckBox.Checked == true && optionManager.IsOHMContolled != mOHMControllerCheckBox.Checked) ||
                (mOHMCheckBox.Checked == true && optionManager.IsOHMStorage != mOHMStorageCheckBox.Checked) ||

                (optionManager.IsNvAPIWrapper != mNvApiCheckBox.Checked) ||
                (optionManager.IsDimm != mDimmCheckBox.Checked) ||
                (optionManager.IsKraken != mKrakenCheckBox.Checked) ||
                (optionManager.IsCLC != mCLCCheckBox.Checked) ||
                (optionManager.IsRGBnFC != mRGBnFCCheckBox.Checked))
            {
                var result = MessageBox.Show(StringLib.OptionChange, StringLib.Option, MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (result == DialogResult.Cancel)
                {
                    return;
                }

                isRestart = true;
            }

            optionManager.Interval = interval;

            optionManager.IsGigabyte            = mGigabyteCheckBox.Checked;
            optionManager.IsGigabyteMotherboard = mGigabyteCPUCheckBox.Checked;
            optionManager.IsGigabyteGpu         = mGigabyteGPUCheckBox.Checked;

            optionManager.IsLHM            = mLHMCheckBox.Checked;
            optionManager.IsLHMCpu         = mLHMCPUCheckBox.Checked;
            optionManager.IsLHMMotherboard = mLHMMBCheckBox.Checked;
            optionManager.IsLHMGpu         = mLHMGPUCheckBox.Checked;
            optionManager.IsLHMContolled   = mLHMControllerCheckBox.Checked;
            optionManager.IsLHMStorage     = mLHMStorageCheckBox.Checked;

            optionManager.IsOHM            = mOHMCheckBox.Checked;
            optionManager.IsOHMCpu         = mOHMCPUCheckBox.Checked;
            optionManager.IsOHMMotherboard = mOHMMBCheckBox.Checked;
            optionManager.IsOHMGpu         = mOHMGPUCheckBox.Checked;
            optionManager.IsOHMContolled   = mOHMControllerCheckBox.Checked;
            optionManager.IsOHMStorage     = mOHMStorageCheckBox.Checked;

            optionManager.IsNvAPIWrapper = mNvApiCheckBox.Checked;

            optionManager.IsDimm = mDimmCheckBox.Checked;

            optionManager.IsKraken = mKrakenCheckBox.Checked;

            optionManager.IsCLC = mCLCCheckBox.Checked;

            optionManager.IsRGBnFC = mRGBnFCCheckBox.Checked;

            optionManager.IsFahrenheit = mFahrenheitCheckBox.Checked;
            optionManager.IsAnimation  = mAnimationCheckBox.Checked;
            optionManager.IsMinimized  = mMinimizeCheckBox.Checked;
            optionManager.DelayTime    = delayTime;
            optionManager.IsStartUp    = mStartupCheckBox.Checked;
            optionManager.write();

            if (isRestart == true)
            {
                this.DialogResult = DialogResult.Yes;
            }
            else
            {
                this.DialogResult = DialogResult.OK;
            }
            this.Close();
        }
Example #28
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);
                }
            }
        }
Example #29
0
        private void onOKButtonClick(object sender, EventArgs e)
        {
            int interval = int.Parse(mIntervalTextBox.Text);

            if (interval < 100)
            {
                interval = 100;
            }
            else if (interval > 5000)
            {
                interval = 5000;
            }

            var  optionManager = OptionManager.getInstance();
            bool isRestart     = false;

            // 변경
            if ((optionManager.IsGigabyte != mGigabyteCheckBox.Checked) ||
                (optionManager.LibraryType == LibraryType.LibreHardwareMonitor && mLibraryRadioButton2.Checked == true) ||
                (optionManager.LibraryType == LibraryType.OpenHardwareMonitor && mLibraryRadioButton1.Checked == true) ||
                (optionManager.IsDimm != mDimmCheckBox.Checked) ||
                (optionManager.IsNvAPIWrapper != mNvApiCheckBox.Checked) ||
                (optionManager.IsKraken != mKrakenCheckBox.Checked) ||
                (optionManager.IsCLC != mCLCCheckBox.Checked) ||
                (optionManager.IsRGBnFC != mRGBnFCCheckBox.Checked))
            {
                var result = MessageBox.Show(StringLib.OptionRestart, StringLib.Option, MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (result == DialogResult.Cancel)
                {
                    return;
                }
                isRestart = true;
            }

            optionManager.Interval       = interval;
            optionManager.IsGigabyte     = mGigabyteCheckBox.Checked;
            optionManager.LibraryType    = (mLibraryRadioButton1.Checked == true) ? LibraryType.LibreHardwareMonitor : LibraryType.OpenHardwareMonitor;
            optionManager.IsDimm         = mDimmCheckBox.Checked;
            optionManager.IsNvAPIWrapper = mNvApiCheckBox.Checked;
            optionManager.IsKraken       = mKrakenCheckBox.Checked;
            optionManager.IsCLC          = mCLCCheckBox.Checked;
            optionManager.IsRGBnFC       = mRGBnFCCheckBox.Checked;
            optionManager.IsFahrenheit   = mFahrenheitCheckBox.Checked;
            optionManager.IsAnimation    = mAnimationCheckBox.Checked;
            optionManager.IsMinimized    = mMinimizeCheckBox.Checked;
            optionManager.IsStartUp      = mStartupCheckBox.Checked;
            optionManager.write();

            if (isRestart == true)
            {
                ControlManager.getInstance().reset();
                ControlManager.getInstance().write();

                OSDManager.getInstance().reset();
                OSDManager.getInstance().write();

                OnExitHandler(null, EventArgs.Empty);
                return;
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Example #30
0
        public void start()
        {
            Monitor.Enter(mLock);
            if (mIsStart == true)
            {
                Monitor.Exit(mLock);
                return;
            }
            mIsStart = true;

            string mutexName = "Global\\Access_ISABUS.HTP.Method";

            this.createBusMutex(mutexName, ref mISABusMutex);

            mutexName = "Global\\Access_SMBUS.HTP.Method";
            this.createBusMutex(mutexName, ref mSMBusMutex);

            mutexName = "Global\\Access_PCI";
            this.createBusMutex(mutexName, ref mPCIMutex);

            // Gigabyte
            if (OptionManager.getInstance().IsGigabyte == true)
            {
                mGigabyte = new Gigabyte();
                mGigabyte.AddChangeValue += addChangeValue;
                mGigabyte.LockBus        += lockBus;
                mGigabyte.UnlockBus      += unlockBus;

                mIsGigabyte = mGigabyte.start();
            }
            else
            {
                mIsGigabyte = false;
                Gigabyte.stopService();
            }

            if (mIsGigabyte == false)
            {
                mGigabyte = null;

                // LibreHardwareMonitor
                if (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor)
                {
                    mLHM = new LHM();
                    mLHM.start();
                }

                // OpenHardwareMonitor
                else
                {
                    mOHM = new OHM();
                    mOHM.start();
                }
            }

            // NvAPIWrapper
            if (OptionManager.getInstance().IsNvAPIWrapper == true)
            {
                NVIDIA.Initialize();
            }

            this.createTemp();
            this.createFan();
            this.createControl();

            if (OptionManager.getInstance().IsKraken == true)
            {
                // NZXT Kraken
                try
                {
                    mKraken = new Kraken();

                    // X2
                    if (mKraken.start(USBProductID.KrakenX2) == false)
                    {
                        // X3
                        if (mKraken.start(USBProductID.KrakenX3) == false)
                        {
                            mKraken = null;
                        }
                    }

                    if (mKraken != null)
                    {
                        var sensor = new KrakenLiquidTemp(mKraken);
                        mSensorList.Add(sensor);

                        if (mKraken.ProductID == USBProductID.KrakenX2)
                        {
                            var fan = new KrakenFanSpeed(mKraken);
                            mFanList.Add(fan);
                        }

                        var pump = new KrakenPumpSpeed(mKraken);
                        mFanList.Add(pump);

                        if (mKraken.ProductID == USBProductID.KrakenX2)
                        {
                            var fanControl = new KrakenFanControl(mKraken);
                            mControlList.Add(fanControl);
                            this.addChangeValue(30, fanControl);
                        }

                        var pumpControl = new KrakenPumpControl(mKraken);
                        mControlList.Add(pumpControl);
                        this.addChangeValue(50, pumpControl);
                    }
                }
                catch
                {
                    mKraken = null;
                }
            }

            if (OptionManager.getInstance().IsCLC == true)
            {
                try
                {
                    mCLC = new CLC();
                    if (mCLC.start(USBProductID.CLC) == false)
                    {
                        mCLC = null;
                    }

                    if (mCLC != null)
                    {
                        var sensor = new CLCLiquidTemp(mCLC);
                        mSensorList.Add(sensor);

                        var fan = new CLCFanSpeed(mCLC);
                        mFanList.Add(fan);

                        var pump = new CLCPumpSpeed(mCLC);
                        mFanList.Add(pump);

                        var fanControl = new CLCFanControl(mCLC);
                        mControlList.Add(fanControl);
                        this.addChangeValue(25, fanControl);

                        var pumpControl = new CLCPumpControl(mCLC);
                        mControlList.Add(pumpControl);
                        this.addChangeValue(50, pumpControl);
                    }
                }
                catch
                {
                    mCLC = null;
                }
            }

            if (OptionManager.getInstance().IsRGBnFC == true)
            {
                try
                {
                    mRGBnFC = new RGBnFC();
                    if (mRGBnFC.start() == false)
                    {
                        mRGBnFC = null;
                    }

                    if (mRGBnFC != null)
                    {
                        for (int i = 0; i < RGBnFC.cMaxFanCount; i++)
                        {
                            var fan = new RGBnFCFanSpeed(mRGBnFC, i);
                            mFanList.Add(fan);

                            var control = new RGBnFCControl(mRGBnFC, i);
                            mControlList.Add(control);
                            this.addChangeValue(control.getMinSpeed(), control);
                        }
                    }
                }
                catch
                {
                    mRGBnFC = null;
                }
            }

            // DIMM thermal sensor
            if (OptionManager.getInstance().IsDimm == true)
            {
                this.lockSMBus(0);
                if (SMBusController.open(false) == true)
                {
                    int num      = 1;
                    int busCount = SMBusController.getCount();

                    for (int i = 0; i < busCount; i++)
                    {
                        var detectBytes = SMBusController.i2cDetect(i);
                        if (detectBytes != null)
                        {
                            // 0x18 ~ 0x20
                            for (int j = 0; j < detectBytes.Length; j++)
                            {
                                if (j < 24)
                                {
                                    continue;
                                }
                                else if (j > 32)
                                {
                                    break;
                                }

                                if (detectBytes[j] == (byte)j)
                                {
                                    var sensor = new DimmTemp("DIMM #" + num++, i, detectBytes[j]);
                                    sensor.onSetDimmTemperature += onSetDimmTemperature;
                                    mSensorList.Add(sensor);
                                }
                            }
                        }
                    }
                }
                this.unlockSMBus();
            }

            // Motherboard temperature
            this.createMotherBoardTemp();

            // GPU
            this.createGPUTemp();
            this.createGPUFan();
            this.createGPUControl();

            // osd sensor
            this.createOSDSensor();

            Monitor.Exit(mLock);
        }