mirror of
https://github.com/Orbmu2k/nvidiaProfileInspector.git
synced 2025-12-24 07:28:08 -05:00
Compare commits
76 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c38992cd7c | ||
|
|
53ead6e9ef | ||
|
|
f35c4cda03 | ||
|
|
a0207baafb | ||
|
|
689ad42bce | ||
|
|
0a7003519a | ||
|
|
fa01928689 | ||
|
|
9de53ac04d | ||
|
|
7b917d9b11 | ||
|
|
8ac48c2928 | ||
|
|
84e138c1ae | ||
|
|
e3ff6d42ac | ||
|
|
de9f86e878 | ||
|
|
8e0360149c | ||
|
|
bf8aa6c124 | ||
|
|
75e729298d | ||
|
|
5ac60d82ca | ||
|
|
b2306bb310 | ||
|
|
f4e2a2fe69 | ||
|
|
ecbc27200a | ||
|
|
06559a5512 | ||
|
|
04202e43c7 | ||
|
|
cde038f53b | ||
|
|
1980707c13 | ||
|
|
f5e4d76388 | ||
|
|
89957fcbae | ||
|
|
0cbafd18a3 | ||
|
|
590125369d | ||
|
|
5a20139f8b | ||
|
|
a6fde2f6f8 | ||
|
|
d5cae1000f | ||
|
|
73dbbbd66c | ||
|
|
64f626e8a0 | ||
|
|
f62aa86ccc | ||
|
|
345444619c | ||
|
|
50006f114a | ||
|
|
a3b524e7d9 | ||
|
|
109fdd066a | ||
|
|
9115ffa4cc | ||
|
|
b4f65906d9 | ||
|
|
c0c37cbfbb | ||
|
|
e548c384ec | ||
|
|
b043a0cce6 | ||
|
|
7eca55a7a1 | ||
|
|
332153bc23 | ||
|
|
8ff77c1f07 | ||
|
|
801fa76467 | ||
|
|
a40527f8de | ||
|
|
b5a0b0091a | ||
|
|
8b6c13216a | ||
|
|
3c74a9b5e5 | ||
|
|
70c63b1239 | ||
|
|
f003324d55 | ||
|
|
b9563767ef | ||
|
|
4c28abefa3 | ||
|
|
76e5d34e24 | ||
|
|
3f1d636fae | ||
|
|
acb5607a6d | ||
|
|
b6ec45a334 | ||
|
|
75c99ea6c7 | ||
|
|
5aed1a0051 | ||
|
|
128efcdb86 | ||
|
|
d4ce1c9018 | ||
|
|
abef5e1eb1 | ||
|
|
c2f71c5d1e | ||
|
|
a4ea01dfd1 | ||
|
|
9adc3b9cb9 | ||
|
|
57a8879a2c | ||
|
|
c47e69d81c | ||
|
|
21674d3f09 | ||
|
|
b5a13cf6fe | ||
|
|
c222cf1b06 | ||
|
|
6d3237bfeb | ||
|
|
5dbb8ef721 | ||
|
|
fcd9ef5346 | ||
|
|
67bb397b6a |
@@ -8,4 +8,4 @@ For more information how to use this tool, you can find some very good wikis her
|
||||
* https://wiki.step-project.com/Guide:NVIDIA_Inspector
|
||||
* https://www.pcgamingwiki.com/wiki/Nvidia_Profile_Inspector
|
||||
|
||||

|
||||

