// ReSharper disable once TooManyDependencies
 internal GPUPerformanceState(
     int index,
     IPerformanceState20 performanceState,
     IPerformanceStates20ClockEntry[] statesClockEntries,
     IPerformanceStates20VoltageEntry[] baseVoltageEntries,
     PCIeInformation pcieInformation)
 {
     StateIndex      = index;
     StateId         = performanceState.StateId;
     IsReadOnly      = !performanceState.IsEditable;
     Clocks          = statesClockEntries.Select(entry => new GPUPerformanceStateClock(entry)).ToArray();
     Voltages        = baseVoltageEntries.Select(entry => new GPUPerformanceStateVoltage(entry)).ToArray();
     PCIeInformation = pcieInformation;
 }
        internal GPUPerformanceStatesInformation(
            IPerformanceStates20Info states20Info,
            PerformanceStateId currentPerformanceStateId,
            PrivatePCIeInfoV2?pciInformation)
        {
            IsReadOnly = !states20Info.IsEditable;

            GlobalVoltages = states20Info.GeneralVoltages
                             .Select(entry => new GPUPerformanceStateVoltage(entry))
                             .ToArray();

            var clocks       = states20Info.Clocks;
            var baseVoltages = states20Info.Voltages;

            PerformanceStates = states20Info.PerformanceStates.Select((state20, i) =>
            {
                PCIeInformation statePCIeInfo = null;

                if (pciInformation != null && pciInformation.Value.PCIePerformanceStateInfos.Length > i)
                {
                    statePCIeInfo = new PCIeInformation(pciInformation.Value.PCIePerformanceStateInfos[i]);
                }

                return(new GPUPerformanceState(
                           i,
                           state20,
                           clocks[state20.StateId],
                           baseVoltages[state20.StateId],
                           statePCIeInfo
                           ));
            }).ToArray();

            CurrentPerformanceState =
                PerformanceStates.FirstOrDefault(performanceState =>
                                                 performanceState.StateId == currentPerformanceStateId);
        }