Files
nvidiaProfileInspector/nspector/Common/Cache/CachedSettings.cs
Orbmu2k 5cb91fabe8 init
2016-03-26 20:13:14 +01:00

56 lines
1.7 KiB
C#

using nspector.Native.NVAPI2;
using System.Collections.Generic;
using System.Linq;
namespace nspector.Common
{
internal class CachedSettings
{
internal CachedSettings() { }
internal CachedSettings(uint settingId, NVDRS_SETTING_TYPE settingType)
{
SettingId = settingId;
SettingType = settingType;
}
internal uint SettingId;
internal List<CachedSettingValue> SettingValues = new List<CachedSettingValue>();
internal uint ProfileCount = 0;
internal NVDRS_SETTING_TYPE SettingType = NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
internal void AddDwordValue(uint valueDword, string Profile)
{
var setting = SettingValues.FirstOrDefault(s => s.Value == valueDword);
if (setting == null)
{
SettingValues.Add(new CachedSettingValue(valueDword, Profile));
}
else
{
setting.ProfileNames.Append(", " + Profile);
setting.ValueProfileCount++;
}
ProfileCount++;
}
internal void AddStringValue(string valueStr, string Profile)
{
var setting = SettingValues.FirstOrDefault(s => s.ValueStr == valueStr);
if (setting == null)
{
SettingValues.Add(new CachedSettingValue(valueStr, Profile));
}
else
{
setting.ProfileNames.Append(", " + Profile);
setting.ValueProfileCount++;
}
ProfileCount++;
}
}
}