Пример #1
0
        public string getOSDString(int digit)
        {
            try
            {
                var osdString = new StringBuilder();

                // Color prefix
                if (IsColor == true)
                {
                    osdString.Append("<C=");

                    var color = new byte[3];
                    color[0] = Color.R;
                    color[1] = Color.G;
                    color[2] = Color.B;
                    osdString.Append(Util.getHexString(color));

                    osdString.Append(">");
                }

                // Value prefix
                osdString.Append(string.Format("<A=-{0}>", digit));

                // Value
                var hardwareManager = HardwareManager.getInstance();

                if (UnitType == OSDUnitType.FPS)
                {
                    osdString.Append("<FR>");
                }
                else if (UnitType == OSDUnitType.Blank)
                {
                    osdString.Append(" ");
                }
                else
                {
                    var tempBaseMap    = hardwareManager.TempBaseMap;
                    var fanBaseMap     = hardwareManager.FanBaseMap;
                    var controlBaseMap = hardwareManager.ControlBaseMap;
                    var osdMap         = hardwareManager.OSDSensorMap;

                    if (tempBaseMap.ContainsKey(ID) == true)
                    {
                        var device = tempBaseMap[ID];
                        int value  = device.Value;
                        value = (OptionManager.getInstance().IsFahrenheit == true) ? Util.getFahrenheit(value) : value;
                        osdString.Append(value.ToString());
                    }

                    else if (fanBaseMap.ContainsKey(ID) == true)
                    {
                        var device = fanBaseMap[ID];
                        int value  = device.Value;
                        osdString.Append(value.ToString());
                    }

                    else if (controlBaseMap.ContainsKey(ID) == true)
                    {
                        var device = controlBaseMap[ID];
                        int value  = device.Value;
                        osdString.Append(value.ToString());
                    }

                    else if (osdMap.ContainsKey(ID) == true)
                    {
                        var sensor = osdMap[ID];
                        osdString.Append(sensor.getString());
                    }

                    else
                    {
                        return("");
                    }
                }

                // Value postfix
                osdString.Append("<A>");

                // Unit prefix
                osdString.Append("<A1><S0>");

                // Unit
                osdString.Append(this.getUnitString());

                // Unit postfix
                osdString.Append("<S><A>");

                // Color postfix
                if (IsColor == true)
                {
                    osdString.Append("<C>");
                }

                return(osdString.ToString());
            }
            catch { }
            return("");
        }
Пример #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);
            }
        }
Пример #3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var hardwareManager = HardwareManager.getInstance();
            var controlManager  = ControlManager.getInstance();

            hardwareManager.onUpdateCallback += onUpdate;
            hardwareManager.start();

            // name
            controlManager.setNameCount(0, hardwareManager.getSensorCount());
            controlManager.setNameCount(1, hardwareManager.getFanCount());
            controlManager.setNameCount(2, hardwareManager.getControlCount());

            for (int i = 0; i < hardwareManager.getSensorCount(); i++)
            {
                var temp = hardwareManager.getSensor(i);
                controlManager.setName(0, i, true, temp.Name);
                controlManager.setName(0, i, false, temp.Name);
            }

            for (int i = 0; i < hardwareManager.getFanCount(); i++)
            {
                var temp = hardwareManager.getFan(i);
                controlManager.setName(1, i, true, temp.Name);
                controlManager.setName(1, i, false, temp.Name);
            }

            for (int i = 0; i < hardwareManager.getControlCount(); i++)
            {
                var temp = hardwareManager.getControl(i);
                controlManager.setName(2, i, true, temp.Name);
                controlManager.setName(2, i, false, temp.Name);
            }

            if (controlManager.read() == false)
            {
                MessageBox.Show(StringLib.Not_Match);
            }
            else
            {
                if (controlManager.checkData() == false)
                {
                    MessageBox.Show(StringLib.Not_Match);
                }
            }

            // OSDManager
            OSDManager.getInstance().read();

            this.createComponent();
            this.ActiveControl = mFanControlButton;

            mEnableToolStripMenuItem.Checked      = controlManager.IsEnable;
            mEnableOSDToolStripMenuItem.Checked   = OSDManager.getInstance().IsEnable;
            mNormalToolStripMenuItem.Checked      = (controlManager.ModeIndex == 0);
            mSilenceToolStripMenuItem.Checked     = (controlManager.ModeIndex == 1);
            mPerformanceToolStripMenuItem.Checked = (controlManager.ModeIndex == 2);
            mGameToolStripMenuItem.Checked        = (controlManager.ModeIndex == 3);

            // startUpdate
            hardwareManager.startUpdate();

            // start icon update
            mFanIconTimer.Interval = 100;
            mFanIconTimer.Tick    += onFanIconTimer;
            if (OptionManager.getInstance().IsAnimation == true)
            {
                mFanIconTimer.Start();
            }

            if (OptionManager.getInstance().IsMinimized == true)
            {
                this.BeginInvoke(new Action(delegate()
                {
                    this.Close();
                }));
            }
        }
