Esempio n. 1
0
        public AMDHardwareMonitor()
        {
            try
            {
                int status = OpenHardwareMonitor.Hardware.ATI.ADL.ADL_Main_Control_Create(1);
                if (status == ADL.ADL_OK)
                {
                    int numberOfAdapters = 0;
                    ADL.ADL_Adapter_NumberOfAdapters_Get(ref numberOfAdapters);

                    if (numberOfAdapters > 0)
                    {
                        Temperature = new float[numberOfAdapters];
                        ADLAdapterInfo[] adapterInfo = new ADLAdapterInfo[numberOfAdapters];
                        if (ADL.ADL_Adapter_AdapterInfo_Get(adapterInfo) == ADL.ADL_OK)
                        {
                            for (int i = 0; i < numberOfAdapters; i++)
                            {
                                int isActive;
                                int adapterID;

                                ADL.ADL_Adapter_Active_Get(adapterInfo[i].AdapterIndex, out isActive);
                                ADL.ADL_Adapter_ID_Get(adapterInfo[i].AdapterIndex, out adapterID);

                                AdapterName = adapterInfo[i].AdapterName;
                                UDID        = adapterInfo[i].UDID;
                                Present     = adapterInfo[i].Present;
                                VendorID    = adapterInfo[i].VendorID;
                                var busNumber      = adapterInfo[i].BusNumber;
                                var deviceNumber   = adapterInfo[i].DeviceNumber;
                                var functionNumber = adapterInfo[i].FunctionNumber;
                                var adapterId      = adapterID.ToString("X");
                            }
                        }
                    }
                }
            }
            catch (System.Exception)
            {
                Temperature = null;
            }
        }