|
||||
|
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 109 KiB |
@@ -6,7 +6,7 @@ namespace nspector.Common
|
||||
internal class CachedSettingValue
|
||||
{
|
||||
|
||||
internal CachedSettingValue() { }
|
||||
internal CachedSettingValue() { }
|
||||
|
||||
internal CachedSettingValue(uint Value, string ProfileNames)
|
||||
{
|
||||
|
||||
@@ -6,14 +6,14 @@ namespace nspector.Common
|
||||
{
|
||||
internal class CachedSettings
|
||||
{
|
||||
internal 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>();
|
||||
@@ -21,7 +21,7 @@ namespace nspector.Common
|
||||
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);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace nspector.Common.CustomSettings
|
||||
@@ -14,8 +13,13 @@ namespace nspector.Common.CustomSettings
|
||||
public string HexSettingId { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string GroupName { get; set; }
|
||||
public string AlternateNames { get; set; }
|
||||
public string OverrideDefault { get; set; }
|
||||
public float MinRequiredDriverVersion { get; set; }
|
||||
public float MaxRequiredDriverVersion { get; set; }
|
||||
public bool Hidden { get; set; }
|
||||
public bool HasConstraints { get; set; }
|
||||
public string DataType { get; set; }
|
||||
|
||||
public List<CustomSettingValue> SettingValues { get; set; }
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@ namespace nspector.Common.CustomSettings
|
||||
[Serializable]
|
||||
public class CustomSettingNames
|
||||
{
|
||||
public bool ShowCustomizedSettingNamesOnly = false;
|
||||
|
||||
public List<CustomSetting> Settings = new List<CustomSetting>();
|
||||
|
||||
public void StoreToFile(string filename)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace nspector.Common.CustomSettings
|
||||
{
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace nspector.Common
|
||||
|
||||
private string FormatInternalSettingKey(string profileName, uint settingId)
|
||||
{
|
||||
return profileName + settingId.ToString("X8").ToLower();
|
||||
return profileName + settingId.ToString("X8").ToLowerInvariant();
|
||||
}
|
||||
|
||||
public bool IsInternalSetting(string profileName, uint settingId)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using nspector.Common.Import;
|
||||
using nspector.Native.NVAPI2;
|
||||
@@ -18,8 +17,8 @@ namespace nspector.Common
|
||||
private readonly DrsDecrypterService _DecrypterService;
|
||||
|
||||
public DrsImportService(
|
||||
DrsSettingsMetaService metaService,
|
||||
DrsSettingsService settingService,
|
||||
DrsSettingsMetaService metaService,
|
||||
DrsSettingsService settingService,
|
||||
DrsScannerService scannerService,
|
||||
DrsDecrypterService decrypterService)
|
||||
: base(metaService)
|
||||
@@ -77,7 +76,7 @@ namespace nspector.Common
|
||||
{
|
||||
result.Executeables.Add(app.appName);
|
||||
}
|
||||
|
||||
|
||||
var settings = GetProfileSettings(hSession, hProfile);
|
||||
foreach (var setting in settings)
|
||||
{
|
||||
@@ -239,7 +238,7 @@ namespace nspector.Common
|
||||
var decryptedSetting = setting;
|
||||
_DecrypterService.DecryptSettingIfNeeded(profileName, ref decryptedSetting);
|
||||
|
||||
if (isPredefined && exitsValueInImport && ImportExportUitl.AreDrsSettingEqualToProfileSetting(decryptedSetting, importSetting))
|
||||
if (isPredefined && exitsValueInImport && ImportExportUitl.AreDrsSettingEqualToProfileSetting(decryptedSetting, importSetting))
|
||||
{
|
||||
alreadySet.Add(setting.settingId);
|
||||
}
|
||||
@@ -261,7 +260,15 @@ namespace nspector.Common
|
||||
if (!alreadySet.Contains(setting.SettingId))
|
||||
{
|
||||
var newSetting = ImportExportUitl.ConvertProfileSettingToDrsSetting(setting);
|
||||
StoreSetting(hSession, hProfile, newSetting);
|
||||
try
|
||||
{
|
||||
StoreSetting(hSession, hProfile, newSetting);
|
||||
}
|
||||
catch (NvapiException ex)
|
||||
{
|
||||
if (ex.Status != NvAPI_Status.NVAPI_SETTING_NOT_FOUND)
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace nspector.Common
|
||||
checkedSettingsCount++;
|
||||
AddScannedSettingToCache(profile, setting);
|
||||
alreadyCheckedSettingIds.Add(setting.settingId);
|
||||
return true;
|
||||
return (setting.isCurrentPredefined != 1);
|
||||
}
|
||||
else if (setting.isCurrentPredefined != 1)
|
||||
{
|
||||
@@ -79,11 +79,10 @@ namespace nspector.Common
|
||||
return (current > 0) ? (int)Math.Round((current * 100f) / max) : 0; ;
|
||||
}
|
||||
|
||||
public async Task ScanForModifiedProfilesAsync(IProgress<int> progress, CancellationToken token = default(CancellationToken))
|
||||
public async Task ScanProfileSettingsAsync(bool justModified, IProgress<int> progress, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
|
||||
ModifiedProfiles = new List<string>();
|
||||
UserProfiles = new HashSet<string>();
|
||||
var knownPredefines = new List<uint>(_commonSettingIds);
|
||||
@@ -105,100 +104,33 @@ namespace nspector.Common
|
||||
var profile = GetProfileInfo(hSession, hProfile);
|
||||
|
||||
int checkedSettingsCount = 0;
|
||||
bool foundModifiedProfile = false;
|
||||
var alreadyChecked = new List<uint>();
|
||||
|
||||
bool foundModifiedProfile = false;
|
||||
if (profile.isPredefined == 0)
|
||||
{
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
UserProfiles.Add(profile.profileName);
|
||||
continue;
|
||||
foundModifiedProfile = true;
|
||||
if (justModified) continue;
|
||||
}
|
||||
|
||||
if ((hBaseProfile == hProfile || profile.numOfApps > 0) && profile.numOfSettings > 0)
|
||||
{
|
||||
var alreadyChecked = new List<uint>();
|
||||
|
||||
foreach (uint settingId in knownPredefines)
|
||||
{
|
||||
if (CheckCommonSetting(hSession, hProfile, profile,
|
||||
ref checkedSettingsCount, settingId, false, ref alreadyChecked))
|
||||
{
|
||||
foundModifiedProfile = true;
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// the detection if only applications has changed in a profile makes the scan process very slow, we leave it out!
|
||||
//if (!foundModifiedProfile && profile.numOfApps > 0)
|
||||
//{
|
||||
// var apps = GetProfileApplications(hSession, hProfile);
|
||||
// foreach (var app in apps)
|
||||
// {
|
||||
// if (app.isPredefined == 0)
|
||||
// {
|
||||
// foundModifiedProfile = true;
|
||||
// ModifiedProfiles.Add(profile.profileName);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
if (foundModifiedProfile || checkedSettingsCount >= profile.numOfSettings)
|
||||
continue;
|
||||
|
||||
var settings = GetProfileSettings(hSession, hProfile);
|
||||
foreach (var setting in settings)
|
||||
{
|
||||
if (knownPredefines.IndexOf(setting.settingId) < 0)
|
||||
knownPredefines.Add(setting.settingId);
|
||||
|
||||
if (setting.isCurrentPredefined != 1)
|
||||
{
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public async Task ScanForPredefinedProfileSettingsAsync(IProgress<int> progress, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
|
||||
var knownPredefines = new List<uint>(_commonSettingIds);
|
||||
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
var profileHandles = EnumProfileHandles(hSession);
|
||||
|
||||
var maxProfileCount = profileHandles.Count;
|
||||
int curProfilePos = 0;
|
||||
|
||||
foreach (IntPtr hProfile in profileHandles)
|
||||
{
|
||||
if (token.IsCancellationRequested) break;
|
||||
|
||||
progress?.Report(CalcPercent(curProfilePos++, maxProfileCount));
|
||||
|
||||
var profile = GetProfileInfo(hSession, hProfile);
|
||||
|
||||
int checkedSettingsCount = 0;
|
||||
var alreadyChecked = new List<uint>();
|
||||
|
||||
foreach (uint kpd in knownPredefines)
|
||||
{
|
||||
CheckCommonSetting(hSession, hProfile, profile,
|
||||
ref checkedSettingsCount, kpd, true, ref alreadyChecked);
|
||||
if (CheckCommonSetting(hSession, hProfile, profile,
|
||||
ref checkedSettingsCount, kpd, !justModified, ref alreadyChecked))
|
||||
{
|
||||
if (!foundModifiedProfile)
|
||||
{
|
||||
foundModifiedProfile = true;
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
if (justModified) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (checkedSettingsCount >= profile.numOfSettings)
|
||||
if ((foundModifiedProfile && justModified) || checkedSettingsCount >= profile.numOfSettings)
|
||||
continue;
|
||||
|
||||
var settings = GetProfileSettings(hSession, hProfile);
|
||||
@@ -207,8 +139,18 @@ namespace nspector.Common
|
||||
if (knownPredefines.IndexOf(setting.settingId) < 0)
|
||||
knownPredefines.Add(setting.settingId);
|
||||
|
||||
if (alreadyChecked.IndexOf(setting.settingId) < 0)
|
||||
if (!justModified && alreadyChecked.IndexOf(setting.settingId) < 0)
|
||||
AddScannedSettingToCache(profile, setting);
|
||||
|
||||
if (setting.isCurrentPredefined != 1)
|
||||
{
|
||||
if (!foundModifiedProfile)
|
||||
{
|
||||
foundModifiedProfile = true;
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
if (justModified) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -219,9 +161,8 @@ namespace nspector.Common
|
||||
|
||||
private void AddScannedSettingToCache(NVDRS_PROFILE profile, NVDRS_SETTING setting)
|
||||
{
|
||||
// Skip 3D Vision string values here for improved scan performance
|
||||
bool allowAddValue = setting.settingId < 0x70000000 || setting.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
|
||||
|
||||
// 3D Vision is dead so dont bother scanning those values for improved scan performance
|
||||
bool allowAddValue = !((setting.settingId & 0x70000000) == 0x70000000);
|
||||
//bool allowAddValue = true;
|
||||
|
||||
var cachedSetting = CachedSettings
|
||||
@@ -244,7 +185,10 @@ namespace nspector.Common
|
||||
cachedSetting.AddDwordValue(setting.predefinedValue.dwordValue, profile.profileName);
|
||||
else if (setting.settingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE)
|
||||
cachedSetting.AddBinaryValue(setting.predefinedValue.binaryValue, profile.profileName);
|
||||
|
||||
}
|
||||
else
|
||||
cachedSetting.ProfileCount++;
|
||||
|
||||
if (!cacheEntryExists)
|
||||
CachedSettings.Add(cachedSetting);
|
||||
@@ -254,7 +198,7 @@ namespace nspector.Common
|
||||
|
||||
public string FindProfilesUsingApplication(string applicationName)
|
||||
{
|
||||
string lowerApplicationName = applicationName.ToLower();
|
||||
string lowerApplicationName = applicationName.ToLowerInvariant();
|
||||
string tmpfile = TempFile.GetTempFileName();
|
||||
|
||||
try
|
||||
@@ -275,7 +219,7 @@ namespace nspector.Common
|
||||
string scope = m.Result("${scope}");
|
||||
foreach (Match ms in Regex.Matches(scope, "Executable\\s\\\"(?<app>.*?)\\\"", RegexOptions.Singleline))
|
||||
{
|
||||
if (ms.Result("${app}").ToLower() == lowerApplicationName)
|
||||
if (ms.Result("${app}").ToLowerInvariant() == lowerApplicationName)
|
||||
{
|
||||
matchingProfiles.Add(m.Result("${profile}"));
|
||||
}
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using nspector.Common.CustomSettings;
|
||||
|
||||
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
|
||||
|
||||
namespace nspector.Common
|
||||
{
|
||||
internal class DrsServiceLocator
|
||||
@@ -22,6 +14,8 @@ namespace nspector.Common
|
||||
public static readonly DrsScannerService ScannerService;
|
||||
public static readonly DrsDecrypterService DecrypterService;
|
||||
|
||||
public static bool IsExternalCustomSettings { get; private set; } = false;
|
||||
|
||||
static DrsServiceLocator()
|
||||
{
|
||||
CustomSettings = LoadCustomSettings();
|
||||
@@ -39,7 +33,18 @@ namespace nspector.Common
|
||||
string csnDefaultPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\CustomSettingNames.xml";
|
||||
|
||||
if (File.Exists(csnDefaultPath))
|
||||
return CustomSettingNames.FactoryLoadFromFile(csnDefaultPath);
|
||||
{
|
||||
try
|
||||
{
|
||||
var externalSettings = CustomSettingNames.FactoryLoadFromFile(csnDefaultPath);
|
||||
IsExternalCustomSettings = true;
|
||||
return externalSettings;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return CustomSettingNames.FactoryLoadFromString(Properties.Resources.CustomSettingNames);
|
||||
}
|
||||
}
|
||||
else
|
||||
return CustomSettingNames.FactoryLoadFromString(Properties.Resources.CustomSettingNames);
|
||||
}
|
||||
@@ -48,11 +53,15 @@ namespace nspector.Common
|
||||
{
|
||||
string csnDefaultPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Reference.xml";
|
||||
|
||||
if (File.Exists(csnDefaultPath))
|
||||
return CustomSettingNames.FactoryLoadFromFile(csnDefaultPath);
|
||||
try
|
||||
{
|
||||
if (File.Exists(csnDefaultPath))
|
||||
return CustomSettingNames.FactoryLoadFromFile(csnDefaultPath);
|
||||
}
|
||||
catch { }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace nspector.Common
|
||||
|
||||
if (csRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_CreateSession", csRes);
|
||||
|
||||
|
||||
if (!preventLoadSettings)
|
||||
{
|
||||
var nvRes = nvw.DRS_LoadSettings(GlobalSession);
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using nspector.Common.Meta;
|
||||
using nspector.Common.CustomSettings;
|
||||
using nspector.Native.NVAPI2;
|
||||
using nspector.Native.NvApi.DriverSettings;
|
||||
|
||||
namespace nspector.Common
|
||||
{
|
||||
internal class DrsSettingsMetaService
|
||||
{
|
||||
|
||||
|
||||
private ISettingMetaService ConstantMeta;
|
||||
private ISettingMetaService CustomMeta;
|
||||
public ISettingMetaService DriverMeta;
|
||||
private ISettingMetaService ScannedMeta;
|
||||
private ISettingMetaService ReferenceMeta;
|
||||
private ISettingMetaService NvD3dUmxMeta;
|
||||
|
||||
private readonly CustomSettingNames _customSettings;
|
||||
private readonly CustomSettingNames _referenceSettings;
|
||||
@@ -39,7 +35,7 @@ namespace nspector.Common
|
||||
{
|
||||
settingMetaCache = new Dictionary<uint, SettingMeta>();
|
||||
MetaServices = new List<MetaServiceItem>();
|
||||
|
||||
|
||||
CustomMeta = new CustomSettingMetaService(_customSettings);
|
||||
MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 1, Service = CustomMeta });
|
||||
|
||||
@@ -62,13 +58,10 @@ namespace nspector.Common
|
||||
ReferenceMeta = new CustomSettingMetaService(_referenceSettings, SettingMetaSource.ReferenceSettings);
|
||||
MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 4, Service = ReferenceMeta });
|
||||
}
|
||||
|
||||
NvD3dUmxMeta = new NvD3dUmxSettingMetaService();
|
||||
MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 6, Service = NvD3dUmxMeta });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId)
|
||||
{
|
||||
foreach (var service in MetaServices.OrderBy(x => x.Service.Source))
|
||||
@@ -80,16 +73,26 @@ namespace nspector.Common
|
||||
|
||||
return NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
|
||||
}
|
||||
|
||||
|
||||
private string GetSettingName(uint settingId)
|
||||
{
|
||||
foreach (var service in MetaServices.OrderBy(x=>x.Service.Source))
|
||||
string hexCandidate = null;
|
||||
|
||||
foreach (var service in MetaServices.OrderBy(x => x.Service.Source))
|
||||
{
|
||||
var settingName = service.Service.GetSettingName(settingId);
|
||||
if (settingName != null)
|
||||
|
||||
if (!string.IsNullOrEmpty(settingName))
|
||||
{
|
||||
if (settingName.StartsWith("0x"))
|
||||
{
|
||||
hexCandidate = settingName;
|
||||
continue;
|
||||
}
|
||||
return settingName;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return hexCandidate;
|
||||
}
|
||||
|
||||
private string GetGroupName(uint settingId)
|
||||
@@ -103,6 +106,17 @@ namespace nspector.Common
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetAlternateNames(uint settingId)
|
||||
{
|
||||
foreach (var service in MetaServices.OrderBy(x => x.Service.Source))
|
||||
{
|
||||
var altNames = service.Service.GetAlternateNames(settingId);
|
||||
if (altNames != null)
|
||||
return altNames;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private uint GetDwordDefaultValue(uint settingId)
|
||||
{
|
||||
foreach (var service in MetaServices.OrderBy(x => x.Service.Source))
|
||||
@@ -123,7 +137,7 @@ namespace nspector.Common
|
||||
if (settingDefault != null)
|
||||
return settingDefault;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -153,7 +167,7 @@ namespace nspector.Common
|
||||
else
|
||||
{
|
||||
var currentNonScannedValues = a.Where(xa => xa.ValueSource != SettingMetaSource.ScannedSettings).Select(xa => xa.Value).ToList();
|
||||
|
||||
|
||||
var newNonScannedValues = b.Where(xb => !currentNonScannedValues.Contains(xb.Value)).ToList();
|
||||
a.AddRange(newNonScannedValues);
|
||||
|
||||
@@ -171,7 +185,7 @@ namespace nspector.Common
|
||||
|
||||
var atmp = a.FirstOrDefault();
|
||||
if (atmp != null && atmp is IComparable)
|
||||
return a.OrderBy(x=>x.Value).ToList();
|
||||
return a.OrderBy(x => x.Value).ToList();
|
||||
else
|
||||
return a.ToList();
|
||||
}
|
||||
@@ -196,7 +210,7 @@ namespace nspector.Common
|
||||
{
|
||||
result = MergeSettingValues(result, service.Service.GetStringValues(settingId));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -211,15 +225,15 @@ namespace nspector.Common
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
result = (from v in result.Where(x=> 1==1
|
||||
result = (from v in result.Where(x => 1 == 1
|
||||
&& !x.ValueName.EndsWith("_NUM")
|
||||
&& !x.ValueName.EndsWith("_MASK")
|
||||
&& (!x.ValueName.EndsWith("_MIN") || x.ValueName.Equals("PREFERRED_PSTATE_PREFER_MIN"))
|
||||
&& (!x.ValueName.EndsWith("_MAX") || x.ValueName.Equals("PREFERRED_PSTATE_PREFER_MAX"))
|
||||
|
||||
)
|
||||
group v by v.ValueName into g
|
||||
select g.First(t => t.ValueName == g.Key))
|
||||
|
||||
)
|
||||
group v by v.ValueName into g
|
||||
select g.First(t => t.ValueName == g.Key))
|
||||
.OrderBy(v => v.ValueSource)
|
||||
.ThenBy(v => v.ValuePos)
|
||||
.ThenBy(v => v.ValueName).ToList();
|
||||
@@ -228,7 +242,7 @@ namespace nspector.Common
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public List<uint> GetSettingIds(SettingViewMode viewMode)
|
||||
{
|
||||
var settingIds = new List<uint>();
|
||||
@@ -249,22 +263,21 @@ namespace nspector.Common
|
||||
switch (viewMode)
|
||||
{
|
||||
case SettingViewMode.CustomSettingsOnly:
|
||||
return new [] {
|
||||
SettingMetaSource.CustomSettings
|
||||
return new[] {
|
||||
SettingMetaSource.CustomSettings
|
||||
};
|
||||
case SettingViewMode.IncludeScannedSetttings:
|
||||
return new [] {
|
||||
return new[] {
|
||||
SettingMetaSource.ConstantSettings,
|
||||
SettingMetaSource.ScannedSettings,
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.ScannedSettings,
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.DriverSettings,
|
||||
SettingMetaSource.NvD3dUmxSettings,
|
||||
SettingMetaSource.ReferenceSettings,
|
||||
};
|
||||
default:
|
||||
return new [] {
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.DriverSettings,
|
||||
return new[] {
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.DriverSettings,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -284,7 +297,6 @@ namespace nspector.Common
|
||||
SettingMetaSource.ScannedSettings,
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.DriverSettings,
|
||||
SettingMetaSource.NvD3dUmxSettings,
|
||||
SettingMetaSource.ReferenceSettings,
|
||||
|
||||
};
|
||||
@@ -296,7 +308,7 @@ namespace nspector.Common
|
||||
var settingType = GetSettingValueType(settingId);
|
||||
var settingName = GetSettingName(settingId);
|
||||
var groupName = GetGroupName(settingId);
|
||||
|
||||
|
||||
if (groupName == null)
|
||||
groupName = GetLegacyGroupName(settingId, settingName);
|
||||
|
||||
@@ -305,12 +317,17 @@ namespace nspector.Common
|
||||
SettingType = settingType,
|
||||
SettingName = settingName,
|
||||
GroupName = groupName,
|
||||
AlternateNames = GetAlternateNames(settingId),
|
||||
|
||||
DefaultDwordValue =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE
|
||||
IsApiExposed = GetIsApiExposed(settingId),
|
||||
IsSettingHidden = GetIsSettingHidden(settingId),
|
||||
Description = GetDescription(settingId),
|
||||
|
||||
DefaultDwordValue =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE
|
||||
? GetDwordDefaultValue(settingId) : 0,
|
||||
|
||||
DefaultStringValue =
|
||||
DefaultStringValue =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE
|
||||
? GetStringDefaultValue(settingId) : null,
|
||||
|
||||
@@ -344,6 +361,10 @@ namespace nspector.Common
|
||||
SettingName = settingMeta.SettingName,
|
||||
SettingType = settingMeta.SettingType,
|
||||
GroupName = settingMeta.GroupName,
|
||||
AlternateNames = settingMeta.AlternateNames,
|
||||
IsApiExposed = settingMeta.IsApiExposed,
|
||||
IsSettingHidden = settingMeta.IsSettingHidden,
|
||||
Description = settingMeta.Description,
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(newMeta.SettingName))
|
||||
@@ -402,5 +423,30 @@ namespace nspector.Common
|
||||
return "Other";
|
||||
|
||||
}
|
||||
private bool GetIsApiExposed(uint settingId)
|
||||
{
|
||||
var driverMeta = MetaServices.FirstOrDefault(m => m.Service.Source == SettingMetaSource.DriverSettings);
|
||||
return (driverMeta != null && driverMeta.Service.GetSettingIds().Contains(settingId));
|
||||
}
|
||||
|
||||
private bool GetIsSettingHidden(uint settingId)
|
||||
{
|
||||
var csnMeta = MetaServices.FirstOrDefault(m => m.Service.Source == SettingMetaSource.CustomSettings);
|
||||
var refMeta = MetaServices.FirstOrDefault(m => m.Service.Source == SettingMetaSource.ReferenceSettings);
|
||||
|
||||
return (csnMeta != null && ((CustomSettingMetaService)csnMeta.Service).IsSettingHidden(settingId)) ||
|
||||
refMeta != null && ((CustomSettingMetaService)refMeta.Service).IsSettingHidden(settingId);
|
||||
}
|
||||
|
||||
private string GetDescription(uint settingId)
|
||||
{
|
||||
var csn = MetaServices.FirstOrDefault(m => m.Service.Source == SettingMetaSource.CustomSettings);
|
||||
var csnDescription = csn != null ? ((CustomSettingMetaService)csn.Service).GetDescription(settingId) ?? "" : "";
|
||||
|
||||
var refs = MetaServices.FirstOrDefault(m => m.Service.Source == SettingMetaSource.ReferenceSettings);
|
||||
var refsDescription = refs != null ? ((CustomSettingMetaService)refs.Service).GetDescription(settingId) ?? "" : "";
|
||||
|
||||
return !string.IsNullOrEmpty(csnDescription) ? csnDescription : refsDescription;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using nspector.Common.Helper;
|
||||
using nspector.Common.Meta;
|
||||
using nspector.Native.NVAPI2;
|
||||
@@ -46,14 +43,14 @@ namespace nspector.Common
|
||||
if (!fiDbInstaller.Exists) continue;
|
||||
|
||||
var fviDbInstaller = FileVersionInfo.GetVersionInfo(fiDbInstaller.FullName);
|
||||
|
||||
|
||||
var fileversion = fviDbInstaller.FileVersion.Replace(".", "");
|
||||
var driverver = DriverVersion.ToString().Replace(",","").Replace(".","");
|
||||
var driverver = DriverVersion.ToString().Replace(",", "").Replace(".", "");
|
||||
|
||||
if (fileversion.EndsWith(driverver))
|
||||
return fiDbInstaller.DirectoryName;
|
||||
}
|
||||
|
||||
|
||||
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
|
||||
@"NVIDIA Corporation\Drs");
|
||||
}
|
||||
@@ -78,13 +75,13 @@ namespace nspector.Common
|
||||
var tmpFile = TempFile.GetTempFileName();
|
||||
try
|
||||
{
|
||||
File.WriteAllText(tmpFile, "BaseProfile \"Base Profile\"\r\nProfile \"Base Profile\"\r\nShowOn All\r\nProfileType Global\r\nEndProfile\r\n");
|
||||
File.WriteAllText(tmpFile, "BaseProfile \"Base Profile\"\r\nSelectedGlobalProfile \"Base Profile\"\r\nProfile \"Base Profile\"\r\nShowOn All\r\nProfileType Global\r\nEndProfile\r\n");
|
||||
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
LoadSettingsFileEx(hSession, tmpFile);
|
||||
SaveSettings(hSession);
|
||||
});
|
||||
}, forceNonGlobalSession: true, preventLoadSettings: true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -137,13 +134,34 @@ namespace nspector.Common
|
||||
var nvRes = nvw.DRS_DeleteProfile(hSession, hProfile);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_DeleteProfile", nvRes);
|
||||
|
||||
|
||||
SaveSettings(hSession);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public string GetProfileNameByExeName(string appName)
|
||||
{
|
||||
string profileName = string.Empty;
|
||||
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
var hProfile = FindApplicationByName(hSession, appName);
|
||||
if (hProfile != IntPtr.Zero)
|
||||
{
|
||||
var profile = GetProfileInfo(hSession, hProfile);
|
||||
|
||||
if (profile.isPredefined == 0 || profile.numOfApps > 0)
|
||||
{
|
||||
profileName = profile.profileName;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return profileName;
|
||||
}
|
||||
|
||||
public List<string> GetProfileNames(ref string baseProfileName)
|
||||
{
|
||||
var lstResult = new List<string>();
|
||||
@@ -154,7 +172,7 @@ namespace nspector.Common
|
||||
var hBase = GetProfileHandle(hSession, null);
|
||||
var baseProfile = GetProfileInfo(hSession, hBase);
|
||||
tmpBaseProfileName = baseProfile.profileName;
|
||||
|
||||
|
||||
lstResult.Add("_GLOBAL_DRIVER_PROFILE (" + tmpBaseProfileName + ")");
|
||||
|
||||
var profileHandles = EnumProfileHandles(hSession);
|
||||
@@ -178,7 +196,7 @@ namespace nspector.Common
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
var hProfile = CreateProfile(hSession, profileName);
|
||||
|
||||
|
||||
if (applicationName != null)
|
||||
AddApplication(hSession, hProfile, applicationName);
|
||||
|
||||
@@ -255,7 +273,7 @@ namespace nspector.Common
|
||||
var nvRes = nvw.DRS_RestoreProfileDefaultSetting(hSession, hProfile, settingId);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_RestoreProfileDefaultSetting", nvRes);
|
||||
|
||||
|
||||
SaveSettings(hSession);
|
||||
|
||||
var modifyCount = 0;
|
||||
@@ -275,6 +293,39 @@ namespace nspector.Common
|
||||
removeFromModified = tmpRemoveFromModified;
|
||||
}
|
||||
|
||||
public void DeleteValue(string profileName, uint settingId, out bool removeFromModified)
|
||||
{
|
||||
var tmpRemoveFromModified = false;
|
||||
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
var hProfile = GetProfileHandle(hSession, profileName);
|
||||
|
||||
if (hProfile != IntPtr.Zero)
|
||||
{
|
||||
int dropCount = 0;
|
||||
var settings = GetProfileSettings(hSession, hProfile);
|
||||
foreach (var setting in settings)
|
||||
{
|
||||
if (setting.settingId != settingId) continue;
|
||||
|
||||
if (setting.settingLocation == NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION)
|
||||
{
|
||||
if (nvw.DRS_DeleteProfileSetting(hSession, hProfile, setting.settingId) == NvAPI_Status.NVAPI_OK)
|
||||
{
|
||||
dropCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
tmpRemoveFromModified = (dropCount == 0);
|
||||
SaveSettings(hSession);
|
||||
}
|
||||
});
|
||||
|
||||
removeFromModified = tmpRemoveFromModified;
|
||||
}
|
||||
|
||||
public uint GetDwordValueFromProfile(string profileName, uint settingId, bool returnDefaultValue = false, bool forceDedicatedScope = false)
|
||||
{
|
||||
return DrsSession((hSession) =>
|
||||
@@ -282,7 +333,7 @@ namespace nspector.Common
|
||||
var hProfile = GetProfileHandle(hSession, profileName);
|
||||
|
||||
var dwordValue = ReadDwordValue(hSession, hProfile, settingId);
|
||||
|
||||
|
||||
if (dwordValue != null)
|
||||
return dwordValue.Value;
|
||||
else if (returnDefaultValue)
|
||||
@@ -302,7 +353,7 @@ namespace nspector.Common
|
||||
});
|
||||
}
|
||||
|
||||
public int StoreSettingsToProfile(string profileName, List<KeyValuePair<uint,string>> settings)
|
||||
public int StoreSettingsToProfile(string profileName, List<KeyValuePair<uint, string>> settings)
|
||||
{
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
@@ -335,7 +386,7 @@ namespace nspector.Common
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private SettingItem CreateSettingItem(NVDRS_SETTING setting, bool useDefault = false)
|
||||
{
|
||||
@@ -441,13 +492,16 @@ namespace nspector.Common
|
||||
SettingId = setting.settingId,
|
||||
SettingText = settingMeta.SettingName,
|
||||
GroupName = settingMeta.GroupName,
|
||||
AlternateNames = settingMeta.AlternateNames,
|
||||
ValueRaw = valueRaw,
|
||||
ValueText = valueText,
|
||||
State = settingState,
|
||||
IsStringValue = settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE,
|
||||
IsApiExposed = settingMeta.IsApiExposed,
|
||||
IsSettingHidden = settingMeta.IsSettingHidden,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<SettingItem> GetSettingsForProfile(string profileName, SettingViewMode viewMode, ref Dictionary<string, string> applications)
|
||||
{
|
||||
@@ -459,7 +513,7 @@ namespace nspector.Common
|
||||
applications = DrsSession((hSession) =>
|
||||
{
|
||||
var hProfile = GetProfileHandle(hSession, profileName);
|
||||
|
||||
|
||||
var profileSettings = GetProfileSettings(hSession, hProfile);
|
||||
foreach (var profileSetting in profileSettings)
|
||||
{
|
||||
@@ -471,6 +525,8 @@ namespace nspector.Common
|
||||
|
||||
foreach (var settingId in settingIds)
|
||||
{
|
||||
if (settingId == 0) continue;
|
||||
|
||||
var setting = ReadSetting(hSession, hProfile, settingId);
|
||||
if (setting != null)
|
||||
result.Add(CreateSettingItem(setting.Value));
|
||||
@@ -482,11 +538,11 @@ namespace nspector.Common
|
||||
}
|
||||
|
||||
return GetProfileApplications(hSession, hProfile)
|
||||
.Select(x => Tuple.Create(x.appName,GetApplicationFingerprint(x))).ToDictionary(x=> x.Item2, x=> x.Item1);
|
||||
.Select(x => Tuple.Create(x.appName, GetApplicationFingerprint(x))).ToDictionary(x => x.Item2, x => x.Item1);
|
||||
|
||||
});
|
||||
|
||||
return result.OrderBy(x=>x.SettingText).ThenBy(x=>x.GroupName).ToList();
|
||||
return result.OrderBy(x => x.SettingText).ThenBy(x => x.GroupName).ToList();
|
||||
}
|
||||
|
||||
public void AddApplication(string profileName, string applicationName)
|
||||
@@ -515,11 +571,11 @@ namespace nspector.Common
|
||||
});
|
||||
}
|
||||
|
||||
private string GetApplicationFingerprint(NVDRS_APPLICATION_V3 application)
|
||||
private string GetApplicationFingerprint(NVDRS_APPLICATION_V4 application)
|
||||
{
|
||||
return $"{application.appName}|{application.fileInFolder}|{application.userFriendlyName}|{application.launcher}";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace nspector.Common
|
||||
{
|
||||
internal abstract class DrsSettingsServiceBase
|
||||
{
|
||||
public static readonly float DriverVersion = GetDriverVersionInternal();
|
||||
|
||||
protected DrsSettingsMetaService meta;
|
||||
protected DrsDecrypterService decrypter;
|
||||
@@ -22,11 +23,9 @@ namespace nspector.Common
|
||||
{
|
||||
meta = metaService;
|
||||
decrypter = decrpterService;
|
||||
DriverVersion = GetDriverVersionInternal();
|
||||
}
|
||||
|
||||
public readonly float DriverVersion;
|
||||
private float GetDriverVersionInternal()
|
||||
private static float GetDriverVersionInternal()
|
||||
{
|
||||
float result = 0f;
|
||||
uint sysDrvVersion = 0;
|
||||
@@ -215,9 +214,9 @@ namespace nspector.Common
|
||||
|
||||
protected void AddApplication(IntPtr hSession, IntPtr hProfile, string applicationName)
|
||||
{
|
||||
var newApp = new NVDRS_APPLICATION_V3()
|
||||
var newApp = new NVDRS_APPLICATION_V4()
|
||||
{
|
||||
version = nvw.NVDRS_APPLICATION_VER_V3,
|
||||
version = nvw.NVDRS_APPLICATION_VER_V4,
|
||||
appName = applicationName,
|
||||
};
|
||||
|
||||
@@ -227,7 +226,7 @@ namespace nspector.Common
|
||||
|
||||
}
|
||||
|
||||
protected void DeleteApplication(IntPtr hSession, IntPtr hProfile, NVDRS_APPLICATION_V3 application)
|
||||
protected void DeleteApplication(IntPtr hSession, IntPtr hProfile, NVDRS_APPLICATION_V4 application)
|
||||
{
|
||||
var caRes = nvw.DRS_DeleteApplicationEx(hSession, hProfile, ref application);
|
||||
if (caRes != NvAPI_Status.NVAPI_OK)
|
||||
@@ -262,7 +261,7 @@ namespace nspector.Common
|
||||
protected List<NVDRS_SETTING> GetProfileSettings(IntPtr hSession, IntPtr hProfile)
|
||||
{
|
||||
uint settingCount = 512;
|
||||
var settings = new NVDRS_SETTING[512];
|
||||
var settings = new NVDRS_SETTING[settingCount];
|
||||
settings[0].version = NvapiDrsWrapper.NVDRS_SETTING_VER;
|
||||
|
||||
var esRes = NvapiDrsWrapper.DRS_EnumSettings(hSession, hProfile, 0, ref settingCount, ref settings);
|
||||
@@ -285,16 +284,16 @@ namespace nspector.Common
|
||||
return settings.ToList();
|
||||
}
|
||||
|
||||
protected List<NVDRS_APPLICATION_V3> GetProfileApplications(IntPtr hSession, IntPtr hProfile)
|
||||
protected List<NVDRS_APPLICATION_V4> GetProfileApplications(IntPtr hSession, IntPtr hProfile)
|
||||
{
|
||||
uint appCount = 512;
|
||||
var apps = new NVDRS_APPLICATION_V3[512];
|
||||
apps[0].version = NvapiDrsWrapper.NVDRS_APPLICATION_VER_V3;
|
||||
var apps = new NVDRS_APPLICATION_V4[512];
|
||||
apps[0].version = NvapiDrsWrapper.NVDRS_APPLICATION_VER_V4;
|
||||
|
||||
var esRes = NvapiDrsWrapper.DRS_EnumApplications(hSession, hProfile, 0, ref appCount, ref apps);
|
||||
|
||||
if (esRes == NvAPI_Status.NVAPI_END_ENUMERATION)
|
||||
return new List<NVDRS_APPLICATION_V3>();
|
||||
return new List<NVDRS_APPLICATION_V4>();
|
||||
|
||||
if (esRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_EnumApplications", esRes);
|
||||
@@ -302,6 +301,20 @@ namespace nspector.Common
|
||||
return apps.ToList();
|
||||
}
|
||||
|
||||
protected IntPtr FindApplicationByName(IntPtr hSession, string appName)
|
||||
{
|
||||
IntPtr hProfile = IntPtr.Zero;
|
||||
NVDRS_APPLICATION_V4 app = new NVDRS_APPLICATION_V4();
|
||||
app.version = NvapiDrsWrapper.NVDRS_APPLICATION_VER_V4;
|
||||
|
||||
var res = NvapiDrsWrapper.DRS_FindApplicationByName(hSession, new StringBuilder(appName), ref hProfile, ref app);
|
||||
|
||||
if (res != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_FindApplicationByName", res);
|
||||
|
||||
return hProfile;
|
||||
}
|
||||
|
||||
protected void SaveSettings(IntPtr hSession)
|
||||
{
|
||||
var nvRes = nvw.DRS_SaveSettings(hSession);
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
using nspector.Common.Meta;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common
|
||||
{
|
||||
public static class DrsUtil
|
||||
{
|
||||
public static string StringValueRaw = "Text";
|
||||
|
||||
|
||||
public static string GetDwordString(uint dword)
|
||||
{
|
||||
return string.Format("0x{0:X8}", dword);
|
||||
@@ -19,7 +17,7 @@ namespace nspector.Common
|
||||
public static uint ParseDwordByInputSafe(string input)
|
||||
{
|
||||
uint result = 0;
|
||||
if (input.ToLower().StartsWith("0x"))
|
||||
if (input.ToLowerInvariant().StartsWith("0x"))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -50,12 +48,12 @@ namespace nspector.Common
|
||||
var settingValue = meta.DwordValues
|
||||
.FirstOrDefault(x => x.Value.Equals(dwordValue));
|
||||
|
||||
return settingValue == null ? GetDwordString(dwordValue): settingValue.ValueName;
|
||||
return settingValue == null ? GetDwordString(dwordValue) : settingValue.ValueName;
|
||||
}
|
||||
|
||||
internal static string ParseStringSettingValue(SettingMeta meta, string text)
|
||||
{
|
||||
var valueByName = meta.StringValues.FirstOrDefault(x => x.ValueName != null && x.ValueName.Equals(text));
|
||||
var valueByName = meta.StringValues?.FirstOrDefault(x => x.ValueName != null && x.ValueName.Equals(text));
|
||||
if (valueByName != null)
|
||||
return valueByName.Value;
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace nspector.Common.Helper
|
||||
{
|
||||
var identity = WindowsIdentity.GetCurrent();
|
||||
var principal = new WindowsPrincipal(identity);
|
||||
isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
|
||||
isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
|
||||
}
|
||||
|
||||
|
||||
public static bool IsAdmin
|
||||
{
|
||||
get { return isAdmin; }
|
||||
|
||||
125
nspector/Common/Helper/DlssHelper.cs
Normal file
125
nspector/Common/Helper/DlssHelper.cs
Normal file
@@ -0,0 +1,125 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
{
|
||||
public class IniParser
|
||||
{
|
||||
public Dictionary<string, Dictionary<string, string>> Data { get; } = new();
|
||||
|
||||
public void Load(string filePath)
|
||||
{
|
||||
using var reader = new StreamReader(filePath);
|
||||
string? line;
|
||||
string? currentSection = null;
|
||||
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
line = line.Trim();
|
||||
|
||||
// Skip empty lines and comments
|
||||
if (string.IsNullOrEmpty(line) || line.StartsWith(";") || line.StartsWith("#"))
|
||||
continue;
|
||||
|
||||
// Section
|
||||
if (line.StartsWith("[") && line.EndsWith("]"))
|
||||
{
|
||||
currentSection = line.Substring(1, line.Length - 2).Trim();
|
||||
if (!Data.ContainsKey(currentSection))
|
||||
Data[currentSection] = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
// Key=Value
|
||||
else if (currentSection != null && line.Contains('='))
|
||||
{
|
||||
int idx = line.IndexOf('=');
|
||||
var key = line.Substring(0, idx).Trim();
|
||||
var value = line.Substring(idx + 1).Trim();
|
||||
Data[currentSection][key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string? GetValue(string section, string key)
|
||||
{
|
||||
if (Data.TryGetValue(section, out var sectionDict) &&
|
||||
sectionDict.TryGetValue(key, out var value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<string> GetSections()
|
||||
{
|
||||
return Data.Keys.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public static class DlssHelper
|
||||
{
|
||||
private static Dictionary<string, Version> _ngxVersions = FetchVersions();
|
||||
|
||||
// Fetches latest versions installed in C:\ProgramData\NVIDIA\NGX\models\ folder
|
||||
private static Dictionary<string, Version> FetchVersions()
|
||||
{
|
||||
Dictionary<string, Version> versions = new Dictionary<string, Version>();
|
||||
|
||||
try
|
||||
{
|
||||
string ngxDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"NVIDIA\NGX\models\");
|
||||
string ngxConfigPath = Path.Combine(ngxDataPath, "nvngx_config.txt");
|
||||
if (!File.Exists(ngxConfigPath))
|
||||
return versions;
|
||||
|
||||
var ini = new IniParser();
|
||||
ini.Load(ngxConfigPath);
|
||||
|
||||
foreach (string section in ini.GetSections())
|
||||
{
|
||||
string versionStr = ini.GetValue(section, "app_E658700");
|
||||
if (string.IsNullOrEmpty(versionStr))
|
||||
continue;
|
||||
|
||||
Version ver = new Version(versionStr.Trim());
|
||||
|
||||
versions[section] = ver;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
versions.Clear();
|
||||
}
|
||||
|
||||
return versions;
|
||||
}
|
||||
|
||||
public static string GetSnippetLatestVersion(string snippet)
|
||||
{
|
||||
if (!_ngxVersions.ContainsKey(snippet))
|
||||
return "unknown";
|
||||
return "v" + _ngxVersions[snippet].ToString();
|
||||
}
|
||||
|
||||
public static string ReplaceDlssVersions(string str)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str))
|
||||
return str;
|
||||
|
||||
if (str.Contains("${DlssVersion}"))
|
||||
str = str.Replace("${DlssVersion}", DlssHelper.GetSnippetLatestVersion("dlss").ToString());
|
||||
|
||||
if (str.Contains("${DlssgVersion}"))
|
||||
str = str.Replace("${DlssgVersion}", DlssHelper.GetSnippetLatestVersion("dlssg").ToString());
|
||||
|
||||
if (str.Contains("${DlssdVersion}"))
|
||||
str = str.Replace("${DlssdVersion}", DlssHelper.GetSnippetLatestVersion("dlssd").ToString());
|
||||
|
||||
return str;
|
||||
}
|
||||
}
|
||||
}
|
||||
82
nspector/Common/Helper/DropDownMenuScrollWheelHandler.cs
Normal file
82
nspector/Common/Helper/DropDownMenuScrollWheelHandler.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
{
|
||||
|
||||
//by Bryce Wagner https://stackoverflow.com/questions/13139074/mouse-wheel-scrolling-toolstrip-menu-items
|
||||
|
||||
public class DropDownMenuScrollWheelHandler : IMessageFilter
|
||||
{
|
||||
private static DropDownMenuScrollWheelHandler Instance;
|
||||
public static void Enable(bool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = new DropDownMenuScrollWheelHandler();
|
||||
Application.AddMessageFilter(Instance);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
Application.RemoveMessageFilter(Instance);
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
private IntPtr activeHwnd;
|
||||
private ToolStripDropDown activeMenu;
|
||||
|
||||
public bool PreFilterMessage(ref Message m)
|
||||
{
|
||||
if (m.Msg == 0x200 && activeHwnd != m.HWnd) // WM_MOUSEMOVE
|
||||
{
|
||||
activeHwnd = m.HWnd;
|
||||
this.activeMenu = Control.FromHandle(m.HWnd) as ToolStripDropDown;
|
||||
}
|
||||
else if (m.Msg == 0x20A && this.activeMenu != null) // WM_MOUSEWHEEL
|
||||
{
|
||||
int delta = (short)(ushort)(((uint)(ulong)m.WParam) >> 16);
|
||||
HandleDelta(this.activeMenu, delta);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static readonly Action<ToolStrip, int> ScrollInternal
|
||||
= (Action<ToolStrip, int>)Delegate.CreateDelegate(typeof(Action<ToolStrip, int>),
|
||||
typeof(ToolStrip).GetMethod("ScrollInternal",
|
||||
System.Reflection.BindingFlags.NonPublic
|
||||
| System.Reflection.BindingFlags.Instance));
|
||||
|
||||
private void HandleDelta(ToolStripDropDown ts, int delta)
|
||||
{
|
||||
if (ts.Items.Count == 0)
|
||||
return;
|
||||
|
||||
var firstItem = ts.Items[0];
|
||||
var lastItem = ts.Items[ts.Items.Count - 1];
|
||||
|
||||
if (lastItem.Bounds.Bottom < ts.Height && firstItem.Bounds.Top > 0)
|
||||
return;
|
||||
|
||||
delta = delta / -4;
|
||||
|
||||
if (delta < 0 && firstItem.Bounds.Top - delta > 9)
|
||||
{
|
||||
delta = firstItem.Bounds.Top - 9;
|
||||
}
|
||||
else if (delta > 0 && delta > lastItem.Bounds.Bottom - ts.Height + 9)
|
||||
{
|
||||
delta = lastItem.Bounds.Bottom - ts.Height + 9;
|
||||
}
|
||||
|
||||
if (delta != 0)
|
||||
ScrollInternal(ts, delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
70
nspector/Common/Helper/GithubVersionHelper.cs
Normal file
70
nspector/Common/Helper/GithubVersionHelper.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
{
|
||||
public static class GithubVersionHelper
|
||||
{
|
||||
// Check latest release info (ignores pre-release versions)
|
||||
private const string _repoUrl = "https://api.github.com/repos/Orbmu2k/nvidiaProfileInspector/releases/latest";
|
||||
|
||||
public static async Task<bool> IsUpdateAvailableAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
|
||||
using var httpClient = new HttpClient();
|
||||
httpClient.Timeout = TimeSpan.FromSeconds(10);
|
||||
httpClient.DefaultRequestHeaders.Add("User-Agent", "nvidiaProfileInspector/" + currentVersion.ToString());
|
||||
|
||||
var response = await httpClient.GetAsync(_repoUrl);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return false;
|
||||
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var tagName = ExtractJsonString(content, "tag_name");
|
||||
|
||||
if (string.IsNullOrEmpty(tagName))
|
||||
return false;
|
||||
|
||||
var versionString = tagName.TrimStart('v').Trim();
|
||||
|
||||
if (Version.TryParse(versionString, out Version latestVersion))
|
||||
{
|
||||
return latestVersion > currentVersion;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static string ExtractJsonString(string json, string fieldName)
|
||||
{
|
||||
var pattern = $"\"{fieldName}\"\\s*:\\s*\"([^\"\\\\]*(\\\\.[^\"\\\\]*)*)\"";
|
||||
var match = Regex.Match(json, pattern);
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var value = match.Groups[1].Value;
|
||||
value = value.Replace("\\\"", "\"");
|
||||
value = value.Replace("\\\\", "\\");
|
||||
value = value.Replace("\\n", "\n");
|
||||
value = value.Replace("\\r", "\r");
|
||||
value = value.Replace("\\t", "\t");
|
||||
return value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -8,16 +9,18 @@ namespace nspector.Common.Helper
|
||||
{
|
||||
internal class InputBox
|
||||
{
|
||||
internal static DialogResult Show(string title, string promptText, ref string value, List<string> invalidInputs, string mandatoryFormatRegExPattern, int maxLength)
|
||||
|
||||
internal static DialogResult Show(string title, string promptText, ref string value, List<string> invalidInputs, string mandatoryFormatRegExPattern, int maxLength, bool allowExeBrowse = false)
|
||||
{
|
||||
var form = new Form();
|
||||
var label = new Label();
|
||||
var textBox = new TextBox();
|
||||
var buttonOk = new Button();
|
||||
var buttonCancel = new Button();
|
||||
var buttonBrowse = new Button();
|
||||
var imageBox = new PictureBox();
|
||||
|
||||
EventHandler textchanged = delegate(object sender, EventArgs e)
|
||||
EventHandler textchanged = delegate (object sender, EventArgs e)
|
||||
{
|
||||
bool mandatory_success = Regex.IsMatch(textBox.Text, mandatoryFormatRegExPattern);
|
||||
|
||||
@@ -42,10 +45,23 @@ namespace nspector.Common.Helper
|
||||
buttonOk.Enabled = true;
|
||||
};
|
||||
|
||||
EventHandler buttonBrowse_Click = delegate (object sender, EventArgs e)
|
||||
{
|
||||
var openDialog = new OpenFileDialog();
|
||||
openDialog.DefaultExt = "*.exe";
|
||||
openDialog.Filter = "Application EXE Name|*.exe|Application Absolute Path|*.exe";
|
||||
|
||||
if (openDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string applicationName = new FileInfo(openDialog.FileName).Name;
|
||||
if (openDialog.FilterIndex == 2)
|
||||
applicationName = openDialog.FileName;
|
||||
textBox.Text = applicationName;
|
||||
}
|
||||
};
|
||||
|
||||
textBox.TextChanged += textchanged;
|
||||
|
||||
|
||||
form.Text = title;
|
||||
label.Text = promptText;
|
||||
textBox.Text = value;
|
||||
@@ -54,28 +70,47 @@ namespace nspector.Common.Helper
|
||||
|
||||
buttonOk.Text = "OK";
|
||||
buttonCancel.Text = "Cancel";
|
||||
buttonBrowse.Text = "Browse...";
|
||||
buttonOk.DialogResult = DialogResult.OK;
|
||||
buttonCancel.DialogResult = DialogResult.Cancel;
|
||||
|
||||
buttonOk.Enabled = false;
|
||||
|
||||
label.SetBounds(9, 20, 372, 13);
|
||||
textBox.SetBounds(12, 36, 352, 20);
|
||||
buttonOk.SetBounds(228, 72, 75, 23);
|
||||
buttonCancel.SetBounds(309, 72, 75, 23);
|
||||
label.SetBounds(Dpi(9), Dpi(20), Dpi(372), Dpi(13));
|
||||
textBox.SetBounds(Dpi(12), Dpi(44), Dpi(352), Dpi(20));
|
||||
buttonOk.SetBounds(Dpi(224), Dpi(72), Dpi(75), Dpi(23));
|
||||
buttonCancel.SetBounds(Dpi(305), Dpi(72), Dpi(75), Dpi(23));
|
||||
|
||||
imageBox.SetBounds(368, 36, 16, 16);
|
||||
if (allowExeBrowse)
|
||||
{
|
||||
textBox.SetBounds(Dpi(12), Dpi(44), Dpi(286), Dpi(20));
|
||||
buttonBrowse.SetBounds(Dpi(305), Dpi(39), Dpi(75), Dpi(23));
|
||||
buttonBrowse.Click += buttonBrowse_Click;
|
||||
}
|
||||
|
||||
imageBox.SetBounds(Dpi(368), Dpi(44), Dpi(16), Dpi(16));
|
||||
|
||||
label.AutoSize = true;
|
||||
label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
imageBox.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
|
||||
textBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonBrowse.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
|
||||
form.ClientSize = new Size(396, 107);
|
||||
form.Controls.AddRange(new Control[] { label, textBox, imageBox, buttonOk, buttonCancel });
|
||||
form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
|
||||
form.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||
form.ClientSize = new Size(Dpi(396), Dpi(107));
|
||||
form.ClientSize = new Size(Math.Max(Dpi(300), label.Right + Dpi(10)), form.ClientSize.Height);
|
||||
form.MinimumSize = form.Size;
|
||||
form.MaximumSize = new Size(form.MinimumSize.Width * 2, form.MinimumSize.Height);
|
||||
|
||||
form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel });
|
||||
if (!allowExeBrowse)
|
||||
form.Controls.Add(imageBox);
|
||||
else
|
||||
form.Controls.Add(buttonBrowse);
|
||||
|
||||
form.ShowIcon = false;
|
||||
form.FormBorderStyle = FormBorderStyle.Sizable;
|
||||
form.StartPosition = FormStartPosition.CenterParent;
|
||||
form.MinimizeBox = false;
|
||||
form.MaximizeBox = false;
|
||||
@@ -88,5 +123,10 @@ namespace nspector.Common.Helper
|
||||
value = textBox.Text;
|
||||
return dialogResult;
|
||||
}
|
||||
|
||||
private static int Dpi(int input)
|
||||
{
|
||||
return (int)Math.Round(input * frmDrvSettings.ScaleFactor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using nspector.Native.WINAPI;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
@@ -34,7 +30,7 @@ namespace nspector.Common.Helper
|
||||
|
||||
try
|
||||
{
|
||||
switch (fileInfo.Extension.ToLower())
|
||||
switch (fileInfo.Extension.ToLowerInvariant())
|
||||
{
|
||||
case ".lnk": return ResolveFromShellLinkFile(fileInfo.FullName);
|
||||
case ".url": return ResolveFromUrlFile(fileInfo.FullName);
|
||||
@@ -58,7 +54,7 @@ namespace nspector.Common.Helper
|
||||
}
|
||||
|
||||
var targetInfo = new FileInfo(shellLink.Target);
|
||||
if (targetInfo.Name.ToLower() == SteamAppResolver.SteamExeName)
|
||||
if (targetInfo.Name.ToLowerInvariant() == SteamAppResolver.SteamExeName)
|
||||
{
|
||||
if (shellLink.Arguments.Contains(SteamAppResolver.SteamArgumentPattern))
|
||||
{
|
||||
@@ -67,7 +63,7 @@ namespace nspector.Common.Helper
|
||||
}
|
||||
}
|
||||
|
||||
if (targetInfo.Extension.ToLower().Equals(".exe"))
|
||||
if (targetInfo.Extension.ToLowerInvariant().Equals(".exe"))
|
||||
{
|
||||
return targetInfo.Name;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Win32;
|
||||
@@ -36,7 +35,7 @@ namespace nspector.Common.Helper
|
||||
if (steamPath != null)
|
||||
return Path.Combine(steamPath, @"appcache\appinfo.vdf");
|
||||
}
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -90,7 +89,7 @@ namespace nspector.Common.Helper
|
||||
|
||||
var bid = BitConverter.GetBytes(appid);
|
||||
int offset = 0;
|
||||
|
||||
|
||||
var appidPattern = new byte[] { 0x08, bid[0], bid[1], bid[2], bid[3] };
|
||||
var launchPattern = new byte[] { 0x00, 0x6C, 0x61, 0x75, 0x6E, 0x63, 0x68, 0x00 };
|
||||
|
||||
@@ -157,7 +156,7 @@ namespace nspector.Common.Helper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static int FindOffset(byte[] bytes, byte[] pattern, int offset = 0, byte? wildcard = null)
|
||||
{
|
||||
for (int i = offset; i < bytes.Length; i++)
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
{
|
||||
@@ -16,7 +12,7 @@ namespace nspector.Common.Helper
|
||||
var tempFile = GenerateTempFileName();
|
||||
if (!File.Exists(tempFile))
|
||||
return tempFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string GenerateTempFileName()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
@@ -17,11 +18,19 @@ namespace nspector.Common.Helper
|
||||
|
||||
public FormWindowState WindowState { get; set; }
|
||||
|
||||
public bool ShowCustomizedSettingNamesOnly { get; set; } = false;
|
||||
|
||||
public bool ShowScannedUnknownSettings { get; set; } = false;
|
||||
|
||||
public List<string> HiddenSettingGroups { get; set; } = new List<string>();
|
||||
|
||||
public bool DisableUpdateCheck { get; set; } = false;
|
||||
|
||||
private static string GetSettingsFilename()
|
||||
{
|
||||
var fiPortalbleSettings = new FileInfo("settings.xml");
|
||||
if (fiPortalbleSettings.Exists) return fiPortalbleSettings.FullName;
|
||||
|
||||
|
||||
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Application.ProductName);
|
||||
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
|
||||
return Path.Combine(path, "settings.xml"); ;
|
||||
@@ -37,7 +46,14 @@ namespace nspector.Common.Helper
|
||||
var filename = GetSettingsFilename();
|
||||
if (!File.Exists(filename)) return new UserSettings();
|
||||
|
||||
return XMLHelper<UserSettings>.DeserializeFromXMLFile(GetSettingsFilename());
|
||||
try
|
||||
{
|
||||
return XMLHelper<UserSettings>.DeserializeFromXMLFile(GetSettingsFilename());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new UserSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using nspector.Native.NVAPI2;
|
||||
|
||||
namespace nspector.Common.Import
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace nspector.Common.Import
|
||||
|
||||
[XmlElement(ElementName = "SettingID")]
|
||||
public uint SettingId = 0;
|
||||
|
||||
|
||||
public string SettingValue = "0";
|
||||
|
||||
public SettingValueType ValueType = SettingValueType.Dword;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace nspector.Common.Import
|
||||
{
|
||||
public enum SettingValueType: int
|
||||
public enum SettingValueType : int
|
||||
{
|
||||
Dword,
|
||||
AnsiString,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using nspector.Native.NvApi.DriverSettings;
|
||||
using nspector.Native.NVAPI2;
|
||||
|
||||
@@ -19,7 +18,7 @@ namespace nspector.Common.Meta
|
||||
|
||||
private readonly Dictionary<ESetting, Type> settingEnumTypeCache;
|
||||
|
||||
private string[] ignoreSettingNames = new[] { "TOTAL_DWORD_SETTING_NUM", "TOTAL_WSTRING_SETTING_NUM",
|
||||
private string[] ignoreSettingNames = new[] { "TOTAL_DWORD_SETTING_NUM", "TOTAL_WSTRING_SETTING_NUM",
|
||||
"TOTAL_SETTING_NUM", "INVALID_SETTING_ID" };
|
||||
|
||||
private Dictionary<ESetting, Type> CreateSettingEnumTypeCache()
|
||||
@@ -158,6 +157,11 @@ namespace nspector.Common.Meta
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetAlternateNames(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] GetBinaryDefaultValue(uint settingId)
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -3,7 +3,7 @@ using nspector.Native.NVAPI2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using nspector.Common.Helper;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
@@ -21,7 +21,32 @@ namespace nspector.Common.Meta
|
||||
|
||||
public NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId)
|
||||
{
|
||||
return null;
|
||||
var setting = customSettings.Settings
|
||||
.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
|
||||
return MapType(setting?.DataType);
|
||||
}
|
||||
|
||||
private NVDRS_SETTING_TYPE? MapType(string type)
|
||||
{
|
||||
if (string.IsNullOrEmpty(type)) return null;
|
||||
|
||||
switch(type.ToLowerInvariant())
|
||||
{
|
||||
case "dword":
|
||||
return NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
|
||||
case "string":
|
||||
return NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE;
|
||||
case "binary":
|
||||
return NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE;
|
||||
default: throw new ArgumentOutOfRangeException(type);
|
||||
}
|
||||
}
|
||||
|
||||
private string ProcessNameReplacements(string friendlyName)
|
||||
{
|
||||
// Apply string version replacements here before settings are fully loaded, so that string-to-value mappings can be preserved
|
||||
return DlssHelper.ReplaceDlssVersions(friendlyName);
|
||||
}
|
||||
|
||||
public string GetSettingName(uint settingId)
|
||||
@@ -30,7 +55,7 @@ namespace nspector.Common.Meta
|
||||
.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
|
||||
if (setting != null)
|
||||
return setting.UserfriendlyName;
|
||||
return ProcessNameReplacements(setting.UserfriendlyName);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -68,17 +93,17 @@ namespace nspector.Common.Meta
|
||||
{
|
||||
ValuePos = i++,
|
||||
Value = x.SettingValue,
|
||||
ValueName = _source == SettingMetaSource.CustomSettings ? x.UserfriendlyName : DrsUtil.GetDwordString(x.SettingValue) + " " + x.UserfriendlyName,
|
||||
ValueName = _source == SettingMetaSource.CustomSettings ? ProcessNameReplacements(x.UserfriendlyName) : DrsUtil.GetDwordString(x.SettingValue) + " " + ProcessNameReplacements(x.UserfriendlyName),
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public List<uint> GetSettingIds()
|
||||
{
|
||||
return customSettings.Settings
|
||||
.Select(x => x.SettingId).ToList();
|
||||
return customSettings.Settings
|
||||
.Select(x => x.SettingId).ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +118,14 @@ namespace nspector.Common.Meta
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetAlternateNames(uint settingId)
|
||||
{
|
||||
var setting = customSettings.Settings
|
||||
.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
|
||||
return setting?.AlternateNames;
|
||||
}
|
||||
|
||||
public byte[] GetBinaryDefaultValue(uint settingId)
|
||||
{
|
||||
return null;
|
||||
@@ -103,6 +136,37 @@ namespace nspector.Common.Meta
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool IsSettingHidden(uint settingId)
|
||||
{
|
||||
var setting = customSettings.Settings
|
||||
.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
|
||||
if (DrsSettingsServiceBase.DriverVersion > 0)
|
||||
{
|
||||
if (DrsSettingsServiceBase.DriverVersion > 425.31 && (settingId & 0xFF000000) == 0x70000000)
|
||||
return true; // 3D vision settings removed after 425.31
|
||||
|
||||
if (setting == null)
|
||||
return false;
|
||||
|
||||
if (setting.MinRequiredDriverVersion > 0 && setting.MinRequiredDriverVersion > DrsSettingsServiceBase.DriverVersion)
|
||||
return true;
|
||||
|
||||
if (setting.MaxRequiredDriverVersion > 0 && setting.MaxRequiredDriverVersion < DrsSettingsServiceBase.DriverVersion)
|
||||
return true;
|
||||
}
|
||||
|
||||
return setting?.Hidden ?? false;
|
||||
}
|
||||
|
||||
public string GetDescription(uint settingId)
|
||||
{
|
||||
var setting = customSettings.Settings
|
||||
.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
|
||||
return setting?.Description;
|
||||
}
|
||||
|
||||
public SettingMetaSource Source
|
||||
{
|
||||
get { return _source; }
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using nspector.Common.CustomSettings;
|
||||
|
||||
using nspector.Native.NvApi.DriverSettings;
|
||||
using nspector.Native.NVAPI2;
|
||||
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
|
||||
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
@@ -26,16 +20,21 @@ namespace nspector.Common.Meta
|
||||
private List<uint> InitSettingIds()
|
||||
{
|
||||
var settingIds = new List<uint>();
|
||||
|
||||
|
||||
var nvRes = nvw.DRS_EnumAvailableSettingIds(out settingIds, 512);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_EnumAvailableSettingIds", nvRes);
|
||||
|
||||
return settingIds;
|
||||
}
|
||||
|
||||
|
||||
private SettingMeta GetDriverSettingMetaInternal(uint settingId)
|
||||
{
|
||||
// temporary fix for 571.96 overflow bug by emoose
|
||||
if ((settingId & 0xFFFFF000) == 0x10c7d000)
|
||||
return null;
|
||||
|
||||
|
||||
var values = new NVDRS_SETTING_VALUES();
|
||||
values.version = nvw.NVDRS_SETTING_VALUES_VER;
|
||||
uint valueCount = 255;
|
||||
@@ -44,10 +43,10 @@ namespace nspector.Common.Meta
|
||||
|
||||
if (nvRes == NvAPI_Status.NVAPI_SETTING_NOT_FOUND)
|
||||
return null;
|
||||
|
||||
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_EnumAvailableSettingValues", nvRes);
|
||||
|
||||
|
||||
|
||||
var sbSettingName = new StringBuilder((int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX);
|
||||
nvRes = nvw.DRS_GetSettingNameFromId(settingId, sbSettingName);
|
||||
@@ -58,11 +57,12 @@ namespace nspector.Common.Meta
|
||||
if (string.IsNullOrWhiteSpace(settingName))
|
||||
settingName = DrsUtil.GetDwordString(settingId);
|
||||
|
||||
var result = new SettingMeta {
|
||||
var result = new SettingMeta
|
||||
{
|
||||
SettingType = values.settingType,
|
||||
SettingName = settingName,
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE)
|
||||
{
|
||||
@@ -71,13 +71,14 @@ namespace nspector.Common.Meta
|
||||
for (int i = 0; i < values.numSettingValues; i++)
|
||||
{
|
||||
result.DwordValues.Add(
|
||||
new SettingValue<uint> (Source) {
|
||||
new SettingValue<uint>(Source)
|
||||
{
|
||||
Value = values.settingValues[i].dwordValue,
|
||||
ValueName = DrsUtil.GetDwordString(values.settingValues[i].dwordValue),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE)
|
||||
{
|
||||
result.DefaultStringValue = values.defaultValue.stringValue;
|
||||
@@ -116,7 +117,7 @@ namespace nspector.Common.Meta
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private SettingMeta GetSettingsMeta(uint settingId)
|
||||
@@ -135,13 +136,13 @@ namespace nspector.Common.Meta
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string GetSettingName(uint settingId)
|
||||
{
|
||||
var settingMeta = GetSettingsMeta(settingId);
|
||||
if (settingMeta != null)
|
||||
return settingMeta.SettingName;
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -180,7 +181,7 @@ namespace nspector.Common.Meta
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public List<uint> GetSettingIds()
|
||||
{
|
||||
return _settingIds;
|
||||
@@ -194,12 +195,17 @@ namespace nspector.Common.Meta
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public string GetGroupName(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetAlternateNames(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] GetBinaryDefaultValue(uint settingId)
|
||||
{
|
||||
var settingMeta = GetSettingsMeta(settingId);
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace nspector.Common.Meta
|
||||
{
|
||||
internal interface ISettingMetaService
|
||||
{
|
||||
SettingMetaSource Source {get; }
|
||||
SettingMetaSource Source { get; }
|
||||
|
||||
NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId);
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace nspector.Common.Meta
|
||||
|
||||
string GetGroupName(uint settingId);
|
||||
|
||||
string GetAlternateNames(uint settingId);
|
||||
|
||||
uint? GetDwordDefaultValue(uint settingId);
|
||||
|
||||
string GetStringDefaultValue(uint settingId);
|
||||
|
||||
@@ -1,207 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using nspector.Native.NvApi.DriverSettings;
|
||||
using nspector.Native.NVAPI2;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
internal class NvD3dUmxSettingMetaService : ISettingMetaService
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
struct NvD3dUmxName
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
|
||||
public string settingName;
|
||||
|
||||
public uint settingId;
|
||||
public uint unknown;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct NvD3dUmxNameList
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 255)]
|
||||
public NvD3dUmxName[] settingNames;
|
||||
}
|
||||
|
||||
private static int FindOffset(byte[] bytes, byte[] pattern, int offset = 0, byte? wildcard = null)
|
||||
{
|
||||
for (int i = offset; i < bytes.Length; i++)
|
||||
{
|
||||
if (pattern[0] == bytes[i] && bytes.Length - i >= pattern.Length)
|
||||
{
|
||||
bool ismatch = true;
|
||||
for (int j = 1; j < pattern.Length && ismatch == true; j++)
|
||||
{
|
||||
if (bytes[i + j] != pattern[j] && ((wildcard.HasValue && wildcard != pattern[j]) || !wildcard.HasValue))
|
||||
{
|
||||
ismatch = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ismatch)
|
||||
return i;
|
||||
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static List<NvD3dUmxName> ParseNvD3dUmxNames(string filename)
|
||||
{
|
||||
if (!File.Exists(filename)) return null;
|
||||
|
||||
var bytes = File.ReadAllBytes(filename);
|
||||
|
||||
var runtimeNameOffset = FindOffset(bytes, new byte[] { 0x52, 0x75, 0x6E, 0x54, 0x69, 0x6D, 0x65, 0x4E, 0x61, 0x6D, 0x65 });
|
||||
if (runtimeNameOffset > -1)
|
||||
{
|
||||
var _2ddNotesOffset = FindOffset(bytes, new byte[] { 0x32, 0x44, 0x44, 0x5F, 0x4E, 0x6F, 0x74, 0x65, 0x73 });
|
||||
if (_2ddNotesOffset > -1)
|
||||
{
|
||||
var itemSize = Marshal.SizeOf(typeof(NvD3dUmxName));
|
||||
var startOffset = runtimeNameOffset - itemSize;
|
||||
var endOffset = _2ddNotesOffset + itemSize;
|
||||
var tableLength = endOffset - startOffset;
|
||||
|
||||
var bufferSize = Marshal.SizeOf(typeof(NvD3dUmxNameList));
|
||||
if (tableLength > bufferSize)
|
||||
{
|
||||
tableLength = bufferSize;
|
||||
}
|
||||
|
||||
var itemCount = tableLength / itemSize;
|
||||
var buffer = new byte[bufferSize];
|
||||
Buffer.BlockCopy(bytes, startOffset, buffer, 0, tableLength);
|
||||
|
||||
var poBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned);
|
||||
try
|
||||
{
|
||||
var nvD3dUmxNames = (NvD3dUmxNameList)Marshal.PtrToStructure(
|
||||
poBuffer.AddrOfPinnedObject(),
|
||||
typeof(NvD3dUmxNameList));
|
||||
|
||||
var result = new List<NvD3dUmxName>();
|
||||
for (int i = 0; i < itemCount; i++)
|
||||
{
|
||||
result.Add(nvD3dUmxNames.settingNames[i]);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
poBuffer.Free();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private readonly List<NvD3dUmxName> _SettingNames;
|
||||
|
||||
private void ExportSettingsToCsn()
|
||||
{
|
||||
var settings = _SettingNames.Select(s => new CustomSettings.CustomSetting()
|
||||
{
|
||||
GroupName = "7 - Stereo",
|
||||
HexSettingId = $"0x{s.settingId.ToString("X8")}",
|
||||
UserfriendlyName = s.settingName,
|
||||
}).ToList();
|
||||
|
||||
var xml = new CustomSettings.CustomSettingNames();
|
||||
xml.Settings.AddRange(settings);
|
||||
xml.StoreToFile("NvD3dUmx.xml");
|
||||
}
|
||||
|
||||
public NvD3dUmxSettingMetaService()
|
||||
{
|
||||
var systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);
|
||||
var nvD3dUmxPath = Path.Combine(systemPath, "nvd3dumx.dll");
|
||||
_SettingNames = ParseNvD3dUmxNames(nvD3dUmxPath);
|
||||
|
||||
//ExportSettingsToCsn();
|
||||
}
|
||||
|
||||
public Type GetSettingEnumType(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetSettingName(uint settingId)
|
||||
{
|
||||
if (_SettingNames != null)
|
||||
{
|
||||
var setting = _SettingNames.FirstOrDefault(s => s.settingId == settingId);
|
||||
return setting.settingId != 0 ? setting.settingName : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public uint? GetDwordDefaultValue(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetStringDefaultValue(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<SettingValue<string>> GetStringValues(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<SettingValue<uint>> GetDwordValues(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<uint> GetSettingIds()
|
||||
{
|
||||
if (_SettingNames != null)
|
||||
{
|
||||
return _SettingNames.Select(s => s.settingId).ToList();
|
||||
}
|
||||
return new List<uint>();
|
||||
}
|
||||
|
||||
public string GetGroupName(uint settingId)
|
||||
{
|
||||
if (_SettingNames != null)
|
||||
{
|
||||
var setting = _SettingNames.FirstOrDefault(s => s.settingId == settingId);
|
||||
return setting.settingId != 0 ? "7 - Stereo" : null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] GetBinaryDefaultValue(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<SettingValue<byte[]>> GetBinaryValues(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public SettingMetaSource Source
|
||||
{
|
||||
get { return SettingMetaSource.NvD3dUmxSettings; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ namespace nspector.Common.Meta
|
||||
|
||||
public string GetSettingName(uint settingId)
|
||||
{
|
||||
var cached = CachedSettings.FirstOrDefault(x=>x.SettingId.Equals(settingId));
|
||||
var cached = CachedSettings.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
if (cached != null)
|
||||
return string.Format("0x{0:X8} ({1} Profiles)", settingId, cached.ProfileCount);
|
||||
|
||||
@@ -43,6 +43,11 @@ namespace nspector.Common.Meta
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetAlternateNames(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public uint? GetDwordDefaultValue(uint settingId)
|
||||
{
|
||||
return null;
|
||||
@@ -69,7 +74,7 @@ namespace nspector.Common.Meta
|
||||
|
||||
public List<SettingValue<uint>> GetDwordValues(uint settingId)
|
||||
{
|
||||
var cached = CachedSettings.FirstOrDefault(x=>x.SettingId.Equals(settingId));
|
||||
var cached = CachedSettings.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
if (cached != null)
|
||||
return cached.SettingValues.Select(s => new SettingValue<uint>(Source)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using nspector.Native.NVAPI2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
@@ -12,6 +9,8 @@ namespace nspector.Common.Meta
|
||||
|
||||
public string GroupName { get; set; }
|
||||
|
||||
public string AlternateNames { get; set; }
|
||||
|
||||
public string SettingName { get; set; }
|
||||
|
||||
public string DefaultStringValue { get; set; }
|
||||
@@ -20,6 +19,12 @@ namespace nspector.Common.Meta
|
||||
|
||||
public byte[] DefaultBinaryValue { get; set; }
|
||||
|
||||
public bool IsApiExposed { get; set; }
|
||||
|
||||
public bool IsSettingHidden { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public List<SettingValue<string>> StringValues { get; set; }
|
||||
|
||||
public List<SettingValue<uint>> DwordValues { get; set; }
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
public enum SettingMetaSource
|
||||
{
|
||||
@@ -11,7 +6,6 @@ namespace nspector.Common.Meta
|
||||
DriverSettings = 20,
|
||||
ConstantSettings = 30,
|
||||
ReferenceSettings = 40,
|
||||
NvD3dUmxSettings = 50,
|
||||
ScannedSettings = 60,
|
||||
ScannedSettings = 50,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
internal class SettingValue<T>
|
||||
{
|
||||
@@ -14,7 +9,7 @@ namespace nspector.Common.Meta
|
||||
{
|
||||
ValueSource = source;
|
||||
}
|
||||
|
||||
|
||||
public int ValuePos { get; set; }
|
||||
public string ValueName { get; set; }
|
||||
public T Value { get; set; }
|
||||
@@ -26,6 +21,6 @@ namespace nspector.Common.Meta
|
||||
|
||||
return string.Format("Value={0}; ValueName={1};", Value, ValueName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using nspector.Native.NVAPI2;
|
||||
|
||||
namespace nspector.Common
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common
|
||||
namespace nspector.Common
|
||||
{
|
||||
|
||||
internal enum SettingState
|
||||
@@ -17,7 +12,7 @@ namespace nspector.Common
|
||||
internal class SettingItem
|
||||
{
|
||||
public uint SettingId { get; set; }
|
||||
|
||||
|
||||
public string SettingText { get; set; }
|
||||
|
||||
public string ValueText { get; set; }
|
||||
@@ -26,10 +21,16 @@ namespace nspector.Common
|
||||
|
||||
public string GroupName { get; set; }
|
||||
|
||||
public string AlternateNames { get; set; }
|
||||
|
||||
public SettingState State { get; set; }
|
||||
|
||||
public bool IsStringValue { get; set; }
|
||||
|
||||
public bool IsApiExposed { get; set; }
|
||||
|
||||
public bool IsSettingHidden { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}; 0x{1:X8}; {2}; {3}; {4};", State, SettingId, SettingText, ValueText, ValueRaw);
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common
|
||||
namespace nspector.Common
|
||||
{
|
||||
public enum SettingViewMode
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,52 +3,58 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace nspector
|
||||
{
|
||||
internal delegate void DropFilesNativeHandler(string[] files);
|
||||
internal delegate void DropFilesNativeHandler(string[] files);
|
||||
|
||||
internal class ListViewEx : ListView
|
||||
internal class ListViewEx : ListView
|
||||
{
|
||||
|
||||
public event DropFilesNativeHandler OnDropFilesNative;
|
||||
|
||||
public event DropFilesNativeHandler OnDropFilesNative;
|
||||
|
||||
public event EventHandler<GroupStateChangedEventArgs> GroupStateChanged;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wPar, IntPtr lPar);
|
||||
|
||||
private const int LVM_FIRST = 0x1000;
|
||||
private const int LVM_GETCOLUMNORDERARRAY = (LVM_FIRST + 59);
|
||||
|
||||
|
||||
private const int WM_PAINT = 0x000F;
|
||||
private const int WM_VSCROLL = 0x0115;
|
||||
private const int WM_HSCROLL = 0x0114;
|
||||
private const int WM_MOUSEWHEEL = 0x020A;
|
||||
|
||||
private struct EmbeddedControl
|
||||
{
|
||||
internal Control Control;
|
||||
internal int Column;
|
||||
internal int Row;
|
||||
internal DockStyle Dock;
|
||||
internal ListViewItem Item;
|
||||
internal Control Control;
|
||||
internal int Column;
|
||||
internal int Row;
|
||||
internal DockStyle Dock;
|
||||
internal ListViewItem Item;
|
||||
}
|
||||
|
||||
private ArrayList _embeddedControls = new ArrayList();
|
||||
|
||||
public ListViewEx()
|
||||
{
|
||||
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.EnableNotifyMessage, true);
|
||||
}
|
||||
public ListViewEx()
|
||||
{
|
||||
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.EnableNotifyMessage, true);
|
||||
}
|
||||
|
||||
protected override void OnNotifyMessage(Message m)
|
||||
{
|
||||
if (m.Msg != 0x14)
|
||||
{
|
||||
base.OnNotifyMessage(m);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnNotifyMessage(Message m)
|
||||
{
|
||||
if (m.Msg != 0x14)
|
||||
{
|
||||
base.OnNotifyMessage(m);
|
||||
}
|
||||
}
|
||||
|
||||
protected int[] GetColumnOrder()
|
||||
{
|
||||
IntPtr lPar = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * Columns.Count);
|
||||
@@ -82,8 +88,14 @@ namespace nspector
|
||||
if (SubItem >= order.Length)
|
||||
throw new IndexOutOfRangeException("SubItem "+SubItem+" out of range");
|
||||
|
||||
Rectangle lviBounds = Item.GetBounds(ItemBoundsPortion.Entire);
|
||||
int subItemX = lviBounds.Left;
|
||||
Rectangle lviBounds;
|
||||
try
|
||||
{
|
||||
lviBounds = Item.GetBounds(ItemBoundsPortion.Entire);
|
||||
}
|
||||
catch { return subItemRect; }
|
||||
|
||||
int subItemX = lviBounds.Left;
|
||||
|
||||
ColumnHeader col;
|
||||
int i;
|
||||
@@ -94,18 +106,18 @@ namespace nspector
|
||||
break;
|
||||
subItemX += col.Width;
|
||||
}
|
||||
|
||||
|
||||
subItemRect = new Rectangle(subItemX, lviBounds.Top-1, this.Columns[order[i]].Width, lviBounds.Height);
|
||||
|
||||
return subItemRect;
|
||||
}
|
||||
|
||||
internal void AddEmbeddedControl(Control c, int col, int row)
|
||||
internal void AddEmbeddedControl(Control c, int col, int row)
|
||||
{
|
||||
AddEmbeddedControl(c,col,row,DockStyle.Fill);
|
||||
}
|
||||
|
||||
internal void AddEmbeddedControl(Control c, int col, int row, DockStyle dock)
|
||||
internal void AddEmbeddedControl(Control c, int col, int row, DockStyle dock)
|
||||
{
|
||||
if (c==null)
|
||||
throw new ArgumentNullException();
|
||||
@@ -122,11 +134,11 @@ namespace nspector
|
||||
_embeddedControls.Add(ec);
|
||||
|
||||
c.Click += new EventHandler(_embeddedControl_Click);
|
||||
|
||||
|
||||
this.Controls.Add(c);
|
||||
}
|
||||
|
||||
internal void RemoveEmbeddedControl(Control c)
|
||||
|
||||
internal void RemoveEmbeddedControl(Control c)
|
||||
{
|
||||
if (c == null)
|
||||
throw new ArgumentNullException();
|
||||
@@ -143,8 +155,8 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal Control GetEmbeddedControl(int col, int row)
|
||||
|
||||
internal Control GetEmbeddedControl(int col, int row)
|
||||
{
|
||||
foreach (EmbeddedControl ec in _embeddedControls)
|
||||
if (ec.Row == row && ec.Column == col)
|
||||
@@ -154,9 +166,9 @@ namespace nspector
|
||||
}
|
||||
|
||||
[DefaultValue(View.LargeIcon)]
|
||||
internal new View View
|
||||
internal new View View
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
return base.View;
|
||||
}
|
||||
@@ -169,12 +181,18 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("shell32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern int DragQueryFile(IntPtr hDrop, uint iFile, [Out] StringBuilder lpszFile, int cch);
|
||||
private const int WM_DROPFILES = 0x233;
|
||||
[DllImport("shell32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern int DragQueryFile(IntPtr hDrop, uint iFile, [Out] StringBuilder lpszFile, int cch);
|
||||
private const int WM_DROPFILES = 0x233;
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
if (m.Msg == WM_LBUTTONUP)
|
||||
{
|
||||
base.DefWndProc(ref m); // Fix for collapsible buttons
|
||||
return;
|
||||
}
|
||||
|
||||
switch (m.Msg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
@@ -183,6 +201,10 @@ namespace nspector
|
||||
|
||||
foreach (EmbeddedControl ec in _embeddedControls)
|
||||
{
|
||||
// Skip repositioning if the control is a dropped-down ComboBox, prevents it from immediately closing on first click
|
||||
if (ec.Control is ComboBox comboBox && comboBox.DroppedDown)
|
||||
continue;
|
||||
|
||||
Rectangle rc = this.GetSubItemBounds(ec.Item, ec.Column);
|
||||
|
||||
if ((this.HeaderStyle != ColumnHeaderStyle.None) &&
|
||||
@@ -220,44 +242,97 @@ namespace nspector
|
||||
}
|
||||
|
||||
|
||||
rc.X = rc.X + ec.Control.Margin.Left;
|
||||
rc.Y = rc.Y + ec.Control.Margin.Top;
|
||||
rc.Width = rc.Width - ec.Control.Margin.Right;
|
||||
rc.Height = rc.Height - ec.Control.Margin.Bottom;
|
||||
rc.X = rc.X + ec.Control.Margin.Left;
|
||||
rc.Y = rc.Y + ec.Control.Margin.Top;
|
||||
rc.Width = rc.Width - ec.Control.Margin.Right;
|
||||
rc.Height = rc.Height - ec.Control.Margin.Bottom;
|
||||
|
||||
ec.Control.Bounds = rc;
|
||||
ec.Control.Bounds = rc;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DROPFILES:
|
||||
|
||||
if (OnDropFilesNative != null)
|
||||
{
|
||||
var dropped = DragQueryFile(m.WParam, 0xFFFFFFFF, null, 0);
|
||||
if (dropped > 0)
|
||||
{
|
||||
var files = new List<string>();
|
||||
|
||||
for (uint i = 0; i < dropped; i++)
|
||||
{
|
||||
var size = DragQueryFile(m.WParam, i, null, 0);
|
||||
if (size > 0)
|
||||
{
|
||||
var sb = new StringBuilder(size + 1);
|
||||
var result = DragQueryFile(m.WParam, i, sb, size + 1);
|
||||
files.Add(sb.ToString());
|
||||
}
|
||||
}
|
||||
case WM_VSCROLL:
|
||||
case WM_HSCROLL:
|
||||
case WM_MOUSEWHEEL:
|
||||
// Close any opened comboboxes if listview is being scrolled
|
||||
foreach (EmbeddedControl ec in _embeddedControls)
|
||||
{
|
||||
if (ec.Control is ComboBox comboBox && comboBox.DroppedDown)
|
||||
{
|
||||
comboBox.DroppedDown = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
OnDropFilesNative(files.ToArray());
|
||||
}
|
||||
}
|
||||
case WM_DROPFILES:
|
||||
|
||||
base.WndProc(ref m);
|
||||
break;
|
||||
if (OnDropFilesNative != null)
|
||||
{
|
||||
var dropped = DragQueryFile(m.WParam, 0xFFFFFFFF, null, 0);
|
||||
if (dropped > 0)
|
||||
{
|
||||
var files = new List<string>();
|
||||
|
||||
for (uint i = 0; i < dropped; i++)
|
||||
{
|
||||
var size = DragQueryFile(m.WParam, i, null, 0);
|
||||
if (size > 0)
|
||||
{
|
||||
var sb = new StringBuilder(size + 1);
|
||||
var result = DragQueryFile(m.WParam, i, sb, size + 1);
|
||||
files.Add(sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
OnDropFilesNative(files.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
base.WndProc(ref m);
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
case WM_REFLECT_NOTIFY:
|
||||
var nmhdr = (NMHDR)Marshal.PtrToStructure(m.LParam, typeof(NMHDR));
|
||||
|
||||
// Check if this is an (undocumented) listview group notification
|
||||
// https://www.zabkat.com/blog/05Feb12-collapsible-listview.htm
|
||||
if (nmhdr.code == LVN_GROUPINFO && !_isUpdatingGroups)
|
||||
{
|
||||
// Group state has changed - get the group info
|
||||
var lvGroupInfo = (NMLVGROUP)Marshal.PtrToStructure(m.LParam, typeof(NMLVGROUP));
|
||||
|
||||
// Find the corresponding ListViewGroup
|
||||
ListViewGroup changedGroup = null;
|
||||
foreach (ListViewGroup group in this.Groups)
|
||||
{
|
||||
int? groupId = GetGroupID(group);
|
||||
if (groupId.HasValue && groupId.Value == lvGroupInfo.iGroupId)
|
||||
{
|
||||
changedGroup = group;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (changedGroup != null)
|
||||
{
|
||||
// Determine if collapsed or expanded based on state
|
||||
bool isCollapsed = (lvGroupInfo.uNewState & (int)ListViewGroupState.Collapsed) != 0;
|
||||
|
||||
// Fire the event
|
||||
GroupStateChanged?.Invoke(this, new GroupStateChangedEventArgs
|
||||
{
|
||||
Group = changedGroup,
|
||||
IsCollapsed = isCollapsed,
|
||||
NewState = (ListViewGroupState)lvGroupInfo.uNewState
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
base.WndProc (ref m);
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
private void _embeddedControl_Click(object sender, EventArgs e)
|
||||
@@ -271,5 +346,401 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Collapsible groups - https://www.codeproject.com/Articles/451742/Extending-Csharp-ListView-with-Collapsible-Groups
|
||||
|
||||
private bool _isUpdatingGroups = false;
|
||||
|
||||
private const int WM_NOTIFY = 0x004E;
|
||||
private const int WM_REFLECT_NOTIFY = 0x204E;
|
||||
|
||||
private const int LVN_FIRST = -100;
|
||||
private const int LVN_GROUPINFO = (LVN_FIRST - 88);
|
||||
|
||||
private const int LVM_SETGROUPINFO = (LVM_FIRST + 147); // ListView messages Setinfo on Group
|
||||
private const int WM_LBUTTONUP = 0x0202; // Windows message left button
|
||||
|
||||
private delegate void CallBackSetGroupState(ListViewGroup lstvwgrp, ListViewGroupState state);
|
||||
private delegate void CallbackSetGroupString(ListViewGroup lstvwgrp, string value);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, LVGROUP lParam);
|
||||
|
||||
private static int? GetGroupID(ListViewGroup lstvwgrp)
|
||||
{
|
||||
int? rtnval = null;
|
||||
Type GrpTp = lstvwgrp.GetType();
|
||||
if (GrpTp != null)
|
||||
{
|
||||
PropertyInfo pi = GrpTp.GetProperty("ID", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (pi != null)
|
||||
{
|
||||
object tmprtnval = pi.GetValue(lstvwgrp, null);
|
||||
if (tmprtnval != null)
|
||||
{
|
||||
rtnval = tmprtnval as int?;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rtnval;
|
||||
}
|
||||
|
||||
private static void setGrpState(ListViewGroup lstvwgrp, ListViewGroupState state)
|
||||
{
|
||||
if (Environment.OSVersion.Version.Major < 6) //Only Vista and forward allows collaps of ListViewGroups
|
||||
return;
|
||||
if (lstvwgrp == null || lstvwgrp.ListView == null)
|
||||
return;
|
||||
if (lstvwgrp.ListView.InvokeRequired)
|
||||
lstvwgrp.ListView.Invoke(new CallBackSetGroupState(setGrpState), lstvwgrp, state);
|
||||
else
|
||||
{
|
||||
int? GrpId = GetGroupID(lstvwgrp);
|
||||
int gIndex = lstvwgrp.ListView.Groups.IndexOf(lstvwgrp);
|
||||
LVGROUP group = new LVGROUP();
|
||||
group.CbSize = Marshal.SizeOf(group);
|
||||
group.State = state;
|
||||
group.Mask = ListViewGroupMask.State;
|
||||
if (GrpId != null)
|
||||
{
|
||||
group.IGroupId = GrpId.Value;
|
||||
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, GrpId.Value, group);
|
||||
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, GrpId.Value, group);
|
||||
}
|
||||
else
|
||||
{
|
||||
group.IGroupId = gIndex;
|
||||
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, gIndex, group);
|
||||
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, gIndex, group);
|
||||
}
|
||||
lstvwgrp.ListView.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setGrpFooter(ListViewGroup lstvwgrp, string footer)
|
||||
{
|
||||
if (Environment.OSVersion.Version.Major < 6) //Only Vista and forward allows footer on ListViewGroups
|
||||
return;
|
||||
if (lstvwgrp == null || lstvwgrp.ListView == null)
|
||||
return;
|
||||
if (lstvwgrp.ListView.InvokeRequired)
|
||||
lstvwgrp.ListView.Invoke(new CallbackSetGroupString(setGrpFooter), lstvwgrp, footer);
|
||||
else
|
||||
{
|
||||
int? GrpId = GetGroupID(lstvwgrp);
|
||||
int gIndex = lstvwgrp.ListView.Groups.IndexOf(lstvwgrp);
|
||||
LVGROUP group = new LVGROUP();
|
||||
group.CbSize = Marshal.SizeOf(group);
|
||||
group.PszFooter = footer;
|
||||
group.Mask = ListViewGroupMask.Footer;
|
||||
if (GrpId != null)
|
||||
{
|
||||
group.IGroupId = GrpId.Value;
|
||||
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, GrpId.Value, group);
|
||||
}
|
||||
else
|
||||
{
|
||||
group.IGroupId = gIndex;
|
||||
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, gIndex, group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetGroupState(ListViewGroupState state)
|
||||
{
|
||||
_isUpdatingGroups = true;
|
||||
foreach (ListViewGroup lvg in this.Groups)
|
||||
setGrpState(lvg, state);
|
||||
_isUpdatingGroups = false;
|
||||
}
|
||||
|
||||
public void SetGroupState(ListViewGroup group, ListViewGroupState state)
|
||||
{
|
||||
_isUpdatingGroups = true;
|
||||
setGrpState(group, state);
|
||||
_isUpdatingGroups = false;
|
||||
}
|
||||
|
||||
public void SetGroupFooter(ListViewGroup lvg, string footerText)
|
||||
{
|
||||
setGrpFooter(lvg, footerText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// LVGROUP StructureUsed to set and retrieve groups.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// LVGROUP myLVGROUP = new LVGROUP();
|
||||
/// myLVGROUP.CbSize // is of managed type uint
|
||||
/// myLVGROUP.Mask // is of managed type uint
|
||||
/// myLVGROUP.PszHeader // is of managed type string
|
||||
/// myLVGROUP.CchHeader // is of managed type int
|
||||
/// myLVGROUP.PszFooter // is of managed type string
|
||||
/// myLVGROUP.CchFooter // is of managed type int
|
||||
/// myLVGROUP.IGroupId // is of managed type int
|
||||
/// myLVGROUP.StateMask // is of managed type uint
|
||||
/// myLVGROUP.State // is of managed type uint
|
||||
/// myLVGROUP.UAlign // is of managed type uint
|
||||
/// myLVGROUP.PszSubtitle // is of managed type IntPtr
|
||||
/// myLVGROUP.CchSubtitle // is of managed type uint
|
||||
/// myLVGROUP.PszTask // is of managed type string
|
||||
/// myLVGROUP.CchTask // is of managed type uint
|
||||
/// myLVGROUP.PszDescriptionTop // is of managed type string
|
||||
/// myLVGROUP.CchDescriptionTop // is of managed type uint
|
||||
/// myLVGROUP.PszDescriptionBottom // is of managed type string
|
||||
/// myLVGROUP.CchDescriptionBottom // is of managed type uint
|
||||
/// myLVGROUP.ITitleImage // is of managed type int
|
||||
/// myLVGROUP.IExtendedImage // is of managed type int
|
||||
/// myLVGROUP.IFirstItem // is of managed type int
|
||||
/// myLVGROUP.CItems // is of managed type IntPtr
|
||||
/// myLVGROUP.PszSubsetTitle // is of managed type IntPtr
|
||||
/// myLVGROUP.CchSubsetTitle // is of managed type IntPtr
|
||||
/// </example>
|
||||
/// <remarks>
|
||||
/// The LVGROUP structure was created by Paw Jershauge
|
||||
/// Created: Jan. 2008.
|
||||
/// The LVGROUP structure code is based on information from Microsoft's MSDN2 website.
|
||||
/// The structure is generated via an automated converter and is as is.
|
||||
/// The structure may or may not hold errors inside the code, so use at own risk.
|
||||
/// Reference url: http://msdn.microsoft.com/en-us/library/bb774769(VS.85).aspx
|
||||
/// </remarks>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode), Description("LVGROUP StructureUsed to set and retrieve groups.")]
|
||||
public struct LVGROUP
|
||||
{
|
||||
/// <summary>
|
||||
/// Size of this structure, in bytes.
|
||||
/// </summary>
|
||||
[Description("Size of this structure, in bytes.")]
|
||||
public int CbSize;
|
||||
|
||||
/// <summary>
|
||||
/// Mask that specifies which members of the structure are valid input. One or more of the following values:LVGF_NONENo other items are valid.
|
||||
/// </summary>
|
||||
[Description("Mask that specifies which members of the structure are valid input. One or more of the following values:LVGF_NONE No other items are valid.")]
|
||||
public ListViewGroupMask Mask;
|
||||
|
||||
/// <summary>
|
||||
/// Pointer to a null-terminated string that contains the header text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the header text.
|
||||
/// </summary>
|
||||
[Description("Pointer to a null-terminated string that contains the header text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the header text.")]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string PszHeader;
|
||||
|
||||
/// <summary>
|
||||
/// Size in TCHARs of the buffer pointed to by the pszHeader member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Size in TCHARs of the buffer pointed to by the pszHeader member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public int CchHeader;
|
||||
|
||||
/// <summary>
|
||||
/// Pointer to a null-terminated string that contains the footer text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the footer text.
|
||||
/// </summary>
|
||||
[Description("Pointer to a null-terminated string that contains the footer text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the footer text.")]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string PszFooter;
|
||||
|
||||
/// <summary>
|
||||
/// Size in TCHARs of the buffer pointed to by the pszFooter member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Size in TCHARs of the buffer pointed to by the pszFooter member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public int CchFooter;
|
||||
|
||||
/// <summary>
|
||||
/// ID of the group.
|
||||
/// </summary>
|
||||
[Description("ID of the group.")]
|
||||
public int IGroupId;
|
||||
|
||||
/// <summary>
|
||||
/// Mask used with LVM_GETGROUPINFO (Microsoft Windows XP and Windows Vista) and LVM_SETGROUPINFO (Windows Vista only) to specify which flags in the state value are being retrieved or set.
|
||||
/// </summary>
|
||||
[Description("Mask used with LVM_GETGROUPINFO (Microsoft Windows XP and Windows Vista) and LVM_SETGROUPINFO (Windows Vista only) to specify which flags in the state value are being retrieved or set.")]
|
||||
public int StateMask;
|
||||
|
||||
/// <summary>
|
||||
/// Flag that can have one of the following values:LVGS_NORMALGroups are expanded, the group name is displayed, and all items in the group are displayed.
|
||||
/// </summary>
|
||||
[Description("Flag that can have one of the following values:LVGS_NORMAL Groups are expanded, the group name is displayed, and all items in the group are displayed.")]
|
||||
public ListViewGroupState State;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the alignment of the header or footer text for the group. It can have one or more of the following values. Use one of the header flags. Footer flags are optional. Windows XP: Footer flags are reserved.LVGA_FOOTER_CENTERReserved.
|
||||
/// </summary>
|
||||
[Description("Indicates the alignment of the header or footer text for the group. It can have one or more of the following values. Use one of the header flags. Footer flags are optional. Windows XP: Footer flags are reserved.LVGA_FOOTER_CENTERReserved.")]
|
||||
public uint UAlign;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Pointer to a null-terminated string that contains the subtitle text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the subtitle text. This element is drawn under the header text.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Pointer to a null-terminated string that contains the subtitle text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the subtitle text. This element is drawn under the header text.")]
|
||||
public IntPtr PszSubtitle;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Size, in TCHARs, of the buffer pointed to by the pszSubtitle member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Size, in TCHARs, of the buffer pointed to by the pszSubtitle member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public uint CchSubtitle;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Pointer to a null-terminated string that contains the text for a task link when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the task text. This item is drawn right-aligned opposite the header text. When clicked by the user, the task link generates an LVN_LINKCLICK notification.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Pointer to a null-terminated string that contains the text for a task link when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the task text. This item is drawn right-aligned opposite the header text. When clicked by the user, the task link generates an LVN_LINKCLICK notification.")]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string PszTask;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Size in TCHARs of the buffer pointed to by the pszTask member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Size in TCHARs of the buffer pointed to by the pszTask member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public uint CchTask;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Pointer to a null-terminated string that contains the top description text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the top description text. This item is drawn opposite the title image when there is a title image, no extended image, and uAlign==LVGA_HEADER_CENTER.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Pointer to a null-terminated string that contains the top description text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the top description text. This item is drawn opposite the title image when there is a title image, no extended image, and uAlign==LVGA_HEADER_CENTER.")]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string PszDescriptionTop;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Size in TCHARs of the buffer pointed to by the pszDescriptionTop member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Size in TCHARs of the buffer pointed to by the pszDescriptionTop member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public uint CchDescriptionTop;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Pointer to a null-terminated string that contains the bottom description text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the bottom description text. This item is drawn under the top description text when there is a title image, no extended image, and uAlign==LVGA_HEADER_CENTER.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Pointer to a null-terminated string that contains the bottom description text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the bottom description text. This item is drawn under the top description text when there is a title image, no extended image, and uAlign==LVGA_HEADER_CENTER.")]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string PszDescriptionBottom;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Size in TCHARs of the buffer pointed to by the pszDescriptionBottom member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Size in TCHARs of the buffer pointed to by the pszDescriptionBottom member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public uint CchDescriptionBottom;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Index of the title image in the control imagelist.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Index of the title image in the control imagelist.")]
|
||||
public int ITitleImage;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Index of the extended image in the control imagelist.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Index of the extended image in the control imagelist.")]
|
||||
public int IExtendedImage;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Read-only.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Read-only.")]
|
||||
public int IFirstItem;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Read-only in non-owner data mode.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Read-only in non-owner data mode.")]
|
||||
public IntPtr CItems;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. NULL if group is not a subset. Pointer to a null-terminated string that contains the subset title text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the subset title text.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. NULL if group is not a subset. Pointer to a null-terminated string that contains the subset title text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the subset title text.")]
|
||||
public IntPtr PszSubsetTitle;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Size in TCHARs of the buffer pointed to by the pszSubsetTitle member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Size in TCHARs of the buffer pointed to by the pszSubsetTitle member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public IntPtr CchSubsetTitle;
|
||||
}
|
||||
|
||||
public class GroupStateChangedEventArgs : EventArgs
|
||||
{
|
||||
public ListViewGroup Group { get; set; }
|
||||
public bool IsCollapsed { get; set; }
|
||||
public ListViewGroupState NewState { get; set; }
|
||||
}
|
||||
|
||||
public enum ListViewGroupMask
|
||||
{
|
||||
None = 0x00000,
|
||||
Header = 0x00001,
|
||||
Footer = 0x00002,
|
||||
State = 0x00004,
|
||||
Align = 0x00008,
|
||||
GroupId = 0x00010,
|
||||
SubTitle = 0x00100,
|
||||
Task = 0x00200,
|
||||
DescriptionTop = 0x00400,
|
||||
DescriptionBottom = 0x00800,
|
||||
TitleImage = 0x01000,
|
||||
ExtendedImage = 0x02000,
|
||||
Items = 0x04000,
|
||||
Subset = 0x08000,
|
||||
SubsetItems = 0x10000
|
||||
}
|
||||
|
||||
public enum ListViewGroupState
|
||||
{
|
||||
/// <summary>
|
||||
/// Groups are expanded, the group name is displayed, and all items in the group are displayed.
|
||||
/// </summary>
|
||||
Normal = 0,
|
||||
/// <summary>
|
||||
/// The group is collapsed.
|
||||
/// </summary>
|
||||
Collapsed = 1,
|
||||
/// <summary>
|
||||
/// The group is hidden.
|
||||
/// </summary>
|
||||
Hidden = 2,
|
||||
/// <summary>
|
||||
/// Version 6.00 and Windows Vista. The group does not display a header.
|
||||
/// </summary>
|
||||
NoHeader = 4,
|
||||
/// <summary>
|
||||
/// Version 6.00 and Windows Vista. The group can be collapsed.
|
||||
/// </summary>
|
||||
Collapsible = 8,
|
||||
/// <summary>
|
||||
/// Version 6.00 and Windows Vista. The group has keyboard focus.
|
||||
/// </summary>
|
||||
Focused = 16,
|
||||
/// <summary>
|
||||
/// Version 6.00 and Windows Vista. The group is selected.
|
||||
/// </summary>
|
||||
Selected = 32,
|
||||
/// <summary>
|
||||
/// Version 6.00 and Windows Vista. The group displays only a portion of its items.
|
||||
/// </summary>
|
||||
SubSeted = 64,
|
||||
/// <summary>
|
||||
/// Version 6.00 and Windows Vista. The subset link of the group has keyboard focus.
|
||||
/// </summary>
|
||||
SubSetLinkFocused = 128,
|
||||
}
|
||||
|
||||
// Required structures for the notification
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NMHDR
|
||||
{
|
||||
public IntPtr hwndFrom;
|
||||
public UIntPtr idFrom;
|
||||
public int code;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NMLVGROUP
|
||||
{
|
||||
public NMHDR hdr;
|
||||
public int iGroupId;
|
||||
public uint uNewState;
|
||||
public uint uOldState;
|
||||
public int state; // Current state
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -344,7 +344,8 @@ namespace nspector.Native.NVAPI2
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode)]
|
||||
internal struct NVDRS_APPLICATION_V3
|
||||
{
|
||||
public uint isMetro { get { return ((uint)((bitvector1 & 1))); } set { bitvector1 = ((uint)((value | bitvector1))); } }
|
||||
public bool isMetro { get { return (bitvector1 & 1) != 0; } set { if (value) bitvector1 |= 1; else bitvector1 &= ~1u; } }
|
||||
public bool isCommandLine { get { return (bitvector1 & 2) != 0; } set { if (value) bitvector1 |= 2; else bitvector1 &= ~2u; } }
|
||||
|
||||
public uint version;
|
||||
public uint isPredefined;
|
||||
@@ -359,6 +360,27 @@ namespace nspector.Native.NVAPI2
|
||||
private uint bitvector1;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode)]
|
||||
internal struct NVDRS_APPLICATION_V4
|
||||
{
|
||||
public bool isMetro { get { return (bitvector1 & 1) != 0; } set { if (value) bitvector1 |= 1; else bitvector1 &= ~1u; } }
|
||||
public bool isCommandLine { get { return (bitvector1 & 2) != 0; } set { if (value) bitvector1 |= 2; else bitvector1 &= ~2u; } }
|
||||
|
||||
public uint version;
|
||||
public uint isPredefined;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
public string appName;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
public string userFriendlyName;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
public string launcher;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
public string fileInFolder;
|
||||
private uint bitvector1;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
public string commandLine;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode)]
|
||||
internal struct NVDRS_PROFILE
|
||||
{
|
||||
@@ -388,7 +410,8 @@ namespace nspector.Native.NVAPI2
|
||||
public static uint NVDRS_APPLICATION_VER_V1 = MAKE_NVAPI_VERSION<NVDRS_APPLICATION_V1>(1);
|
||||
public static uint NVDRS_APPLICATION_VER_V2 = MAKE_NVAPI_VERSION<NVDRS_APPLICATION_V2>(2);
|
||||
public static uint NVDRS_APPLICATION_VER_V3 = MAKE_NVAPI_VERSION<NVDRS_APPLICATION_V3>(3);
|
||||
public static uint NVDRS_APPLICATION_VER = NVDRS_APPLICATION_VER_V3;
|
||||
public static uint NVDRS_APPLICATION_VER_V4 = MAKE_NVAPI_VERSION<NVDRS_APPLICATION_V4>(4);
|
||||
public static uint NVDRS_APPLICATION_VER = NVDRS_APPLICATION_VER_V4;
|
||||
public static uint NVDRS_PROFILE_VER = MAKE_NVAPI_VERSION<NVDRS_PROFILE>(1);
|
||||
|
||||
public const uint OGL_IMPLICIT_GPU_AFFINITY_NUM_VALUES = 1;
|
||||
@@ -424,13 +447,17 @@ namespace nspector.Native.NVAPI2
|
||||
}
|
||||
}
|
||||
|
||||
private static void GetDelegate<T>(uint id, out T newDelegate) where T : class
|
||||
private static void GetDelegate<T>(uint id, out T newDelegate, uint? fallbackId = null) where T : class
|
||||
{
|
||||
IntPtr ptr = nvapi_QueryInterface(id);
|
||||
if (ptr != IntPtr.Zero)
|
||||
{
|
||||
newDelegate = Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T;
|
||||
}
|
||||
else if (fallbackId.HasValue)
|
||||
{
|
||||
GetDelegate(fallbackId.Value, out newDelegate);
|
||||
}
|
||||
else
|
||||
{
|
||||
newDelegate = null;
|
||||
@@ -545,11 +572,11 @@ namespace nspector.Native.NVAPI2
|
||||
public static readonly DRS_GetNumProfilesDelegate DRS_GetNumProfiles;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate NvAPI_Status DRS_CreateApplicationDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_APPLICATION_V3 pApplication);
|
||||
public delegate NvAPI_Status DRS_CreateApplicationDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_APPLICATION_V4 pApplication);
|
||||
public static readonly DRS_CreateApplicationDelegate DRS_CreateApplication;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate NvAPI_Status DRS_DeleteApplicationExDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_APPLICATION_V3 pApp);
|
||||
public delegate NvAPI_Status DRS_DeleteApplicationExDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_APPLICATION_V4 pApp);
|
||||
public static readonly DRS_DeleteApplicationExDelegate DRS_DeleteApplicationEx;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
@@ -557,7 +584,7 @@ namespace nspector.Native.NVAPI2
|
||||
public static readonly DRS_DeleteApplicationDelegate DRS_DeleteApplication;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate NvAPI_Status DRS_GetApplicationInfoDelegate(IntPtr hSession, IntPtr hProfile, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName, ref NVDRS_APPLICATION_V3 pApplication);
|
||||
public delegate NvAPI_Status DRS_GetApplicationInfoDelegate(IntPtr hSession, IntPtr hProfile, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName, ref NVDRS_APPLICATION_V4 pApplication);
|
||||
public static readonly DRS_GetApplicationInfoDelegate DRS_GetApplicationInfo;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
@@ -583,16 +610,28 @@ namespace nspector.Native.NVAPI2
|
||||
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate NvAPI_Status DRS_FindApplicationByNameDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName, ref IntPtr phProfile, ref NVDRS_APPLICATION_V3 pApplication);
|
||||
public delegate NvAPI_Status DRS_FindApplicationByNameDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName, ref IntPtr phProfile, ref NVDRS_APPLICATION_V4 pApplication);
|
||||
public static readonly DRS_FindApplicationByNameDelegate DRS_FindApplicationByName;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate NvAPI_Status DRS_SetSettingDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_SETTING pSetting);
|
||||
public static readonly DRS_SetSettingDelegate DRS_SetSetting;
|
||||
public static NvAPI_Status DRS_SetSetting(IntPtr hSession, IntPtr hProfile, ref NVDRS_SETTING pSetting)
|
||||
{
|
||||
return _DRS_SetSetting(hSession, hProfile, ref pSetting, 0, 0);
|
||||
}
|
||||
|
||||
public static NvAPI_Status DRS_GetSetting(IntPtr hSession, IntPtr hProfile, uint settingId, ref NVDRS_SETTING pSetting)
|
||||
{
|
||||
uint x = 0;
|
||||
return _DRS_GetSetting(hSession, hProfile, settingId, ref pSetting, ref x);
|
||||
}
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate NvAPI_Status DRS_GetSettingDelegate(IntPtr hSession, IntPtr hProfile, uint settingId, ref NVDRS_SETTING pSetting);
|
||||
public static readonly DRS_GetSettingDelegate DRS_GetSetting;
|
||||
public delegate NvAPI_Status DRS_SetSettingDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_SETTING pSetting, uint x, uint y);
|
||||
private static readonly DRS_SetSettingDelegate _DRS_SetSetting;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate NvAPI_Status DRS_GetSettingDelegate(IntPtr hSession, IntPtr hProfile, uint settingId, ref NVDRS_SETTING pSetting, ref uint x);
|
||||
private static readonly DRS_GetSettingDelegate _DRS_GetSetting;
|
||||
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate NvAPI_Status DRS_EnumSettingsDelegate(IntPtr hSession, IntPtr hProfile, uint startIndex, ref uint settingsCount, IntPtr pSetting);
|
||||
@@ -728,20 +767,19 @@ namespace nspector.Native.NVAPI2
|
||||
GetDelegate(0xED1F8C69, out DRS_GetApplicationInfo);
|
||||
GetDelegate(0x7FA2173A, out DRS_EnumApplicationsInternal);
|
||||
GetDelegate(0xEEE566B2, out DRS_FindApplicationByName);
|
||||
GetDelegate(0x577DD202, out DRS_SetSetting);
|
||||
GetDelegate(0x73BF8338, out DRS_GetSetting);
|
||||
GetDelegate(0xAE3039DA, out DRS_EnumSettingsInternal);
|
||||
GetDelegate(0xF020614A, out DRS_EnumAvailableSettingIdsInternal);
|
||||
GetDelegate(0x8A2CF5F5, out _DRS_SetSetting, 0x577DD202);
|
||||
GetDelegate(0xEA99498D, out _DRS_GetSetting, 0x73BF8338);
|
||||
GetDelegate(0xCFD6983E, out DRS_EnumSettingsInternal, 0xAE3039DA);
|
||||
GetDelegate(0xE5DE48E5, out DRS_EnumAvailableSettingIdsInternal, 0xF020614A);
|
||||
GetDelegate(0x2EC39F90, out DRS_EnumAvailableSettingValuesInternal);
|
||||
GetDelegate(0xCB7309CD, out DRS_GetSettingIdFromName);
|
||||
GetDelegate(0xD61CBE6E, out DRS_GetSettingNameFromId);
|
||||
GetDelegate(0xE4A26362, out DRS_DeleteProfileSetting);
|
||||
GetDelegate(0x1EB13791, out DRS_GetSettingNameFromId, 0xD61CBE6E);
|
||||
GetDelegate(0xD20D29DF, out DRS_DeleteProfileSetting, 0xE4A26362);
|
||||
GetDelegate(0x5927B094, out DRS_RestoreAllDefaults);
|
||||
GetDelegate(0xFA5F6134, out DRS_RestoreProfileDefault);
|
||||
GetDelegate(0x53F0381E, out DRS_RestoreProfileDefaultSetting);
|
||||
GetDelegate(0x7DD5B261, out DRS_RestoreProfileDefaultSetting, 0x53F0381E);
|
||||
GetDelegate(0xDA8466A0, out DRS_GetBaseProfile);
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Native
|
||||
{
|
||||
@@ -51,6 +49,6 @@ namespace nspector.Native
|
||||
targetPointer = Marshal.AllocHGlobal(sizeOfItem);
|
||||
Marshal.StructureToPtr(item, targetPointer, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ namespace nspector.Native.WINAPI
|
||||
internal string lpData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
internal struct WINDOWPLACEMENT
|
||||
{
|
||||
internal int length;
|
||||
@@ -301,7 +301,7 @@ namespace nspector.Native.WINAPI
|
||||
internal bool bringAppToFront(int hWnd)
|
||||
{
|
||||
WINDOWPLACEMENT param = new WINDOWPLACEMENT();
|
||||
if (GetWindowPlacement(hWnd,ref param))
|
||||
if (GetWindowPlacement(hWnd, ref param))
|
||||
{
|
||||
if (param.showCmd != SW_NORMAL)
|
||||
{
|
||||
@@ -312,7 +312,7 @@ namespace nspector.Native.WINAPI
|
||||
}
|
||||
return SetForegroundWindow(hWnd);
|
||||
}
|
||||
|
||||
|
||||
internal int sendWindowsStringMessage(int hWnd, int wParam, string msg)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace nspector.Native.WINAPI
|
||||
private class NativeMethods
|
||||
{
|
||||
[DllImport("Shell32", CharSet = CharSet.Auto)]
|
||||
internal extern static int ExtractIconEx([MarshalAs(UnmanagedType.LPTStr)]
|
||||
internal extern static int ExtractIconEx([MarshalAs(UnmanagedType.LPTStr)]
|
||||
string lpszFile,
|
||||
int nIconIndex,
|
||||
IntPtr[] phIconLarge,
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace nspector.Native.WINAPI
|
||||
THBF_NOBACKGROUND = 0x0004,
|
||||
THBF_HIDDEN = 0x0008
|
||||
}
|
||||
|
||||
|
||||
[Flags]
|
||||
internal enum THB
|
||||
{
|
||||
@@ -37,18 +37,18 @@ namespace nspector.Native.WINAPI
|
||||
}
|
||||
|
||||
internal enum TBPFLAG
|
||||
{
|
||||
TBPF_NOPROGRESS = 0,
|
||||
TBPF_INDETERMINATE = 0x1,
|
||||
TBPF_NORMAL = 0x2,
|
||||
TBPF_ERROR = 0x4,
|
||||
TBPF_PAUSED = 0x8
|
||||
{
|
||||
TBPF_NOPROGRESS = 0,
|
||||
TBPF_INDETERMINATE = 0x1,
|
||||
TBPF_NORMAL = 0x2,
|
||||
TBPF_ERROR = 0x4,
|
||||
TBPF_PAUSED = 0x8
|
||||
}
|
||||
|
||||
internal enum TBATFLAG
|
||||
{
|
||||
TBATF_USEMDITHUMBNAIL = 0x1,
|
||||
TBATF_USEMDILIVEPREVIEW = 0x2
|
||||
{
|
||||
TBATF_USEMDITHUMBNAIL = 0x1,
|
||||
TBATF_USEMDILIVEPREVIEW = 0x2
|
||||
}
|
||||
|
||||
[ComImport,
|
||||
@@ -57,7 +57,7 @@ namespace nspector.Native.WINAPI
|
||||
internal interface ITaskbarList3
|
||||
{
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
MethodCodeType = MethodCodeType.Runtime)]
|
||||
void HrInit();
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace nspector.Native.WINAPI
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
MethodCodeType = MethodCodeType.Runtime)]
|
||||
void MarkFullscreenWindow([In] IntPtr hwnd,
|
||||
void MarkFullscreenWindow([In] IntPtr hwnd,
|
||||
[In, MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
@@ -87,8 +87,8 @@ namespace nspector.Native.WINAPI
|
||||
void SetProgressValue([In] IntPtr hwnd,
|
||||
[In] ulong ullCompleted,
|
||||
[In] ulong ullTotal);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
MethodCodeType = MethodCodeType.Runtime)]
|
||||
void SetProgressState([In] IntPtr hwnd,
|
||||
[In] TBPFLAG tbpFlags);
|
||||
@@ -120,7 +120,7 @@ namespace nspector.Native.WINAPI
|
||||
[In] uint cButtons,
|
||||
[In] IntPtr pButton);
|
||||
///* [size_is][in] */ __RPC__in_ecount_full(cButtons) LPTHUMBBUTTON pButton);
|
||||
|
||||
|
||||
//preliminary
|
||||
[MethodImpl(MethodImplOptions.InternalCall,
|
||||
MethodCodeType = MethodCodeType.Runtime)]
|
||||
@@ -150,7 +150,7 @@ namespace nspector.Native.WINAPI
|
||||
MethodCodeType = MethodCodeType.Runtime)]
|
||||
void SetThumbnailClip([In] IntPtr hwnd,
|
||||
[In] IntPtr prcClip);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using nspector.Common;
|
||||
using nspector.Common.Import;
|
||||
using nspector.Common.Helper;
|
||||
using nspector.Native.WINAPI;
|
||||
|
||||
namespace nspector
|
||||
@@ -29,12 +29,13 @@ namespace nspector
|
||||
#endif
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
DropDownMenuScrollWheelHandler.Enable(true);
|
||||
|
||||
var argFileIndex = ArgFileIndex(args);
|
||||
if (argFileIndex != -1)
|
||||
{
|
||||
|
||||
if (new FileInfo(args[argFileIndex]).Extension.ToLower() == ".nip")
|
||||
if (new FileInfo(args[argFileIndex]).Extension.ToLowerInvariant() == ".nip")
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NVIDIA Profile Inspector")]
|
||||
[assembly: AssemblyCopyright("©2020 by Orbmu2k")]
|
||||
[assembly: AssemblyCopyright("©2025 by Orbmu2k")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -32,7 +32,7 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.3.0.0")]
|
||||
[assembly: AssemblyFileVersion("2.3.0.0")]
|
||||
[assembly: AssemblyVersion("2.4.0.1")]
|
||||
[assembly: AssemblyFileVersion("2.4.0.1")]
|
||||
|
||||
|
||||
|
||||
26
nspector/Properties/Resources.Designer.cs
generated
26
nspector/Properties/Resources.Designer.cs
generated
@@ -19,7 +19,7 @@ namespace nspector.Properties {
|
||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Resources {
|
||||
@@ -73,17 +73,19 @@ namespace nspector.Properties {
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die <?xml version="1.0" encoding="utf-8"?>
|
||||
///<CustomSettingNames>
|
||||
/// <ShowCustomizedSettingNamesOnly>false</ShowCustomizedSettingNamesOnly>
|
||||
/// <Settings>
|
||||
/// <CustomSetting>
|
||||
/// <UserfriendlyName>NVLINK SLI Mode</UserfriendlyName>
|
||||
/// <HexSettingID>0x00A06948</HexSettingID>
|
||||
/// <GroupName>6 - SLI</GroupName>
|
||||
/// <MinRequiredDriverVersion>410.00</MinRequiredDriverVersion>
|
||||
/// </CustomSetting>
|
||||
/// <CustomSetting>
|
||||
/// <UserfriendlyName>Texture filtering - Quality substitution</UserfriendlyName>
|
||||
/// [Rest der Zeichenfolge wurde abgeschnitten]"; ähnelt.
|
||||
/// <Settings>
|
||||
/// <CustomSetting>
|
||||
/// <UserfriendlyName>DLSS - Enable DLL Override</UserfriendlyName>
|
||||
/// <HexSettingID>0x10E41E01</HexSettingID>
|
||||
/// <GroupName>5 - Common</GroupName>
|
||||
/// <MinRequiredDriverVersion>0</MinRequiredDriverVersion>
|
||||
/// <SettingValues>
|
||||
/// <CustomSettingValue>
|
||||
/// <UserfriendlyName>Off</UserfriendlyName>
|
||||
/// <HexValue>0x00000000</HexValue>
|
||||
/// </CustomSettingValue>
|
||||
/// <CustomSettingValue>
|
||||
/// <UserfriendlyName>On [Rest der Zeichenfolge wurde abgeschnitten]"; ähnelt.
|
||||
/// </summary>
|
||||
public static string CustomSettingNames {
|
||||
get {
|
||||
|
||||
10421
nspector/Reference.xml
10421
nspector/Reference.xml
File diff suppressed because it is too large
Load Diff
34
nspector/WatermarkTextBox.cs
Normal file
34
nspector/WatermarkTextBox.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace nspector
|
||||
{
|
||||
public class WatermarkTextBox : TextBox
|
||||
{
|
||||
private const int WM_PAINT = 0x000F;
|
||||
|
||||
private string _watermarkText;
|
||||
[Category("Appearance")]
|
||||
public string WatermarkText
|
||||
{
|
||||
get => _watermarkText;
|
||||
set { _watermarkText = value; Invalidate(); }
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
base.WndProc(ref m);
|
||||
|
||||
if (m.Msg == WM_PAINT && string.IsNullOrEmpty(this.Text) && !string.IsNullOrEmpty(_watermarkText))
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
using (Brush brush = new SolidBrush(SystemColors.GrayText))
|
||||
{
|
||||
TextFormatFlags flags = TextFormatFlags.VerticalCenter | TextFormatFlags.Left;
|
||||
TextRenderer.DrawText(g, _watermarkText, this.Font, this.ClientRectangle, SystemColors.GrayText, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
nspector/app.config
Normal file
3
nspector/app.config
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1"/></startup></configuration>
|
||||
65
nspector/frmBitEditor.Designer.cs
generated
65
nspector/frmBitEditor.Designer.cs
generated
@@ -49,10 +49,10 @@
|
||||
// btnClose
|
||||
//
|
||||
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnClose.Location = new System.Drawing.Point(914, 806);
|
||||
this.btnClose.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnClose.Location = new System.Drawing.Point(731, 645);
|
||||
this.btnClose.Name = "btnClose";
|
||||
this.btnClose.Size = new System.Drawing.Size(132, 29);
|
||||
this.btnClose.Size = new System.Drawing.Size(106, 23);
|
||||
this.btnClose.TabIndex = 1;
|
||||
this.btnClose.Text = "Apply && Close";
|
||||
this.btnClose.UseVisualStyleBackColor = true;
|
||||
@@ -62,10 +62,9 @@
|
||||
//
|
||||
this.lValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lValue.AutoSize = true;
|
||||
this.lValue.Location = new System.Drawing.Point(21, 813);
|
||||
this.lValue.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lValue.Location = new System.Drawing.Point(17, 650);
|
||||
this.lValue.Name = "lValue";
|
||||
this.lValue.Size = new System.Drawing.Size(48, 17);
|
||||
this.lValue.Size = new System.Drawing.Size(37, 13);
|
||||
this.lValue.TabIndex = 2;
|
||||
this.lValue.Text = "Value:";
|
||||
//
|
||||
@@ -73,10 +72,9 @@
|
||||
//
|
||||
this.lFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lFilter.AutoSize = true;
|
||||
this.lFilter.Location = new System.Drawing.Point(187, 813);
|
||||
this.lFilter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lFilter.Location = new System.Drawing.Point(150, 650);
|
||||
this.lFilter.Name = "lFilter";
|
||||
this.lFilter.Size = new System.Drawing.Size(87, 17);
|
||||
this.lFilter.Size = new System.Drawing.Size(64, 13);
|
||||
this.lFilter.TabIndex = 23;
|
||||
this.lFilter.Text = "Profile Filter:";
|
||||
//
|
||||
@@ -84,20 +82,18 @@
|
||||
//
|
||||
this.tbFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tbFilter.Location = new System.Drawing.Point(274, 809);
|
||||
this.tbFilter.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.tbFilter.Location = new System.Drawing.Point(219, 647);
|
||||
this.tbFilter.Name = "tbFilter";
|
||||
this.tbFilter.Size = new System.Drawing.Size(632, 22);
|
||||
this.tbFilter.Size = new System.Drawing.Size(506, 20);
|
||||
this.tbFilter.TabIndex = 24;
|
||||
this.tbFilter.TextChanged += new System.EventHandler(this.tbFilter_TextChanged);
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.textBox1.Location = new System.Drawing.Point(74, 809);
|
||||
this.textBox1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.textBox1.Location = new System.Drawing.Point(59, 647);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(86, 22);
|
||||
this.textBox1.Size = new System.Drawing.Size(70, 20);
|
||||
this.textBox1.TabIndex = 31;
|
||||
this.textBox1.Text = "0x00FF00FF";
|
||||
this.textBox1.Leave += new System.EventHandler(this.textBox1_Leave);
|
||||
@@ -106,10 +102,9 @@
|
||||
// btnDirectApplyStart
|
||||
//
|
||||
this.btnDirectApplyStart.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnDirectApplyStart.Location = new System.Drawing.Point(6, 19);
|
||||
this.btnDirectApplyStart.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.btnDirectApplyStart.Location = new System.Drawing.Point(5, 15);
|
||||
this.btnDirectApplyStart.Name = "btnDirectApplyStart";
|
||||
this.btnDirectApplyStart.Size = new System.Drawing.Size(105, 42);
|
||||
this.btnDirectApplyStart.Size = new System.Drawing.Size(84, 34);
|
||||
this.btnDirectApplyStart.TabIndex = 32;
|
||||
this.btnDirectApplyStart.Text = "GO!";
|
||||
this.btnDirectApplyStart.UseVisualStyleBackColor = true;
|
||||
@@ -123,11 +118,9 @@
|
||||
this.gbDirectTest.Controls.Add(this.tbGamePath);
|
||||
this.gbDirectTest.Controls.Add(this.lblGamePath);
|
||||
this.gbDirectTest.Controls.Add(this.btnDirectApplyStart);
|
||||
this.gbDirectTest.Location = new System.Drawing.Point(18, 733);
|
||||
this.gbDirectTest.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.gbDirectTest.Location = new System.Drawing.Point(14, 586);
|
||||
this.gbDirectTest.Name = "gbDirectTest";
|
||||
this.gbDirectTest.Padding = new System.Windows.Forms.Padding(4);
|
||||
this.gbDirectTest.Size = new System.Drawing.Size(1029, 66);
|
||||
this.gbDirectTest.Size = new System.Drawing.Size(823, 53);
|
||||
this.gbDirectTest.TabIndex = 33;
|
||||
this.gbDirectTest.TabStop = false;
|
||||
this.gbDirectTest.Text = "Quick Bit Value Tester (stores this setting value to the current profile and imme" +
|
||||
@@ -136,10 +129,9 @@
|
||||
// btnBrowseGame
|
||||
//
|
||||
this.btnBrowseGame.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnBrowseGame.Location = new System.Drawing.Point(971, 24);
|
||||
this.btnBrowseGame.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.btnBrowseGame.Location = new System.Drawing.Point(777, 19);
|
||||
this.btnBrowseGame.Name = "btnBrowseGame";
|
||||
this.btnBrowseGame.Size = new System.Drawing.Size(41, 29);
|
||||
this.btnBrowseGame.Size = new System.Drawing.Size(33, 23);
|
||||
this.btnBrowseGame.TabIndex = 35;
|
||||
this.btnBrowseGame.Text = "...";
|
||||
this.btnBrowseGame.UseVisualStyleBackColor = true;
|
||||
@@ -149,19 +141,17 @@
|
||||
//
|
||||
this.tbGamePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tbGamePath.Location = new System.Drawing.Point(218, 26);
|
||||
this.tbGamePath.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.tbGamePath.Location = new System.Drawing.Point(174, 21);
|
||||
this.tbGamePath.Name = "tbGamePath";
|
||||
this.tbGamePath.Size = new System.Drawing.Size(745, 22);
|
||||
this.tbGamePath.Size = new System.Drawing.Size(597, 20);
|
||||
this.tbGamePath.TabIndex = 34;
|
||||
//
|
||||
// lblGamePath
|
||||
//
|
||||
this.lblGamePath.AutoSize = true;
|
||||
this.lblGamePath.Location = new System.Drawing.Point(119, 29);
|
||||
this.lblGamePath.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblGamePath.Location = new System.Drawing.Point(95, 23);
|
||||
this.lblGamePath.Name = "lblGamePath";
|
||||
this.lblGamePath.Size = new System.Drawing.Size(98, 17);
|
||||
this.lblGamePath.Size = new System.Drawing.Size(73, 13);
|
||||
this.lblGamePath.TabIndex = 33;
|
||||
this.lblGamePath.Text = "Game to start:";
|
||||
//
|
||||
@@ -179,11 +169,13 @@
|
||||
this.clbBits.FullRowSelect = true;
|
||||
this.clbBits.GridLines = true;
|
||||
this.clbBits.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||
this.clbBits.Location = new System.Drawing.Point(12, 12);
|
||||
this.clbBits.HideSelection = false;
|
||||
this.clbBits.Location = new System.Drawing.Point(10, 10);
|
||||
this.clbBits.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.clbBits.MultiSelect = false;
|
||||
this.clbBits.Name = "clbBits";
|
||||
this.clbBits.ShowGroups = false;
|
||||
this.clbBits.Size = new System.Drawing.Size(1035, 714);
|
||||
this.clbBits.Size = new System.Drawing.Size(829, 572);
|
||||
this.clbBits.TabIndex = 34;
|
||||
this.clbBits.UseCompatibleStateImageBehavior = false;
|
||||
this.clbBits.View = System.Windows.Forms.View.Details;
|
||||
@@ -209,9 +201,9 @@
|
||||
//
|
||||
// frmBitEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.ClientSize = new System.Drawing.Size(1059, 847);
|
||||
this.ClientSize = new System.Drawing.Size(847, 678);
|
||||
this.Controls.Add(this.clbBits);
|
||||
this.Controls.Add(this.gbDirectTest);
|
||||
this.Controls.Add(this.textBox1);
|
||||
@@ -220,8 +212,7 @@
|
||||
this.Controls.Add(this.lValue);
|
||||
this.Controls.Add(this.btnClose);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.MinimumSize = new System.Drawing.Size(854, 609);
|
||||
this.MinimumSize = new System.Drawing.Size(686, 495);
|
||||
this.Name = "frmBitEditor";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Bit Value Editor";
|
||||
|
||||
@@ -52,12 +52,14 @@ namespace nspector
|
||||
var referenceSettings = DrsServiceLocator.ReferenceSettings?.Settings.FirstOrDefault(s => s.SettingId == _Settingid);
|
||||
|
||||
var settingsCache = DrsServiceLocator.ScannerService.CachedSettings.FirstOrDefault(x => x.SettingId == _Settingid);
|
||||
if (settingsCache != null)
|
||||
|
||||
for (int bit = 0; bit < 32; bit++)
|
||||
{
|
||||
for (int bit = 0; bit < 32; bit++)
|
||||
string profileNames = "";
|
||||
uint profileCount = 0;
|
||||
|
||||
if (settingsCache != null)
|
||||
{
|
||||
string profileNames = "";
|
||||
uint profileCount = 0;
|
||||
|
||||
for (int i = 0; i < settingsCache.SettingValues.Count; i++)
|
||||
{
|
||||
@@ -74,7 +76,7 @@ namespace nspector
|
||||
{
|
||||
for (int f = 0; f < filters.Length; f++)
|
||||
{
|
||||
if (settingProfileNames[p].ToLower().Contains(filters[f].ToLower()))
|
||||
if (settingProfileNames[p].ToLowerInvariant().Contains(filters[f].ToLower()))
|
||||
{
|
||||
profileNames += settingProfileNames[p] + ",";
|
||||
}
|
||||
@@ -84,31 +86,32 @@ namespace nspector
|
||||
profileCount += settingsCache.SettingValues[i].ValueProfileCount;
|
||||
}
|
||||
}
|
||||
|
||||
uint mask = (uint)1 << bit;
|
||||
string maskStr="";
|
||||
|
||||
if (referenceSettings != null)
|
||||
}
|
||||
|
||||
uint mask = (uint)1 << bit;
|
||||
string maskStr = "";
|
||||
|
||||
if (referenceSettings != null)
|
||||
{
|
||||
var maskValue = referenceSettings.SettingValues.FirstOrDefault(v => v.SettingValue == mask);
|
||||
if (maskValue != null)
|
||||
{
|
||||
var maskValue = referenceSettings.SettingValues.FirstOrDefault(v => v.SettingValue == mask);
|
||||
if (maskValue != null)
|
||||
maskStr = maskValue.UserfriendlyName;
|
||||
if (maskStr.Contains("("))
|
||||
{
|
||||
maskStr = maskValue.UserfriendlyName;
|
||||
if (maskStr.Contains("("))
|
||||
{
|
||||
maskStr = maskStr.Substring(0, maskStr.IndexOf("(") - 1);
|
||||
}
|
||||
maskStr = maskStr.Substring(0, maskStr.IndexOf("(") - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clbBits.Items.Add(new ListViewItem(new string[] {
|
||||
clbBits.Items.Add(new ListViewItem(new string[] {
|
||||
string.Format("#{0:00}",bit),
|
||||
maskStr,
|
||||
profileCount.ToString(),
|
||||
profileNames,
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
SetValue(lastValue);
|
||||
|
||||
185
nspector/frmDrvSettings.Designer.cs
generated
185
nspector/frmDrvSettings.Designer.cs
generated
@@ -75,7 +75,11 @@
|
||||
this.chSettingID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chSettingValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chSettingValueHex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.tbSettingDescription = new System.Windows.Forms.TextBox();
|
||||
this.pnlListview = new System.Windows.Forms.Panel();
|
||||
this.txtFilter = new nspector.WatermarkTextBox();
|
||||
this.tsMain.SuspendLayout();
|
||||
this.pnlListview.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ilListView
|
||||
@@ -89,18 +93,18 @@
|
||||
//
|
||||
// pbMain
|
||||
//
|
||||
this.pbMain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.pbMain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pbMain.Location = new System.Drawing.Point(16, 585);
|
||||
this.pbMain.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.pbMain.Location = new System.Drawing.Point(12, 475);
|
||||
this.pbMain.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.pbMain.Name = "pbMain";
|
||||
this.pbMain.Size = new System.Drawing.Size(1120, 11);
|
||||
this.pbMain.Size = new System.Drawing.Size(840, 9);
|
||||
this.pbMain.TabIndex = 19;
|
||||
//
|
||||
// tsMain
|
||||
//
|
||||
this.tsMain.AllowMerge = false;
|
||||
this.tsMain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.tsMain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tsMain.AutoSize = false;
|
||||
this.tsMain.BackgroundImage = global::nspector.Properties.Resources.transparent16;
|
||||
@@ -132,10 +136,10 @@
|
||||
this.tsSep6,
|
||||
this.tsbApplyProfile});
|
||||
this.tsMain.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
|
||||
this.tsMain.Location = new System.Drawing.Point(16, 5);
|
||||
this.tsMain.Location = new System.Drawing.Point(12, 4);
|
||||
this.tsMain.Name = "tsMain";
|
||||
this.tsMain.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
|
||||
this.tsMain.Size = new System.Drawing.Size(1120, 31);
|
||||
this.tsMain.Size = new System.Drawing.Size(840, 25);
|
||||
this.tsMain.TabIndex = 24;
|
||||
this.tsMain.Text = "toolStrip1";
|
||||
//
|
||||
@@ -144,7 +148,7 @@
|
||||
this.tslProfiles.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
this.tslProfiles.Margin = new System.Windows.Forms.Padding(0, 5, 10, 2);
|
||||
this.tslProfiles.Name = "tslProfiles";
|
||||
this.tslProfiles.Size = new System.Drawing.Size(61, 24);
|
||||
this.tslProfiles.Size = new System.Drawing.Size(49, 18);
|
||||
this.tslProfiles.Text = "Profiles:";
|
||||
//
|
||||
// cbProfiles
|
||||
@@ -156,7 +160,7 @@
|
||||
this.cbProfiles.Margin = new System.Windows.Forms.Padding(1);
|
||||
this.cbProfiles.MaxDropDownItems = 50;
|
||||
this.cbProfiles.Name = "cbProfiles";
|
||||
this.cbProfiles.Size = new System.Drawing.Size(385, 28);
|
||||
this.cbProfiles.Size = new System.Drawing.Size(290, 23);
|
||||
this.cbProfiles.SelectedIndexChanged += new System.EventHandler(this.cbProfiles_SelectedIndexChanged);
|
||||
this.cbProfiles.TextChanged += new System.EventHandler(this.cbProfiles_TextChanged);
|
||||
//
|
||||
@@ -167,7 +171,7 @@
|
||||
this.tsbModifiedProfiles.Image = global::nspector.Properties.Resources.home_sm;
|
||||
this.tsbModifiedProfiles.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbModifiedProfiles.Name = "tsbModifiedProfiles";
|
||||
this.tsbModifiedProfiles.Size = new System.Drawing.Size(39, 28);
|
||||
this.tsbModifiedProfiles.Size = new System.Drawing.Size(36, 22);
|
||||
this.tsbModifiedProfiles.TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay;
|
||||
this.tsbModifiedProfiles.ToolTipText = "Back to global profile (Home) / User modified profiles";
|
||||
this.tsbModifiedProfiles.ButtonClick += new System.EventHandler(this.tsbModifiedProfiles_ButtonClick);
|
||||
@@ -176,7 +180,7 @@
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 31);
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// tsbRefreshProfile
|
||||
//
|
||||
@@ -184,7 +188,7 @@
|
||||
this.tsbRefreshProfile.Image = ((System.Drawing.Image)(resources.GetObject("tsbRefreshProfile.Image")));
|
||||
this.tsbRefreshProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbRefreshProfile.Name = "tsbRefreshProfile";
|
||||
this.tsbRefreshProfile.Size = new System.Drawing.Size(24, 28);
|
||||
this.tsbRefreshProfile.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbRefreshProfile.Text = "Refresh current profile.";
|
||||
this.tsbRefreshProfile.Click += new System.EventHandler(this.tsbRefreshProfile_Click);
|
||||
//
|
||||
@@ -194,7 +198,7 @@
|
||||
this.tsbRestoreProfile.Image = ((System.Drawing.Image)(resources.GetObject("tsbRestoreProfile.Image")));
|
||||
this.tsbRestoreProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbRestoreProfile.Name = "tsbRestoreProfile";
|
||||
this.tsbRestoreProfile.Size = new System.Drawing.Size(24, 28);
|
||||
this.tsbRestoreProfile.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbRestoreProfile.Text = "Restore current profile to NVIDIA defaults.";
|
||||
this.tsbRestoreProfile.Click += new System.EventHandler(this.tsbRestoreProfile_Click);
|
||||
//
|
||||
@@ -204,7 +208,7 @@
|
||||
this.tsbCreateProfile.Image = ((System.Drawing.Image)(resources.GetObject("tsbCreateProfile.Image")));
|
||||
this.tsbCreateProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbCreateProfile.Name = "tsbCreateProfile";
|
||||
this.tsbCreateProfile.Size = new System.Drawing.Size(24, 28);
|
||||
this.tsbCreateProfile.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbCreateProfile.Text = "Create new profile";
|
||||
this.tsbCreateProfile.Click += new System.EventHandler(this.tsbCreateProfile_Click);
|
||||
//
|
||||
@@ -214,14 +218,14 @@
|
||||
this.tsbDeleteProfile.Image = global::nspector.Properties.Resources.ieframe_1_18212;
|
||||
this.tsbDeleteProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbDeleteProfile.Name = "tsbDeleteProfile";
|
||||
this.tsbDeleteProfile.Size = new System.Drawing.Size(24, 28);
|
||||
this.tsbDeleteProfile.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbDeleteProfile.Text = "Delete current Profile";
|
||||
this.tsbDeleteProfile.Click += new System.EventHandler(this.tsbDeleteProfile_Click);
|
||||
//
|
||||
// tsSep2
|
||||
//
|
||||
this.tsSep2.Name = "tsSep2";
|
||||
this.tsSep2.Size = new System.Drawing.Size(6, 31);
|
||||
this.tsSep2.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// tsbAddApplication
|
||||
//
|
||||
@@ -229,7 +233,7 @@
|
||||
this.tsbAddApplication.Image = global::nspector.Properties.Resources.window_application_add;
|
||||
this.tsbAddApplication.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbAddApplication.Name = "tsbAddApplication";
|
||||
this.tsbAddApplication.Size = new System.Drawing.Size(24, 28);
|
||||
this.tsbAddApplication.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbAddApplication.Text = "Add application to current profile.";
|
||||
this.tsbAddApplication.Click += new System.EventHandler(this.tsbAddApplication_Click);
|
||||
//
|
||||
@@ -239,7 +243,7 @@
|
||||
this.tssbRemoveApplication.Image = global::nspector.Properties.Resources.window_application_delete;
|
||||
this.tssbRemoveApplication.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tssbRemoveApplication.Name = "tssbRemoveApplication";
|
||||
this.tssbRemoveApplication.Size = new System.Drawing.Size(39, 28);
|
||||
this.tssbRemoveApplication.Size = new System.Drawing.Size(36, 22);
|
||||
this.tssbRemoveApplication.Text = "Remove application from current profile";
|
||||
this.tssbRemoveApplication.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.tssbRemoveApplication_DropDownItemClicked);
|
||||
this.tssbRemoveApplication.Click += new System.EventHandler(this.tssbRemoveApplication_Click);
|
||||
@@ -247,7 +251,7 @@
|
||||
// tsSep3
|
||||
//
|
||||
this.tsSep3.Name = "tsSep3";
|
||||
this.tsSep3.Size = new System.Drawing.Size(6, 31);
|
||||
this.tsSep3.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// tsbExportProfiles
|
||||
//
|
||||
@@ -260,35 +264,35 @@
|
||||
this.tsbExportProfiles.Image = global::nspector.Properties.Resources.export1;
|
||||
this.tsbExportProfiles.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbExportProfiles.Name = "tsbExportProfiles";
|
||||
this.tsbExportProfiles.Size = new System.Drawing.Size(39, 28);
|
||||
this.tsbExportProfiles.Size = new System.Drawing.Size(36, 22);
|
||||
this.tsbExportProfiles.Text = "Export user defined profiles";
|
||||
this.tsbExportProfiles.Click += new System.EventHandler(this.tsbExportProfiles_Click);
|
||||
//
|
||||
// exportCurrentProfileOnlyToolStripMenuItem
|
||||
//
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Name = "exportCurrentProfileOnlyToolStripMenuItem";
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Size = new System.Drawing.Size(422, 26);
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Text = "Export current profile only";
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Click += new System.EventHandler(this.exportCurrentProfileOnlyToolStripMenuItem_Click);
|
||||
//
|
||||
// exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem
|
||||
//
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Name = "exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem";
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Size = new System.Drawing.Size(422, 26);
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Text = "Export current profile including predefined settings";
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Click += new System.EventHandler(this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem_Click);
|
||||
//
|
||||
// exportUserdefinedProfilesToolStripMenuItem
|
||||
//
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Name = "exportUserdefinedProfilesToolStripMenuItem";
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Size = new System.Drawing.Size(422, 26);
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Text = "Export all customized profiles";
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Click += new System.EventHandler(this.exportUserdefinedProfilesToolStripMenuItem_Click);
|
||||
//
|
||||
// exportAllProfilesNVIDIATextFormatToolStripMenuItem
|
||||
//
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Name = "exportAllProfilesNVIDIATextFormatToolStripMenuItem";
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(422, 26);
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Export all driver profiles (NVIDIA Text Format)";
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.exportAllProfilesNVIDIATextFormatToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -301,28 +305,28 @@
|
||||
this.tsbImportProfiles.Image = global::nspector.Properties.Resources.import1;
|
||||
this.tsbImportProfiles.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbImportProfiles.Name = "tsbImportProfiles";
|
||||
this.tsbImportProfiles.Size = new System.Drawing.Size(39, 28);
|
||||
this.tsbImportProfiles.Size = new System.Drawing.Size(36, 22);
|
||||
this.tsbImportProfiles.Text = "Import user defined profiles";
|
||||
this.tsbImportProfiles.Click += new System.EventHandler(this.tsbImportProfiles_Click);
|
||||
//
|
||||
// importProfilesToolStripMenuItem
|
||||
//
|
||||
this.importProfilesToolStripMenuItem.Name = "importProfilesToolStripMenuItem";
|
||||
this.importProfilesToolStripMenuItem.Size = new System.Drawing.Size(453, 26);
|
||||
this.importProfilesToolStripMenuItem.Size = new System.Drawing.Size(363, 22);
|
||||
this.importProfilesToolStripMenuItem.Text = "Import profile(s)";
|
||||
this.importProfilesToolStripMenuItem.Click += new System.EventHandler(this.importProfilesToolStripMenuItem_Click);
|
||||
//
|
||||
// importAllProfilesNVIDIATextFormatToolStripMenuItem
|
||||
//
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Name = "importAllProfilesNVIDIATextFormatToolStripMenuItem";
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(453, 26);
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(363, 22);
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Import (replace) all driver profiles (NVIDIA Text Format)";
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.importAllProfilesNVIDIATextFormatToolStripMenuItem_Click);
|
||||
//
|
||||
// tsSep4
|
||||
//
|
||||
this.tsSep4.Name = "tsSep4";
|
||||
this.tsSep4.Size = new System.Drawing.Size(6, 31);
|
||||
this.tsSep4.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// tscbShowCustomSettingNamesOnly
|
||||
//
|
||||
@@ -331,14 +335,14 @@
|
||||
this.tscbShowCustomSettingNamesOnly.Image = global::nspector.Properties.Resources.filter_user;
|
||||
this.tscbShowCustomSettingNamesOnly.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tscbShowCustomSettingNamesOnly.Name = "tscbShowCustomSettingNamesOnly";
|
||||
this.tscbShowCustomSettingNamesOnly.Size = new System.Drawing.Size(24, 28);
|
||||
this.tscbShowCustomSettingNamesOnly.Size = new System.Drawing.Size(24, 22);
|
||||
this.tscbShowCustomSettingNamesOnly.Text = "Show the settings and values from CustomSettingNames file only.";
|
||||
this.tscbShowCustomSettingNamesOnly.CheckedChanged += new System.EventHandler(this.cbCustomSettingsOnly_CheckedChanged);
|
||||
//
|
||||
// tsSep5
|
||||
//
|
||||
this.tsSep5.Name = "tsSep5";
|
||||
this.tsSep5.Size = new System.Drawing.Size(6, 31);
|
||||
this.tsSep5.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// tscbShowScannedUnknownSettings
|
||||
//
|
||||
@@ -348,7 +352,7 @@
|
||||
this.tscbShowScannedUnknownSettings.Image = global::nspector.Properties.Resources.find_set2;
|
||||
this.tscbShowScannedUnknownSettings.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tscbShowScannedUnknownSettings.Name = "tscbShowScannedUnknownSettings";
|
||||
this.tscbShowScannedUnknownSettings.Size = new System.Drawing.Size(24, 28);
|
||||
this.tscbShowScannedUnknownSettings.Size = new System.Drawing.Size(24, 22);
|
||||
this.tscbShowScannedUnknownSettings.Text = "Show unknown settings from NVIDIA predefined profiles";
|
||||
this.tscbShowScannedUnknownSettings.Click += new System.EventHandler(this.tscbShowScannedUnknownSettings_Click);
|
||||
//
|
||||
@@ -358,14 +362,14 @@
|
||||
this.tsbBitValueEditor.Image = global::nspector.Properties.Resources.text_binary;
|
||||
this.tsbBitValueEditor.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbBitValueEditor.Name = "tsbBitValueEditor";
|
||||
this.tsbBitValueEditor.Size = new System.Drawing.Size(24, 28);
|
||||
this.tsbBitValueEditor.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbBitValueEditor.Text = "Show bit value editor.";
|
||||
this.tsbBitValueEditor.Click += new System.EventHandler(this.tsbBitValueEditor_Click);
|
||||
//
|
||||
// tsSep6
|
||||
//
|
||||
this.tsSep6.Name = "tsSep6";
|
||||
this.tsSep6.Size = new System.Drawing.Size(6, 31);
|
||||
this.tsSep6.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// tsbApplyProfile
|
||||
//
|
||||
@@ -374,7 +378,7 @@
|
||||
this.tsbApplyProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbApplyProfile.Name = "tsbApplyProfile";
|
||||
this.tsbApplyProfile.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
|
||||
this.tsbApplyProfile.Size = new System.Drawing.Size(130, 28);
|
||||
this.tsbApplyProfile.Size = new System.Drawing.Size(109, 22);
|
||||
this.tsbApplyProfile.Text = "Apply changes";
|
||||
this.tsbApplyProfile.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.tsbApplyProfile.Click += new System.EventHandler(this.tsbApplyProfile_Click);
|
||||
@@ -384,27 +388,28 @@
|
||||
this.btnResetValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnResetValue.Enabled = false;
|
||||
this.btnResetValue.Image = global::nspector.Properties.Resources.nv_btn;
|
||||
this.btnResetValue.Location = new System.Drawing.Point(976, 215);
|
||||
this.btnResetValue.Location = new System.Drawing.Point(732, 175);
|
||||
this.btnResetValue.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
|
||||
this.btnResetValue.Name = "btnResetValue";
|
||||
this.btnResetValue.Size = new System.Drawing.Size(33, 23);
|
||||
this.btnResetValue.Size = new System.Drawing.Size(25, 19);
|
||||
this.btnResetValue.TabIndex = 7;
|
||||
this.btnResetValue.UseVisualStyleBackColor = true;
|
||||
this.btnResetValue.Click += new System.EventHandler(this.btnResetValue_Click);
|
||||
//
|
||||
// lblApplications
|
||||
//
|
||||
this.lblApplications.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.lblApplications.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblApplications.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(118)))), ((int)(((byte)(185)))), ((int)(((byte)(0)))));
|
||||
this.lblApplications.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.lblApplications.ForeColor = System.Drawing.Color.White;
|
||||
this.lblApplications.Location = new System.Drawing.Point(16, 39);
|
||||
this.lblApplications.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.lblApplications.Location = new System.Drawing.Point(12, 32);
|
||||
this.lblApplications.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblApplications.Name = "lblApplications";
|
||||
this.lblApplications.Size = new System.Drawing.Size(1120, 21);
|
||||
this.lblApplications.Size = new System.Drawing.Size(840, 17);
|
||||
this.lblApplications.TabIndex = 25;
|
||||
this.lblApplications.Text = "fsagame.exe, bond.exe, herozero.exe";
|
||||
this.lblApplications.DoubleClick += new System.EventHandler(this.tsbAddApplication_Click);
|
||||
//
|
||||
// toolStripButton5
|
||||
//
|
||||
@@ -440,10 +445,10 @@
|
||||
//
|
||||
this.cbValues.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.cbValues.FormattingEnabled = true;
|
||||
this.cbValues.Location = new System.Drawing.Point(699, 215);
|
||||
this.cbValues.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.cbValues.Location = new System.Drawing.Point(524, 175);
|
||||
this.cbValues.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.cbValues.Name = "cbValues";
|
||||
this.cbValues.Size = new System.Drawing.Size(95, 24);
|
||||
this.cbValues.Size = new System.Drawing.Size(72, 21);
|
||||
this.cbValues.TabIndex = 5;
|
||||
this.cbValues.Visible = false;
|
||||
this.cbValues.SelectedValueChanged += new System.EventHandler(this.cbValues_SelectedValueChanged);
|
||||
@@ -451,71 +456,71 @@
|
||||
//
|
||||
// lblWidth96
|
||||
//
|
||||
this.lblWidth96.Location = new System.Drawing.Point(103, 287);
|
||||
this.lblWidth96.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.lblWidth96.Location = new System.Drawing.Point(77, 233);
|
||||
this.lblWidth96.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth96.Name = "lblWidth96";
|
||||
this.lblWidth96.Size = new System.Drawing.Size(128, 22);
|
||||
this.lblWidth96.Size = new System.Drawing.Size(96, 18);
|
||||
this.lblWidth96.TabIndex = 77;
|
||||
this.lblWidth96.Text = "96";
|
||||
this.lblWidth96.Visible = false;
|
||||
//
|
||||
// lblWidth330
|
||||
//
|
||||
this.lblWidth330.Location = new System.Drawing.Point(103, 258);
|
||||
this.lblWidth330.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.lblWidth330.Location = new System.Drawing.Point(77, 210);
|
||||
this.lblWidth330.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth330.Name = "lblWidth330";
|
||||
this.lblWidth330.Size = new System.Drawing.Size(440, 27);
|
||||
this.lblWidth330.Size = new System.Drawing.Size(330, 22);
|
||||
this.lblWidth330.TabIndex = 78;
|
||||
this.lblWidth330.Text = "330 (Helper Labels for DPI Scaling)";
|
||||
this.lblWidth330.Visible = false;
|
||||
//
|
||||
// lblWidth16
|
||||
//
|
||||
this.lblWidth16.Location = new System.Drawing.Point(103, 331);
|
||||
this.lblWidth16.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.lblWidth16.Location = new System.Drawing.Point(77, 269);
|
||||
this.lblWidth16.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth16.Name = "lblWidth16";
|
||||
this.lblWidth16.Size = new System.Drawing.Size(21, 22);
|
||||
this.lblWidth16.Size = new System.Drawing.Size(16, 18);
|
||||
this.lblWidth16.TabIndex = 79;
|
||||
this.lblWidth16.Text = "16";
|
||||
this.lblWidth16.Visible = false;
|
||||
//
|
||||
// lblWidth30
|
||||
//
|
||||
this.lblWidth30.Location = new System.Drawing.Point(103, 309);
|
||||
this.lblWidth30.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.lblWidth30.Location = new System.Drawing.Point(77, 251);
|
||||
this.lblWidth30.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth30.Name = "lblWidth30";
|
||||
this.lblWidth30.Size = new System.Drawing.Size(40, 22);
|
||||
this.lblWidth30.Size = new System.Drawing.Size(30, 18);
|
||||
this.lblWidth30.TabIndex = 80;
|
||||
this.lblWidth30.Text = "30";
|
||||
this.lblWidth30.Visible = false;
|
||||
//
|
||||
// lvSettings
|
||||
//
|
||||
this.lvSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lvSettings.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.chSettingID,
|
||||
this.chSettingValue,
|
||||
this.chSettingValueHex});
|
||||
this.lvSettings.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lvSettings.FullRowSelect = true;
|
||||
this.lvSettings.GridLines = true;
|
||||
this.lvSettings.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||
this.lvSettings.Location = new System.Drawing.Point(16, 63);
|
||||
this.lvSettings.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.lvSettings.HideSelection = false;
|
||||
this.lvSettings.Location = new System.Drawing.Point(0, 0);
|
||||
this.lvSettings.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.lvSettings.MultiSelect = false;
|
||||
this.lvSettings.Name = "lvSettings";
|
||||
this.lvSettings.ShowItemToolTips = true;
|
||||
this.lvSettings.Size = new System.Drawing.Size(1119, 514);
|
||||
this.lvSettings.Size = new System.Drawing.Size(840, 372);
|
||||
this.lvSettings.SmallImageList = this.ilListView;
|
||||
this.lvSettings.TabIndex = 2;
|
||||
this.lvSettings.UseCompatibleStateImageBehavior = false;
|
||||
this.lvSettings.View = System.Windows.Forms.View.Details;
|
||||
this.lvSettings.GroupStateChanged += new System.EventHandler<nspector.GroupStateChangedEventArgs>(this.lvSettings_GroupStateChanged);
|
||||
this.lvSettings.ColumnWidthChanging += new System.Windows.Forms.ColumnWidthChangingEventHandler(this.lvSettings_ColumnWidthChanging);
|
||||
this.lvSettings.SelectedIndexChanged += new System.EventHandler(this.lvSettings_SelectedIndexChanged);
|
||||
this.lvSettings.DoubleClick += new System.EventHandler(this.lvSettings_DoubleClick);
|
||||
this.lvSettings.Resize += new System.EventHandler(this.lvSettings_Resize);
|
||||
this.lvSettings.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lvSettings_KeyDown);
|
||||
this.lvSettings.Resize += new System.EventHandler(this.lvSettings_Resize);
|
||||
//
|
||||
// chSettingID
|
||||
//
|
||||
@@ -532,23 +537,64 @@
|
||||
this.chSettingValueHex.Text = "SettingValueHex";
|
||||
this.chSettingValueHex.Width = 96;
|
||||
//
|
||||
// tbSettingDescription
|
||||
//
|
||||
this.tbSettingDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.tbSettingDescription.Location = new System.Drawing.Point(0, 372);
|
||||
this.tbSettingDescription.Multiline = true;
|
||||
this.tbSettingDescription.Name = "tbSettingDescription";
|
||||
this.tbSettingDescription.ReadOnly = true;
|
||||
this.tbSettingDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.tbSettingDescription.Size = new System.Drawing.Size(840, 44);
|
||||
this.tbSettingDescription.TabIndex = 81;
|
||||
this.tbSettingDescription.Visible = false;
|
||||
//
|
||||
// pnlListview
|
||||
//
|
||||
this.pnlListview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pnlListview.Controls.Add(this.lvSettings);
|
||||
this.pnlListview.Controls.Add(this.txtFilter);
|
||||
this.pnlListview.Controls.Add(this.tbSettingDescription);
|
||||
this.pnlListview.Location = new System.Drawing.Point(12, 52);
|
||||
this.pnlListview.Name = "pnlListview";
|
||||
this.pnlListview.Size = new System.Drawing.Size(840, 416);
|
||||
this.pnlListview.TabIndex = 82;
|
||||
//
|
||||
// txtFilter
|
||||
//
|
||||
this.txtFilter.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txtFilter.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.txtFilter.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.txtFilter.Location = new System.Drawing.Point(0, 0);
|
||||
this.txtFilter.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
this.txtFilter.Name = "txtFilter";
|
||||
this.txtFilter.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.None;
|
||||
this.txtFilter.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.None;
|
||||
this.txtFilter.Size = new System.Drawing.Size(2118, 35);
|
||||
this.txtFilter.TabIndex = 82;
|
||||
this.txtFilter.WatermarkText = "Search for setting...";
|
||||
this.txtFilter.TextChanged += new System.EventHandler(this.txtFilter_TextChanged);
|
||||
this.txtFilter.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtFilter_KeyUp);
|
||||
//
|
||||
// frmDrvSettings
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1152, 606);
|
||||
this.ClientSize = new System.Drawing.Size(864, 492);
|
||||
this.Controls.Add(this.pnlListview);
|
||||
this.Controls.Add(this.lblWidth30);
|
||||
this.Controls.Add(this.lblWidth16);
|
||||
this.Controls.Add(this.lblWidth330);
|
||||
this.Controls.Add(this.lblWidth96);
|
||||
this.Controls.Add(this.lvSettings);
|
||||
this.Controls.Add(this.lblApplications);
|
||||
this.Controls.Add(this.tsMain);
|
||||
this.Controls.Add(this.pbMain);
|
||||
this.Controls.Add(this.btnResetValue);
|
||||
this.Controls.Add(this.cbValues);
|
||||
this.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.MinimumSize = new System.Drawing.Size(1167, 417);
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.MinimumSize = new System.Drawing.Size(879, 346);
|
||||
this.Name = "frmDrvSettings";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "nSpector - Driver Profile Settings";
|
||||
@@ -558,6 +604,8 @@
|
||||
this.Shown += new System.EventHandler(this.frmDrvSettings_Shown);
|
||||
this.tsMain.ResumeLayout(false);
|
||||
this.tsMain.PerformLayout();
|
||||
this.pnlListview.ResumeLayout(false);
|
||||
this.pnlListview.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -609,5 +657,8 @@
|
||||
private System.Windows.Forms.Label lblWidth16;
|
||||
private System.Windows.Forms.Label lblWidth30;
|
||||
private System.Windows.Forms.ToolStripMenuItem exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem;
|
||||
private System.Windows.Forms.TextBox tbSettingDescription;
|
||||
private System.Windows.Forms.Panel pnlListview;
|
||||
private WatermarkTextBox txtFilter;
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,10 @@ namespace nspector
|
||||
|
||||
public string _CurrentProfile = "";
|
||||
|
||||
private bool _isDevMode = false;
|
||||
|
||||
private UserSettings _settings = null;
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
switch (m.Msg)
|
||||
@@ -76,9 +80,14 @@ namespace nspector
|
||||
{
|
||||
var group = FindOrCreateGroup(setting.GroupName);
|
||||
|
||||
var item = new ListViewItem(setting.SettingText);
|
||||
var settingName = _isDevMode ? $"0x{setting.SettingId:X8} {setting.SettingText}" : setting.SettingText;
|
||||
if (setting.IsSettingHidden)
|
||||
settingName = "[H] " + settingName;
|
||||
|
||||
var item = new ListViewItem(settingName);
|
||||
item.Tag = setting.SettingId;
|
||||
item.Group = group;
|
||||
|
||||
item.SubItems.Add(setting.ValueText);
|
||||
item.SubItems.Add(setting.ValueRaw);
|
||||
|
||||
@@ -148,9 +157,29 @@ namespace nspector
|
||||
_currentProfileSettingItems = _drs.GetSettingsForProfile(_CurrentProfile, GetSettingViewMode(), ref applications);
|
||||
RefreshApplicationsCombosAndText(applications);
|
||||
|
||||
var searchFilter = txtFilter.Text.Trim();
|
||||
|
||||
foreach (var settingItem in _currentProfileSettingItems)
|
||||
{
|
||||
lvSettings.Items.Add(CreateListViewItem(settingItem));
|
||||
if (settingItem.IsSettingHidden && !_isDevMode) continue;
|
||||
|
||||
var item = CreateListViewItem(settingItem);
|
||||
|
||||
// Apply search filter if set
|
||||
if (!string.IsNullOrEmpty(searchFilter) &&
|
||||
item.Text.IndexOf(searchFilter, StringComparison.OrdinalIgnoreCase) < 0 &&
|
||||
(settingItem.AlternateNames == null ||
|
||||
settingItem.AlternateNames.IndexOf(searchFilter, StringComparison.OrdinalIgnoreCase) < 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
lvSettings.Items.Add(item);
|
||||
|
||||
if (Debugger.IsAttached && !settingItem.IsApiExposed)
|
||||
{
|
||||
item.ForeColor = Color.LightCoral;
|
||||
}
|
||||
}
|
||||
|
||||
btnResetValue.Enabled = false;
|
||||
@@ -164,9 +193,22 @@ namespace nspector
|
||||
}
|
||||
finally
|
||||
{
|
||||
lvSettings.EndUpdate();
|
||||
((ListViewGroupSorter)lvSettings).SortGroups(true);
|
||||
|
||||
foreach (ListViewGroup group in lvSettings.Groups)
|
||||
{
|
||||
if (_settings.HiddenSettingGroups.Contains(group.Header))
|
||||
{
|
||||
lvSettings.SetGroupState(group, ListViewGroupState.Collapsed | ListViewGroupState.Collapsible);
|
||||
}
|
||||
else
|
||||
{
|
||||
lvSettings.SetGroupState(group, ListViewGroupState.Normal | ListViewGroupState.Collapsible);
|
||||
}
|
||||
}
|
||||
|
||||
lvSettings.EndUpdate();
|
||||
|
||||
GC.Collect();
|
||||
for (int i = 0; i < lvSettings.Items.Count; i++)
|
||||
{
|
||||
@@ -206,6 +248,8 @@ namespace nspector
|
||||
|
||||
cbValues.BeginUpdate();
|
||||
|
||||
tsbBitValueEditor.Enabled = false;
|
||||
|
||||
cbValues.Items.Clear();
|
||||
cbValues.Tag = lvSettings.SelectedItems[0].Tag;
|
||||
uint settingid = (uint)lvSettings.SelectedItems[0].Tag;
|
||||
@@ -227,6 +271,10 @@ namespace nspector
|
||||
cbValues.Items.Add(itm);
|
||||
|
||||
}
|
||||
|
||||
tsbBitValueEditor.Enabled = valueNames.Count > 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (settingMeta.SettingType == Native.NVAPI2.NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE && settingMeta.StringValues != null)
|
||||
@@ -242,13 +290,6 @@ namespace nspector
|
||||
foreach (string v in valueNames)
|
||||
cbValues.Items.Add(v);
|
||||
}
|
||||
|
||||
var scannedCount = settingMeta?.DwordValues?
|
||||
.Where(x => x.ValueSource == Common.Meta.SettingMetaSource.ScannedSettings)
|
||||
.Count();
|
||||
|
||||
tsbBitValueEditor.Enabled = scannedCount > 0;
|
||||
|
||||
}
|
||||
|
||||
if (cbValues.Items.Count < 1)
|
||||
@@ -258,6 +299,25 @@ namespace nspector
|
||||
}
|
||||
|
||||
|
||||
var referenceSettings = DrsServiceLocator.ReferenceSettings?.Settings.FirstOrDefault(s => s.SettingId == settingid);
|
||||
|
||||
var description = DlssHelper.ReplaceDlssVersions(settingMeta.Description);
|
||||
if (!string.IsNullOrEmpty(settingMeta.AlternateNames))
|
||||
description = $"Alternate names: {settingMeta.AlternateNames}\r\n{description}";
|
||||
|
||||
if (string.IsNullOrEmpty(description) && !(referenceSettings?.HasConstraints ?? false))
|
||||
{
|
||||
tbSettingDescription.Text = "";
|
||||
tbSettingDescription.Visible = false;
|
||||
tbSettingDescription.BackColor = SystemColors.Control;
|
||||
}
|
||||
else
|
||||
{
|
||||
tbSettingDescription.Text = description.Replace("\\r\\n", "\r\n");
|
||||
tbSettingDescription.Visible = true;
|
||||
tbSettingDescription.BackColor = (referenceSettings?.HasConstraints ?? false) ? Color.LightCoral : SystemColors.Control;
|
||||
}
|
||||
|
||||
cbValues.Text = lvSettings.SelectedItems[0].SubItems[1].Text;
|
||||
cbValues.EndUpdate();
|
||||
|
||||
@@ -331,6 +391,7 @@ namespace nspector
|
||||
valueHasChanged = currentProfileItem.ValueRaw != stringBehind;
|
||||
}
|
||||
|
||||
|
||||
if (valueHasChanged || activeImages.Contains(lvItem.ImageIndex))
|
||||
{
|
||||
lvItem.ForeColor = SystemColors.ControlText;
|
||||
@@ -418,6 +479,22 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteSelectedValue()
|
||||
{
|
||||
if (lvSettings.SelectedItems != null && lvSettings.SelectedItems.Count > 0)
|
||||
{
|
||||
var settingId = (uint)lvSettings.SelectedItems[0].Tag;
|
||||
|
||||
bool removeFromModified;
|
||||
_drs.DeleteValue(_CurrentProfile, settingId, out removeFromModified);
|
||||
|
||||
if (removeFromModified)
|
||||
RemoveFromModifiedProfiles(_CurrentProfile);
|
||||
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitTaskbarList()
|
||||
{
|
||||
if (Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 1)
|
||||
@@ -450,12 +527,13 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
|
||||
private void SetTitleVersion()
|
||||
private void SetTitleVersion(bool isUpdateAvailable = false)
|
||||
{
|
||||
var numberFormat = new NumberFormatInfo() { NumberDecimalSeparator = "." };
|
||||
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
var version = Assembly.GetExecutingAssembly().GetName().Version.ToString() + (isUpdateAvailable ? " (update available on GitHub)" : "");
|
||||
var fileVersionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
|
||||
Text = $"{Application.ProductName} {version} - Geforce {_drs.DriverVersion.ToString("#.00", numberFormat)} - Profile Settings - {fileVersionInfo.LegalCopyright}";
|
||||
var externalCsn = DrsServiceLocator.IsExternalCustomSettings ? " - CSN OVERRIDE!" : "";
|
||||
Text = $"{Application.ProductName} {version} - Geforce {DrsSettingsServiceBase.DriverVersion.ToString("#.00", numberFormat)} - Profile Settings - {fileVersionInfo.LegalCopyright}{externalCsn}";
|
||||
}
|
||||
|
||||
private static void InitMessageFilter(IntPtr handle)
|
||||
@@ -479,6 +557,8 @@ namespace nspector
|
||||
{
|
||||
_skipScan = skipScan;
|
||||
InitializeComponent();
|
||||
lblApplications.Text = "";
|
||||
|
||||
InitTaskbarList();
|
||||
SetupDropFilesNative();
|
||||
SetupToolbar();
|
||||
@@ -486,10 +566,21 @@ namespace nspector
|
||||
|
||||
tscbShowCustomSettingNamesOnly.Checked = showCsnOnly;
|
||||
Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||
|
||||
// KeyUp has to be set on the inner control for us to receive Enter key...
|
||||
cbProfiles.Control.KeyUp += cbProfiles_KeyUp;
|
||||
}
|
||||
|
||||
public static double ScaleFactor = 1;
|
||||
|
||||
private void SetupDpiAdjustments()
|
||||
{
|
||||
ScaleFactor = lblWidth330.Width / 330;
|
||||
|
||||
// Later Windows versions changed DPI scaling method, check with Graphics and use it if larger
|
||||
using (Graphics g = CreateGraphics())
|
||||
ScaleFactor = Math.Max(ScaleFactor, Math.Max(g.DpiX / 96f, g.DpiY / 96f));
|
||||
|
||||
chSettingID.Width = lblWidth330.Width;
|
||||
chSettingValueHex.Width = lblWidth96.Width;
|
||||
}
|
||||
@@ -534,7 +625,7 @@ namespace nspector
|
||||
tsbModifiedProfiles.Enabled = true;
|
||||
}
|
||||
|
||||
private void frmDrvSettings_Load(object sender, EventArgs e)
|
||||
private async void frmDrvSettings_Load(object sender, EventArgs e)
|
||||
{
|
||||
SetupLayout();
|
||||
SetTitleVersion();
|
||||
@@ -549,6 +640,39 @@ namespace nspector
|
||||
tssbRemoveApplication.Enabled = false;
|
||||
|
||||
InitResetValueTooltip();
|
||||
|
||||
await CheckForUpdatesAsync();
|
||||
}
|
||||
|
||||
private async Task CheckForUpdatesAsync()
|
||||
{
|
||||
// Allow disabling update check in case user doesn't want us to access internet, or just wants to stick to a certain version
|
||||
if (_settings.DisableUpdateCheck || File.Exists(Path.Combine(AppContext.BaseDirectory, "DisableUpdateCheck.txt")))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
bool updateAvailable = await GithubVersionHelper.IsUpdateAvailableAsync();
|
||||
|
||||
if (updateAvailable)
|
||||
{
|
||||
SetTitleVersion(updateAvailable);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore update check failures
|
||||
}
|
||||
}
|
||||
|
||||
private void lvSettings_GroupStateChanged(object sender, GroupStateChangedEventArgs e)
|
||||
{
|
||||
if (e.IsCollapsed && !_settings.HiddenSettingGroups.Contains(e.Group.Header))
|
||||
_settings.HiddenSettingGroups.Add(e.Group.Header);
|
||||
else if (!e.IsCollapsed && _settings.HiddenSettingGroups.Contains(e.Group.Header))
|
||||
_settings.HiddenSettingGroups.Remove(e.Group.Header);
|
||||
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
private void InitResetValueTooltip()
|
||||
@@ -574,9 +698,14 @@ namespace nspector
|
||||
|
||||
private void btnResetValue_Click(object sender, EventArgs e)
|
||||
{
|
||||
ResetSelectedValue();
|
||||
if (Control.ModifierKeys == Keys.Control)
|
||||
DeleteSelectedValue();
|
||||
else
|
||||
ResetSelectedValue();
|
||||
}
|
||||
|
||||
ToolTip appPathsTooltip = new ToolTip() { InitialDelay = 250 };
|
||||
|
||||
private void ChangeCurrentProfile(string profileName)
|
||||
{
|
||||
if (profileName == GetBaseProfileName() || profileName == _baseProfileName)
|
||||
@@ -586,15 +715,18 @@ namespace nspector
|
||||
tsbDeleteProfile.Enabled = false;
|
||||
tsbAddApplication.Enabled = false;
|
||||
tssbRemoveApplication.Enabled = false;
|
||||
appPathsTooltip.SetToolTip(lblApplications, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
_CurrentProfile = cbProfiles.Text;
|
||||
_CurrentProfile = profileName;
|
||||
tsbDeleteProfile.Enabled = true;
|
||||
tsbAddApplication.Enabled = true;
|
||||
tssbRemoveApplication.Enabled = true;
|
||||
appPathsTooltip.SetToolTip(lblApplications, "Double-click to add application");
|
||||
}
|
||||
|
||||
txtFilter.Text = "";
|
||||
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
@@ -605,6 +737,26 @@ namespace nspector
|
||||
{
|
||||
ChangeCurrentProfile(cbProfiles.Text);
|
||||
}
|
||||
lvSettings.Focus(); // Unfocus cbProfiles to fix toolstrip hover highlight
|
||||
}
|
||||
|
||||
private void cbProfiles_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if(e.KeyCode == Keys.Enter)
|
||||
{
|
||||
// KeyUp event is only fired when combobox item doesn't exist with the entered text
|
||||
// Try searching for text as an exe/application name
|
||||
try
|
||||
{
|
||||
var profile = _drs.GetProfileNameByExeName(cbProfiles.Text);
|
||||
if (!string.IsNullOrEmpty(profile))
|
||||
{
|
||||
cbProfiles.Text = profile;
|
||||
ChangeCurrentProfile(profile);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
private void SetTaskbarProgress(int progress)
|
||||
@@ -699,12 +851,15 @@ namespace nspector
|
||||
if (scanPredefined && !_alreadyScannedForPredefinedSettings)
|
||||
{
|
||||
_alreadyScannedForPredefinedSettings = true;
|
||||
await _scanner.ScanForPredefinedProfileSettingsAsync(progressHandler, _scannerCancelationTokenSource.Token);
|
||||
await _scanner.ScanProfileSettingsAsync(false, progressHandler, _scannerCancelationTokenSource.Token);
|
||||
_meta.ResetMetaCache();
|
||||
tscbShowScannedUnknownSettings.Enabled = true;
|
||||
}
|
||||
|
||||
await _scanner.ScanForModifiedProfilesAsync(progressHandler, _scannerCancelationTokenSource.Token);
|
||||
else
|
||||
{
|
||||
await _scanner.ScanProfileSettingsAsync(true, progressHandler, _scannerCancelationTokenSource.Token);
|
||||
}
|
||||
|
||||
RefreshModifiesProfilesDropDown();
|
||||
tsbModifiedProfiles.Enabled = true;
|
||||
|
||||
@@ -753,7 +908,15 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
else
|
||||
ResetCurrentProfile();
|
||||
{
|
||||
if (MessageBox.Show(this,
|
||||
"Restore profile to NVIDIA driver defaults?",
|
||||
"Restore profile",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
ResetCurrentProfile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void tsbRefreshProfile_Click(object sender, EventArgs e)
|
||||
@@ -842,11 +1005,14 @@ namespace nspector
|
||||
if (MessageBox.Show(this, "Really delete all profiles?", "Delete all profiles", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
||||
{
|
||||
_drs.DeleteAllProfilesHard();
|
||||
ChangeCurrentProfile(_baseProfileName);
|
||||
DrsSessionScope.DestroyGlobalSession();
|
||||
RefreshAll();
|
||||
}
|
||||
}
|
||||
else if (MessageBox.Show(this, "Really delete this profile?\r\n\r\nNote: NVIDIA predefined profiles can not be restored until next driver installation!", "Delete Profile", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
||||
{
|
||||
if (_drs.DriverVersion > 280 && _drs.DriverVersion < 310)
|
||||
if (DrsSettingsServiceBase.DriverVersion > 280 && DrsSettingsServiceBase.DriverVersion < 310)
|
||||
// hack for driverbug
|
||||
_drs.DeleteProfileHard(_CurrentProfile);
|
||||
else
|
||||
@@ -861,15 +1027,24 @@ namespace nspector
|
||||
|
||||
private void tsbAddApplication_Click(object sender, EventArgs e)
|
||||
{
|
||||
var openDialog = new OpenFileDialog();
|
||||
openDialog.DefaultExt = "*.exe";
|
||||
openDialog.Filter = "Application EXE Name|*.exe|Application Absolute Path|*.exe";
|
||||
if (_CurrentProfile == GetBaseProfileName() || _CurrentProfile == _baseProfileName)
|
||||
return;
|
||||
|
||||
if (openDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
var applications = new Dictionary<string, string>();
|
||||
_currentProfileSettingItems = _drs.GetSettingsForProfile(_CurrentProfile, GetSettingViewMode(), ref applications);
|
||||
|
||||
var existingPaths = new HashSet<string>(applications.Values, StringComparer.OrdinalIgnoreCase);
|
||||
var applicationName = "";
|
||||
|
||||
if (InputBox.Show("Add Application", "Enter an application path/filename/UWP ID to add to the profile:", ref applicationName, new List<string>(), "", 2048, true) == DialogResult.OK)
|
||||
{
|
||||
string applicationName = new FileInfo(openDialog.FileName).Name;
|
||||
if (openDialog.FilterIndex == 2)
|
||||
applicationName = openDialog.FileName;
|
||||
// Add new application path
|
||||
if (existingPaths.Contains(applicationName))
|
||||
{
|
||||
MessageBox.Show("This application is already assigned to this profile!",
|
||||
"Error adding Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -880,25 +1055,26 @@ namespace nspector
|
||||
if (ex.Status == Native.NVAPI2.NvAPI_Status.NVAPI_EXECUTABLE_ALREADY_IN_USE || ex.Status == Native.NVAPI2.NvAPI_Status.NVAPI_ERROR)
|
||||
{
|
||||
if (lblApplications.Text.ToUpper().IndexOf(" " + applicationName.ToUpper() + ",") != -1)
|
||||
MessageBox.Show("This application executable is already assigned to this profile!",
|
||||
MessageBox.Show("This application is already assigned to this profile!",
|
||||
"Error adding Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
else
|
||||
{
|
||||
string profileNames = _scanner.FindProfilesUsingApplication(applicationName);
|
||||
if (profileNames == "")
|
||||
MessageBox.Show("This application executable might already be assigned to another profile!",
|
||||
MessageBox.Show("This application might already be assigned to another profile!",
|
||||
"Error adding Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
else
|
||||
MessageBox.Show(
|
||||
"This application executable is already assigned to the following profiles: " +
|
||||
"This application is already assigned to the following profiles: " +
|
||||
profileNames, "Error adding Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
throw;
|
||||
}
|
||||
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
|
||||
private void tssbRemoveApplication_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
||||
@@ -1023,6 +1199,8 @@ namespace nspector
|
||||
|
||||
private async void RefreshAll()
|
||||
{
|
||||
txtFilter.Text = "";
|
||||
|
||||
RefreshProfilesCombo();
|
||||
await ScanProfilesSilentAsync(true, false);
|
||||
|
||||
@@ -1103,13 +1281,12 @@ namespace nspector
|
||||
if (files.Length == 1)
|
||||
{
|
||||
var fileInfo = new FileInfo(files[0]);
|
||||
if (fileInfo.Extension.ToLower().Equals(".nip"))
|
||||
if (fileInfo.Extension.ToLowerInvariant().Equals(".nip"))
|
||||
{
|
||||
ImportProfiles(fileInfo.FullName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var profileName = "";
|
||||
var exeFile = ShortcutResolver.ResolveExecuteable(files[0], out profileName);
|
||||
if (exeFile != "")
|
||||
@@ -1139,11 +1316,12 @@ namespace nspector
|
||||
|
||||
private void lvSettings_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (Debugger.IsAttached && lvSettings.SelectedItems != null && lvSettings.SelectedItems.Count == 1)
|
||||
if (_isDevMode && lvSettings.SelectedItems != null && lvSettings.SelectedItems.Count == 1)
|
||||
{
|
||||
var settingId = ((uint)lvSettings.SelectedItems[0].Tag);
|
||||
var settingName = lvSettings.SelectedItems[0].Text;
|
||||
Clipboard.SetText(string.Format($"0x{settingId:X8} {settingName}"));
|
||||
//Clipboard.SetText(string.Format($"0x{settingId:X8} {settingName}"));
|
||||
Clipboard.SetText(string.Format($"{settingName}"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1166,32 +1344,36 @@ namespace nspector
|
||||
|
||||
private void SaveSettings()
|
||||
{
|
||||
var settings = UserSettings.LoadSettings();
|
||||
|
||||
if(_settings == null)
|
||||
_settings = UserSettings.LoadSettings();
|
||||
if (WindowState == FormWindowState.Normal)
|
||||
{
|
||||
settings.WindowTop = Top;
|
||||
settings.WindowLeft = Left;
|
||||
settings.WindowHeight = Height;
|
||||
settings.WindowWidth = Width;
|
||||
_settings.WindowTop = Top;
|
||||
_settings.WindowLeft = Left;
|
||||
_settings.WindowHeight = Height;
|
||||
_settings.WindowWidth = Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
settings.WindowTop = RestoreBounds.Top;
|
||||
settings.WindowLeft = RestoreBounds.Left;
|
||||
settings.WindowHeight = RestoreBounds.Height;
|
||||
settings.WindowWidth = RestoreBounds.Width;
|
||||
_settings.WindowTop = RestoreBounds.Top;
|
||||
_settings.WindowLeft = RestoreBounds.Left;
|
||||
_settings.WindowHeight = RestoreBounds.Height;
|
||||
_settings.WindowWidth = RestoreBounds.Width;
|
||||
}
|
||||
settings.WindowState = WindowState;
|
||||
settings.SaveSettings();
|
||||
_settings.WindowState = WindowState;
|
||||
_settings.ShowCustomizedSettingNamesOnly = tscbShowCustomSettingNamesOnly.Checked;
|
||||
_settings.ShowScannedUnknownSettings = tscbShowScannedUnknownSettings.Checked;
|
||||
_settings.SaveSettings();
|
||||
}
|
||||
|
||||
private void LoadSettings()
|
||||
{
|
||||
var settings = UserSettings.LoadSettings();
|
||||
SetBounds(settings.WindowLeft, settings.WindowTop, settings.WindowWidth, settings.WindowHeight);
|
||||
WindowState = settings.WindowState != FormWindowState.Minimized ? settings.WindowState : FormWindowState.Normal;
|
||||
_settings = UserSettings.LoadSettings();
|
||||
SetBounds(_settings.WindowLeft, _settings.WindowTop, _settings.WindowWidth, _settings.WindowHeight);
|
||||
WindowState = _settings.WindowState != FormWindowState.Minimized ? _settings.WindowState : FormWindowState.Normal;
|
||||
HandleScreenConstraints();
|
||||
tscbShowCustomSettingNamesOnly.Checked = _settings.ShowCustomizedSettingNamesOnly;
|
||||
tscbShowScannedUnknownSettings.Checked = !_skipScan && _settings.ShowScannedUnknownSettings;
|
||||
}
|
||||
|
||||
private void frmDrvSettings_FormClosed(object sender, FormClosedEventArgs e)
|
||||
@@ -1206,8 +1388,136 @@ namespace nspector
|
||||
{
|
||||
CopyModifiedSettingsToClipBoard();
|
||||
}
|
||||
|
||||
else if (e.Control && e.Alt && e.KeyCode == Keys.D)
|
||||
{
|
||||
ToggleDevMode();
|
||||
}
|
||||
|
||||
else if (Debugger.IsAttached && e.Control && e.KeyCode == Keys.T)
|
||||
{
|
||||
TestStoreSettings();
|
||||
}
|
||||
|
||||
else if (e.Control && e.KeyCode == Keys.F)
|
||||
{
|
||||
txtFilter.Focus();
|
||||
}
|
||||
|
||||
else if (e.KeyCode == Keys.Escape)
|
||||
{
|
||||
txtFilter.Text = "";
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
|
||||
else if (!e.Control && (e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z ||
|
||||
e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9 ||
|
||||
e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9 ||
|
||||
e.KeyCode == Keys.Space || e.KeyCode == Keys.OemPeriod ||
|
||||
e.KeyCode == Keys.Back))
|
||||
{
|
||||
txtFilter.Focus();
|
||||
if (e.KeyCode == Keys.Back)
|
||||
{
|
||||
if (txtFilter.Text.Length > 0)
|
||||
{
|
||||
txtFilter.Text = txtFilter.Text.Substring(0, txtFilter.Text.Length - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
txtFilter.Text += e.Shift ? e.KeyCode.ToString() : e.KeyCode.ToString().ToLower();
|
||||
}
|
||||
txtFilter.SelectionStart = txtFilter.Text.Length;
|
||||
e.SuppressKeyPress = true;
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async void txtFilter_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshCurrentProfile();
|
||||
|
||||
if(!string.IsNullOrEmpty(txtFilter.Text))
|
||||
txtFilter.Focus(); // Setting listbox sometimes steals focus away
|
||||
}
|
||||
|
||||
private void ToggleDevMode()
|
||||
{
|
||||
_isDevMode = !_isDevMode;
|
||||
if (_isDevMode)
|
||||
{
|
||||
lvSettings.Font = new Font("Consolas", 9);
|
||||
cbValues.Font = new Font("Consolas", 9);
|
||||
lvSettings.HeaderStyle = ColumnHeaderStyle.Nonclickable;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvSettings.Font = null;
|
||||
cbValues.Font = null;
|
||||
lvSettings.HeaderStyle = ColumnHeaderStyle.None;
|
||||
}
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
|
||||
private void TestStoreSettings()
|
||||
{
|
||||
var sbSettings = new StringBuilder();
|
||||
sbSettings.AppendFormat("{0,-40} {1}\r\n", "### Inspector Store Failed ###", _CurrentProfile);
|
||||
|
||||
pbMain.Minimum = 0;
|
||||
pbMain.Maximum = lvSettings.Items.Count;
|
||||
int cntIndex = 0;
|
||||
|
||||
foreach (ListViewGroup group in lvSettings.Groups)
|
||||
{
|
||||
bool groupTitleAdded = false;
|
||||
foreach (ListViewItem item in group.Items)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
pbMain.Value = cntIndex++;
|
||||
|
||||
var settingId = (uint)item.Tag;
|
||||
var meta = _meta.GetSettingMeta(settingId);
|
||||
if (meta.SettingType != NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE) continue;
|
||||
|
||||
var wasNotSet = new int[] { 1, 2, 3 }.Contains(item.ImageIndex);
|
||||
|
||||
if (wasNotSet)
|
||||
{
|
||||
_drs.SetDwordValueToProfile(_CurrentProfile, settingId, 0x0);
|
||||
_drs.ResetValue(_CurrentProfile, settingId, out var rm);
|
||||
}
|
||||
else
|
||||
{
|
||||
var tmpValue = _drs.GetDwordValueFromProfile(_CurrentProfile, settingId);
|
||||
_drs.SetDwordValueToProfile(_CurrentProfile, settingId, 0x0);
|
||||
_drs.SetDwordValueToProfile(_CurrentProfile, settingId, tmpValue);
|
||||
}
|
||||
|
||||
}
|
||||
catch (NvapiException ne)
|
||||
{
|
||||
if (!groupTitleAdded)
|
||||
{
|
||||
sbSettings.AppendFormat("\r\n[{0}]\r\n", group.Header);
|
||||
groupTitleAdded = true;
|
||||
}
|
||||
sbSettings.AppendFormat("{0,-40} SettingId: {1} Failed: {2}\r\n", item.Text, DrsUtil.GetDwordString((uint)item.Tag), ne.Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pbMain.Value = 0;
|
||||
|
||||
Clipboard.SetText(sbSettings.ToString());
|
||||
MessageBox.Show("Failed Settings Stored to Clipboard");
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void CopyModifiedSettingsToClipBoard()
|
||||
{
|
||||
var sbSettings = new StringBuilder();
|
||||
@@ -1230,7 +1540,18 @@ namespace nspector
|
||||
}
|
||||
|
||||
Clipboard.SetText(sbSettings.ToString());
|
||||
}
|
||||
|
||||
private void txtFilter_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Escape)
|
||||
{
|
||||
txtFilter.Text = "";
|
||||
}
|
||||
else if (e.Control && e.Alt && e.KeyCode == Keys.D)
|
||||
{
|
||||
ToggleDevMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADI
|
||||
DAAAAk1TRnQBSQFMAgEBBAEAAagBBwGoAQcBEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA
|
||||
DAAAAk1TRnQBSQFMAgEBBAEAAcABBwHAAQcBEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA
|
||||
AwABIAMAAQEBAAEYBgABGP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/ADMAAcgBvQGvAacBkQF5BgAD/iEA
|
||||
A+QD2gYAA/4hAAGXAcMBqwFMAZwBcAYAA/4hAAOmA2gGAAP+FQAB8gHxAfABqQGPAXQBzwHHAbwD/wG6
|
||||
AaUBjAGuAZQBeAHxAe8B7QHvAe0B6wGhAYgBbQHkAeAB2xIAA/UD3QPmA/8D4APeA/QD8wPaA+4SAAHt
|
||||
@@ -195,7 +195,7 @@
|
||||
<data name="tsbRefreshProfile.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAGgSURBVDhPrZPLSsNAFIb7BoKP4Upw5UoQBHfmMrG1olCa
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGgSURBVDhPrZPLSsNAFIb7BoKP4Upw5UoQBHfmMrG1olCa
|
||||
pFoExY2KiHcRERFEwYUKglSQesFeQK2rFkFr0Y26MRAKpa2+QS+/MzGpaS114wdhQv7/nDknZ8bx7xDi
|
||||
a+FFeYvnFU2QFHCcRxdEOcQTmTctjWHB4UgM2Wwe5XIZ+fwnko/PWF3bhiAqJzRRp2mtD0/U7oWlTbAK
|
||||
Bj1jYO/vmo5SqYR44gG9fcPgiNpu2uvDkrCVEG+zIMkqcfqQuEuiWCwidhsHJ8qHhtEOLX2H9cxW81MF
|
||||
@@ -208,7 +208,7 @@
|
||||
<data name="tsbRestoreProfile.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAFcSURBVDhP3VFNK0RhFL4/wNbM3PdcCgsfsbHDgkJKWPgD
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFcSURBVDhP3VFNK0RhFL4/wNbM3PdcCgsfsbHDgkJKWPgD
|
||||
ilJGNN73XEs/gbKUmvITuPc9d5iwYKfZyULZ26BkhTjnnXs1TWTNqafOx/M895z3ev84FsrwigQfvyGl
|
||||
1yNM1IyO4cQNrUKdqGFj1awmuGgWZnDC9Wouz8U1xnATkj+oE78HLVyWKPeAlH9EUkOa1FyzWOAxeVIS
|
||||
JuxtRoVeERhS51zviLlsIHNjYRltW1ejWOChDdbqhEIfRoVbE0PZbXXoP3G/ygZFNyeYZ4xlwgzC9fAI
|
||||
@@ -220,7 +220,7 @@
|
||||
<data name="tsbCreateProfile.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAEgSURBVDhP3Y/PKwRhHIf3f5g/wMWUlIuDUk5y5MCB3Dk4
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEgSURBVDhP3Y/PKwRhHIf3f5g/wMWUlIuDUk5y5MCB3Dk4
|
||||
7EUbBwdXJ3EXsksjidlk2x27NrXt5kdjlTQXbSFK2iaGaX7s491Zjppx5FNP7/et9/n0fmP/PFwu8JGd
|
||||
5OsaLdxpNIyVQPL1GcyDwWDmVsEx1sLLGvdHeLtduKVh/GIPTlbGPRvF3mmjXm0Vh8a9SEBGAl1gCMoS
|
||||
j2p/uOyX5/AK4/i5bqgI8UrQPFUJO9mOr43gHk/9XOToy9QLCd4O+yAvxCb7gg0JK9WJqcWxTubDf+Kd
|
||||
@@ -237,7 +237,7 @@
|
||||
<data name="toolStripButton5.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
||||
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
||||
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
||||
@@ -252,7 +252,7 @@
|
||||
<data name="toolStripButton6.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
||||
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
||||
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
||||
@@ -282,7 +282,4 @@
|
||||
<metadata name="lblWidth30.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="lvSettings.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>nspector</RootNamespace>
|
||||
<AssemblyName>nvidiaProfileInspector</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<TargetFrameworkProfile />
|
||||
@@ -93,7 +93,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;RELEASE</DefineConstants>
|
||||
<Optimize>false</Optimize>
|
||||
<DebugType>none</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -123,6 +123,7 @@
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
@@ -135,6 +136,9 @@
|
||||
<Compile Include="Common\DrsSessionScope.cs" />
|
||||
<Compile Include="Common\DrsSettingsMetaService.cs" />
|
||||
<Compile Include="Common\DrsUtil.cs" />
|
||||
<Compile Include="Common\Helper\DlssHelper.cs" />
|
||||
<Compile Include="Common\Helper\DropDownMenuScrollWheelHandler.cs" />
|
||||
<Compile Include="Common\Helper\GithubVersionHelper.cs" />
|
||||
<Compile Include="Common\Helper\ListViewGroupSorter.cs" />
|
||||
<Compile Include="Common\Helper\ShortcutResolver.cs" />
|
||||
<Compile Include="Common\Helper\SteamAppResolver.cs" />
|
||||
@@ -142,7 +146,6 @@
|
||||
<Compile Include="Common\Helper\UserSettings.cs" />
|
||||
<Compile Include="Common\Import\ImportExportUitl.cs" />
|
||||
<Compile Include="Common\Import\SettingValueType.cs" />
|
||||
<Compile Include="Common\Meta\NvD3dUmxSettingMetaService.cs" />
|
||||
<Compile Include="Common\Meta\MetaServiceItem.cs" />
|
||||
<Compile Include="Common\Meta\ConstantSettingMetaService.cs" />
|
||||
<Compile Include="Common\Meta\CustomSettingMetaService.cs" />
|
||||
@@ -204,6 +207,9 @@
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="WatermarkTextBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="frmBitEditor.resx">
|
||||
<DependentUpon>frmBitEditor.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -226,6 +232,7 @@
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<None Include="app.manifest">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.3.32929.385
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nvidiaProfileInspector", "nspector\nvidiaProfileInspector.csproj", "{27B20027-E783-4ADC-AF16-40A49463F4BF}"
|
||||
EndProject
|
||||
@@ -19,4 +19,7 @@ Global
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7FB061B1-515F-4B0E-B49F-552DFCA05527}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Reference in New Issue
Block a user