Пример #4
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");

            case OSDUnitType.HWiNFO:
            {
                var osdMap = HardwareManager.getInstance().OSDSensorMap;
                if (osdMap.ContainsKey(ID) == false)
                {
                    return(" ");
                }

                var    sensor     = (HWInfoOSDSensor)osdMap[ID];
                string unitString = sensor.getUnitString();

                // Temperature
                if (unitString.Equals("°C") == true || unitString.Equals("°F") == true)
                {
                    return((OptionManager.getInstance().IsFahrenheit == false) ? " 캜" : " 캟");
                }

                // Yes/No
                else if (unitString.Equals("Yes/No") == true)
                {
                    return(" ");
                }

                else
                {
                    return(" " + unitString);
                }
            }

            default:
                return(" ");
            }
        }
Пример #5
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.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;
        }
Пример #6
0
        public string getOSDString(int digit)
        {
            try
            {
                var osdString = new StringBuilder();

                // Color prefix
                if (IsColor == true)
                {
                    osdString.Append("<C=");

                    var color = new byte[3];
                    color[0] = Color.R;
                    color[1] = Color.G;
                    color[2] = Color.B;
                    osdString.Append(Util.getHexString(color));

                    osdString.Append(">");
                }

                // Value prefix
                osdString.Append(string.Format("<A=-{0}>", digit));

                // Value
                var hardwareManager = HardwareManager.getInstance();
                if (ItemType == OSDItemType.Sensor)
                {
                    var sensor = hardwareManager.getSensor(Index);
                    if (sensor == null)
                    {
                        return("");
                    }
                    int value = sensor.Value;
                    value = (OptionManager.getInstance().IsFahrenheit == true) ? Util.getFahrenheit(value) : value;
                    osdString.Append(value.ToString());
                }
                else if (ItemType == OSDItemType.Fan)
                {
                    var fan = hardwareManager.getFan(Index);
                    if (fan == null)
                    {
                        return("");
                    }
                    int value = fan.Value;
                    osdString.Append(value.ToString());
                }
                else if (ItemType == OSDItemType.Control)
                {
                    var control = hardwareManager.getControl(Index);
                    if (control == null)
                    {
                        return("");
                    }
                    int value = control.Value;
                    osdString.Append(value.ToString());
                }
                else if (ItemType == OSDItemType.Predefined)
                {
                    if (UnitType == OSDUnitType.FPS)
                    {
                        osdString.Append("<FR>");
                    }
                    else if (UnitType == OSDUnitType.Blank)
                    {
                        osdString.Append(" ");
                    }
                    else
                    {
                        var sensor = hardwareManager.getOSDSensor(Index);
                        if (sensor == null)
                        {
                            return("");
                        }
                        osdString.Append(sensor.getString());
                    }
                }
                else
                {
                    return("");
                }

                // Value postfix
                osdString.Append("<A>");

                // Unit prefix
                osdString.Append("<A1><S0>");

                // Unit
                osdString.Append(this.getUnitString());

                // Unit postfix
                osdString.Append("<S><A>");

                // Color postfix
                if (IsColor == true)
                {
                    osdString.Append("<C>");
                }

                return(osdString.ToString());
            }
            catch { }
            return("");
        }
