Пример #1
0
        private void setOSDSensor(ISensor[] sensorArray, SensorType sensorType, ref List <OSDSensor> osdList)
        {
            var sensorList = new List <ISensor>();

            for (int i = 0; i < sensorArray.Length; i++)
            {
                if (sensorArray[i].SensorType != sensorType)
                {
                    continue;
                }
                sensorList.Add(sensorArray[i]);
            }

            for (int i = 0; i < sensorList.Count; i++)
            {
                var sensor = sensorList[i];

                int         index      = osdList.Count;
                OSDUnitType unitType   = OSDUnitType.Unknown;
                string      sensorName = "";
                switch (sensorList[i].SensorType)
                {
                case SensorType.Voltage:
                    unitType   = OSDUnitType.Voltage;
                    sensorName = "[Voltage]  ";
                    break;

                case SensorType.Power:
                    unitType   = OSDUnitType.Power;
                    sensorName = "[Power] ";
                    break;

                case SensorType.Load:
                    unitType   = OSDUnitType.Percent;
                    sensorName = "[Load] ";
                    break;

                case SensorType.Clock:
                    unitType   = OSDUnitType.MHz;
                    sensorName = "[Clock] ";
                    break;

                case SensorType.Data:
                    unitType   = OSDUnitType.GB;
                    sensorName = "[Data] ";
                    break;

                case SensorType.SmallData:
                    unitType   = OSDUnitType.MB;
                    sensorName = "[Data] ";
                    break;

                case SensorType.Throughput:
                    unitType   = OSDUnitType.MBPerSec;
                    sensorName = "[Throughput] ";
                    break;

                default:
                    unitType = OSDUnitType.Unknown;
                    break;
                }

                if (unitType == OSDUnitType.Unknown)
                {
                    continue;
                }

                var osdSensor = new OSDSensor(sensorList[i], unitType, sensorName + sensorList[i].Name, index);
                osdList.Add(osdSensor);
            }
        }
Пример #2
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();
            }
        }