示例#1
0
 public static void release()
 {
     try
     {
         OSDController.releaseOSD();
     }
     catch { }
 }
示例#2
0
 public static bool update(string osdString)
 {
     try
     {
         return(OSDController.updateOSD(osdString));
     }
     catch { }
     return(false);
 }
示例#3
0
        public void stop()
        {
            Monitor.Enter(mLock);
            if (mIsStart == false)
            {
                Monitor.Exit(mLock);
                return;
            }
            mIsStart = false;

            mChangeControlList.Clear();
            mChangeValueList.Clear();

            mUpdateTimer.Stop();

            if (mLHM != null)
            {
                mLHM.stop();
                mLHM = null;
            }

            if (mOHM != null)
            {
                mOHM.stop();
                mOHM = null;
            }

            try
            {
                if (mKraken != null)
                {
                    mKraken.stop();
                    mKraken = null;
                }
            }
            catch { }

            try
            {
                if (mCLC != null)
                {
                    mCLC.stop();
                    mCLC = null;
                }
            }
            catch { }

            try
            {
                if (mRGBnFC != null)
                {
                    mRGBnFC.stop();
                    mRGBnFC = null;
                }
            }
            catch { }

            if (mIsGigabyte == true && mGigabyte != null)
            {
                mIsGigabyte = false;
                mGigabyte.stop();
                mGigabyte = null;
            }

            mSensorList.Clear();
            mFanList.Clear();
            mControlList.Clear();

            SMBusController.close();

            if (mISABusMutex != null)
            {
                mISABusMutex.Close();
                mISABusMutex = null;
            }

            if (mSMBusMutex != null)
            {
                mSMBusMutex.Close();
                mSMBusMutex = null;
            }

            if (mPCIMutex != null)
            {
                mPCIMutex.Close();
                mPCIMutex = null;
            }

            OSDController.releaseOSD();

            Monitor.Exit(mLock);
        }
示例#4
0
        private void onUpdateTimer(object sender, EventArgs e)
        {
            if (Monitor.TryEnter(mLock) == false)
            {
                return;
            }

            if (mIsGigabyte == true && mGigabyte != null)
            {
                mGigabyte.update();
            }

            if (mLHM != null)
            {
                mLHM.update();
            }

            if (mOHM != null)
            {
                mOHM.update();
            }

            for (int i = 0; i < mSensorList.Count; i++)
            {
                mSensorList[i].update();
            }

            for (int i = 0; i < mFanList.Count; i++)
            {
                mFanList[i].update();
            }

            for (int i = 0; i < mControlList.Count; i++)
            {
                mControlList[i].update();
            }

            // change value
            bool isExistChange = false;

            if (mChangeValueList.Count > 0)
            {
                for (int i = 0; i < mChangeControlList.Count; i++)
                {
                    isExistChange = true;
                    mChangeControlList[i].setSpeed(mChangeValueList[i]);
                }
                mChangeControlList.Clear();
                mChangeValueList.Clear();
            }

            // Control
            var controlManager = ControlManager.getInstance();

            if (controlManager.IsEnable == true && isExistChange == false)
            {
                var controlDictionary = new Dictionary <int, BaseControl>();
                int modeIndex         = controlManager.ModeIndex;

                for (int i = 0; i < controlManager.getControlDataCount(modeIndex); i++)
                {
                    var controlData = controlManager.getControlData(modeIndex, i);
                    if (controlData == null)
                    {
                        break;
                    }

                    int sensorIndex = controlData.Index;
                    int temperature = mSensorList[sensorIndex].Value;

                    for (int j = 0; j < controlData.FanDataList.Count; j++)
                    {
                        var fanData      = controlData.FanDataList[j];
                        int controlIndex = fanData.Index;
                        int percent      = fanData.getValue(temperature);

                        var control = mControlList[controlIndex];

                        if (controlDictionary.ContainsKey(controlIndex) == false)
                        {
                            controlDictionary[controlIndex] = control;
                            control.NextValue = percent;
                        }
                        else
                        {
                            control.NextValue = (control.NextValue >= percent) ? control.NextValue : percent;
                        }
                    }
                }

                foreach (var keyPair in controlDictionary)
                {
                    var control = keyPair.Value;
                    if (control.Value == control.NextValue)
                    {
                        continue;
                    }
                    control.setSpeed(control.NextValue);
                }
            }

            // onUpdateCallback
            onUpdateCallback();

            var osdManager = OSDManager.getInstance();

            if (osdManager.IsEnable == true)
            {
                var osdHeaderString = "<A0=-5><A1=5><S0=50>\r";

                var osdString = new StringBuilder();
                if (osdManager.IsTime == true)
                {
                    osdString.Append(DateTime.Now.ToString("HH:mm:ss") + "\n");
                }

                int maxNameLength = 0;
                for (int i = 0; i < osdManager.getGroupCount(); i++)
                {
                    var group = osdManager.getGroup(i);
                    if (group == null)
                    {
                        break;
                    }
                    if (group.Name.Length > maxNameLength)
                    {
                        maxNameLength = group.Name.Length;
                    }
                }

                for (int i = 0; i < osdManager.getGroupCount(); i++)
                {
                    var group = osdManager.getGroup(i);
                    if (group == null)
                    {
                        break;
                    }
                    osdString.Append(group.getOSDString(maxNameLength));
                }

                if (osdString.ToString().Length > 0)
                {
                    var sendString = osdHeaderString + osdString.ToString();
                    OSDController.updateOSD(sendString);
                    osdManager.IsUpdate = true;
                }
            }
            else
            {
                if (osdManager.IsUpdate == true)
                {
                    OSDController.releaseOSD();
                    osdManager.IsUpdate = false;
                }
            }

            Monitor.Exit(mLock);
        }
示例#5
0
        public void stop()
        {
            Monitor.Enter(mLock);
            if (mIsStart == false)
            {
                Monitor.Exit(mLock);
                return;
            }
            mIsStart = false;

            mChangeControlList.Clear();
            mChangeValueList.Clear();

            mUpdateTimer.Stop();

            if (mLHM != null)
            {
                mLHM.stop();
                mLHM = null;
            }

            if (mOHM != null)
            {
                mOHM.stop();
                mOHM = null;
            }

            for (int i = 0; i < mKrakenList.Count; i++)
            {
                try
                {
                    mKrakenList[i].stop();
                }
                catch { }
            }
            mKrakenList.Clear();

            for (int i = 0; i < mCLCList.Count; i++)
            {
                try
                {
                    mCLCList[i].stop();
                }
                catch { }
            }
            mCLCList.Clear();

            for (int i = 0; i < mRGBnFCList.Count; i++)
            {
                try
                {
                    mRGBnFCList[i].stop();
                }
                catch { }
            }
            mRGBnFCList.Clear();

            if (mIsGigabyte == true && mGigabyte != null)
            {
                mIsGigabyte = false;
                mGigabyte.stop();
                mGigabyte = null;
            }

            mSensorList.Clear();
            mFanList.Clear();
            mControlList.Clear();

            SMBusController.close();

            if (mISABusMutex != null)
            {
                mISABusMutex.Close();
                mISABusMutex = null;
            }

            if (mSMBusMutex != null)
            {
                mSMBusMutex.Close();
                mSMBusMutex = null;
            }

            if (mPCIMutex != null)
            {
                mPCIMutex.Close();
                mPCIMutex = null;
            }

            OSDController.releaseOSD();
            WinUSBController.exitUSB();

            Monitor.Exit(mLock);
        }