Пример #7
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;
                mLHMMemoryCheckBox.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;
            mLHMMemoryCheckBox.Checked     = OptionManager.getInstance().IsLHMMemory;
            if (mLHMCheckBox.Checked == false)
            {
                mLHMCPUCheckBox.Enabled        = false;
                mLHMMBCheckBox.Enabled         = false;
                mLHMGPUCheckBox.Enabled        = false;
                mLHMControllerCheckBox.Enabled = false;
                mLHMStorageCheckBox.Enabled    = false;
                mLHMMemoryCheckBox.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;
                mOHMMemoryCheckBox.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;
            mOHMMemoryCheckBox.Checked     = OptionManager.getInstance().IsOHMMemory;
            if (mOHMCheckBox.Checked == false)
            {
                mOHMCPUCheckBox.Enabled        = false;
                mOHMMBCheckBox.Enabled         = false;
                mOHMGPUCheckBox.Enabled        = false;
                mOHMControllerCheckBox.Enabled = false;
                mOHMStorageCheckBox.Enabled    = false;
                mOHMMemoryCheckBox.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);

            mHWInfoCheckBox.Checked = OptionManager.getInstance().IsHWInfo;

            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;
        }
Пример #8
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();
        }
Пример #9
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) ||
                (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.DelayTime      = delayTime;
            optionManager.IsStartUp      = false;
            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();
        }
Пример #10
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();

            // NZXT Kraken
            if (OptionManager.getInstance().IsKraken == true)
            {
                try
                {
                    uint num = 1;

                    // X2
                    uint devCount = HidUSBController.getDeviceCount(USBVendorID.NZXT, USBProductID.KrakenX2);
                    for (uint i = 0; i < devCount; i++)
                    {
                        var kraken = new Kraken();
                        if (kraken.start(i, USBProductID.KrakenX2) == true)
                        {
                            mKrakenList.Add(kraken);

                            var sensor = new KrakenLiquidTemp(kraken, num);
                            mSensorList.Add(sensor);

                            var fan = new KrakenFanSpeed(kraken, num);
                            mFanList.Add(fan);

                            var pump = new KrakenPumpSpeed(kraken, num);
                            mFanList.Add(pump);

                            var fanControl = new KrakenFanControl(kraken, num);
                            mControlList.Add(fanControl);
                            this.addChangeValue(30, fanControl);

                            var pumpControl = new KrakenPumpControl(kraken, num);
                            mControlList.Add(pumpControl);
                            this.addChangeValue(50, pumpControl);

                            num++;
                        }
                    }

                    // X3
                    devCount = HidUSBController.getDeviceCount(USBVendorID.NZXT, USBProductID.KrakenX3);
                    for (uint i = 0; i < devCount; i++)
                    {
                        var kraken = new Kraken();
                        if (kraken.start(i, USBProductID.KrakenX3) == true)
                        {
                            mKrakenList.Add(kraken);

                            var sensor = new KrakenLiquidTemp(kraken, num);
                            mSensorList.Add(sensor);

                            var pump = new KrakenPumpSpeed(kraken, num);
                            mFanList.Add(pump);

                            var pumpControl = new KrakenPumpControl(kraken, num);
                            mControlList.Add(pumpControl);
                            this.addChangeValue(50, pumpControl);

                            num++;
                        }
                    }
                }
                catch { }
            }

            // EVGA CLC
            if (OptionManager.getInstance().IsCLC == true)
            {
                try
                {
                    uint num      = 1;
                    uint clcIndex = 0;

                    // SiUSBController
                    uint devCount = SiUSBController.getDeviceCount(USBVendorID.ASETEK, USBProductID.CLC);
                    for (uint i = 0; i < devCount; i++)
                    {
                        var clc = new CLC();
                        if (clc.start(true, clcIndex, i) == true)
                        {
                            mCLCList.Add(clc);

                            var sensor = new CLCLiquidTemp(clc, num);
                            mSensorList.Add(sensor);

                            var fan = new CLCFanSpeed(clc, num);
                            mFanList.Add(fan);

                            var pump = new CLCPumpSpeed(clc, num);
                            mFanList.Add(pump);

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

                            var pumpControl = new CLCPumpControl(clc, num);
                            mControlList.Add(pumpControl);
                            this.addChangeValue(50, pumpControl);

                            clcIndex++;
                            num++;
                        }
                    }

                    if (WinUSBController.initUSB() == true)
                    {
                        // WinUSBController
                        devCount = WinUSBController.getDeviceCount(USBVendorID.ASETEK, USBProductID.CLC);
                        for (uint i = 0; i < devCount; i++)
                        {
                            var clc = new CLC();
                            if (clc.start(false, clcIndex, i) == true)
                            {
                                mCLCList.Add(clc);

                                var sensor = new CLCLiquidTemp(clc, num);
                                mSensorList.Add(sensor);

                                var fan = new CLCFanSpeed(clc, num);
                                mFanList.Add(fan);

                                var pump = new CLCPumpSpeed(clc, num);
                                mFanList.Add(pump);

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

                                var pumpControl = new CLCPumpControl(clc, num);
                                mControlList.Add(pumpControl);
                                this.addChangeValue(50, pumpControl);

                                clcIndex++;
                                num++;
                            }
                        }
                    }
                }
                catch { }
            }

            if (OptionManager.getInstance().IsRGBnFC == true)
            {
                try
                {
                    uint num      = 1;
                    uint devCount = HidUSBController.getDeviceCount(USBVendorID.NZXT, USBProductID.RGBAndFanController);
                    for (uint i = 0; i < devCount; i++)
                    {
                        var rgb = new RGBnFC();
                        if (rgb.start(i) == true)
                        {
                            mRGBnFCList.Add(rgb);

                            for (int j = 0; j < RGBnFC.MAX_FAN_COUNT; j++)
                            {
                                var fan = new RGBnFCFanSpeed(rgb, j, num);
                                mFanList.Add(fan);

                                var control = new RGBnFCControl(rgb, j, num);
                                mControlList.Add(control);
                                this.addChangeValue(control.getMinSpeed(), control);

                                num++;
                            }
                        }
                    }
                }
                catch { }
            }

            // 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);
        }
Пример #11
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();
            }
        }
Пример #12
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);

            mUnitLabel.Visible        = false;
            mUnitComboBox.Visible     = false;
            mGraph.Visible            = false;
            mStepCheckBox.Visible     = false;
            mHysLabel.Visible         = false;
            mHysNumericUpDown.Visible = false;
        }
Пример #13
0
        private void onOptionButtonClick(object sender, EventArgs e)
        {
            var form   = new OptionForm();
            var result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                HardwareManager.getInstance().restartTimer();

                // start icon update
                if (OptionManager.getInstance().IsAnimation == true)
                {
                    if (mFanIconTimer == null)
                    {
                        mFanIconTimer          = new System.Windows.Forms.Timer();
                        mFanIconTimer.Interval = 100;
                        mFanIconTimer.Tick    += onFanIconTimer;
                        mFanIconTimer.Start();
                    }
                }
                else
                {
                    if (mFanIconTimer != null)
                    {
                        mFanIconTimer.Stop();
                        mFanIconTimer.Dispose();
                        mFanIconTimer = null;
                    }

                    mTrayIcon.Icon = mFanIconList[0];
                    mFanIconIndex  = 0;
                }
            }

            // Changed option data
            else if (result == DialogResult.Yes)
            {
                this.BeginInvoke(new Action(delegate()
                {
                    HardwareManager.getInstance().stop();
                    ControlManager.getInstance().reset();
                    OSDManager.getInstance().reset();

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

                    this.reload();
                }));
            }

            // Reset option data
            else if (result == DialogResult.No)
            {
                this.BeginInvoke(new Action(delegate()
                {
                    HardwareManager.getInstance().stop();
                    HardwareManager.getInstance().write();
                    ControlManager.getInstance().reset();
                    ControlManager.getInstance().write();
                    OSDManager.getInstance().reset();
                    OSDManager.getInstance().write();
                    HWInfoManager.getInstance().reset();
                    HWInfoManager.getInstance().write();

                    this.reload();
                }));
            }
        }