mirror of
https://github.com/Orbmu2k/nvidiaProfileInspector.git
synced 2026-01-04 12:58:14 -05:00
Compare commits
79 Commits
RELEASE_2.
...
2.3.0.12
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2f71c5d1e | ||
|
|
a4ea01dfd1 | ||
|
|
9adc3b9cb9 | ||
|
|
57a8879a2c | ||
|
|
c47e69d81c | ||
|
|
21674d3f09 | ||
|
|
b5a13cf6fe | ||
|
|
c222cf1b06 | ||
|
|
6d3237bfeb | ||
|
|
5dbb8ef721 | ||
|
|
fcd9ef5346 | ||
|
|
67bb397b6a | ||
|
|
ffff16ca83 | ||
|
|
cd8caa5702 | ||
|
|
2d57d6b885 | ||
|
|
84749fdf5f | ||
|
|
b651dae816 | ||
|
|
0a27ce1c36 | ||
|
|
499cdde758 | ||
|
|
cedcd4e2c6 | ||
|
|
5301c52c16 | ||
|
|
bf8243adaf | ||
|
|
854cc3d0ee | ||
|
|
f1ecca7985 | ||
|
|
1af9d1c4fb | ||
|
|
2383de09ce | ||
|
|
210d5ea25f | ||
|
|
0104d929e9 | ||
|
|
786423f2d2 | ||
|
|
1152aeeae9 | ||
|
|
c1a75b9a2f | ||
|
|
ce1f79fd76 | ||
|
|
d5f993b63a | ||
|
|
6e0c64bf42 | ||
|
|
1f1841cb9f | ||
|
|
ef00e39885 | ||
|
|
972174acbf | ||
|
|
db44bff36d | ||
|
|
b90649ee5c | ||
|
|
c81f0f32f3 | ||
|
|
51b8d44bc2 | ||
|
|
374ce1ea87 | ||
|
|
0f6a0f5fef | ||
|
|
226ef295ab | ||
|
|
c207f45a2d | ||
|
|
27af02b9ce | ||
|
|
baf4a30a4b | ||
|
|
ee42348cbb | ||
|
|
58a52d2656 | ||
|
|
abeb84543e | ||
|
|
7248f29fdb | ||
|
|
e1ebccc82f | ||
|
|
4aeb5eb096 | ||
|
|
1426b82669 | ||
|
|
5d9e39b63d | ||
|
|
0807f4b635 | ||
|
|
0f6a23ef70 | ||
|
|
46c80189c1 | ||
|
|
a49416ae73 | ||
|
|
358c800e20 | ||
|
|
d6bd204665 | ||
|
|
4b3a74a3ba | ||
|
|
33bba3484b | ||
|
|
98eac09061 | ||
|
|
60ee8949a6 | ||
|
|
ca7d1a49b2 | ||
|
|
6451887245 | ||
|
|
ceddbf3878 | ||
|
|
a6ca8d4ce2 | ||
|
|
093deb3982 | ||
|
|
220db7e9da | ||
|
|
f4d9443012 | ||
|
|
69b588d47c | ||
|
|
865fb95735 | ||
|
|
56f20f2777 | ||
|
|
228e7aeafb | ||
|
|
0f9f8bd440 | ||
|
|
9fb029db52 | ||
|
|
935d46ea13 |
12
README.md
12
README.md
@@ -1 +1,11 @@
|
||||
# nvidiaProfileInspector
|
||||
 **NVIDIA Profile Inspector**
|
||||
|
||||
This tool is used for modifying game profiles inside the internal driver database of the nvidia driver.
|
||||
All game profiles are provided by the nvidia driver, but you can add your own profiles for games missing in the driver database.
|
||||
You also have access to hidden and undocumented settings, which are not provided by the drivers control panel.
|
||||
|
||||
For more information how to use this tool, you can find some very good wikis here:
|
||||
* https://wiki.step-project.com/Guide:NVIDIA_Inspector
|
||||
* https://www.pcgamingwiki.com/wiki/Nvidia_Profile_Inspector
|
||||
|
||||

|
||||
BIN
npi_screenshot.png
Normal file
BIN
npi_screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 109 KiB |
@@ -3,18 +3,10 @@ using System.Text;
|
||||
|
||||
namespace nspector.Common
|
||||
{
|
||||
internal class CachedSettingValue : IComparable<CachedSettingValue>
|
||||
internal class CachedSettingValue
|
||||
{
|
||||
|
||||
public int CompareTo(CachedSettingValue other)
|
||||
{
|
||||
if (IsStringValue)
|
||||
return ValueStr.CompareTo(other.ValueStr);
|
||||
else
|
||||
return Value.CompareTo(other.Value);
|
||||
}
|
||||
|
||||
internal CachedSettingValue() { }
|
||||
internal CachedSettingValue() { }
|
||||
|
||||
internal CachedSettingValue(uint Value, string ProfileNames)
|
||||
{
|
||||
@@ -25,15 +17,21 @@ namespace nspector.Common
|
||||
|
||||
internal CachedSettingValue(string ValueStr, string ProfileNames)
|
||||
{
|
||||
IsStringValue = true;
|
||||
this.ValueStr = ValueStr;
|
||||
this.ProfileNames = new StringBuilder(ProfileNames);
|
||||
this.ValueProfileCount = 1;
|
||||
}
|
||||
|
||||
internal readonly bool IsStringValue = false;
|
||||
internal CachedSettingValue(byte[] ValueBin, string ProfileNames)
|
||||
{
|
||||
this.ValueBin = ValueBin;
|
||||
this.ProfileNames = new StringBuilder(ProfileNames);
|
||||
this.ValueProfileCount = 1;
|
||||
}
|
||||
|
||||
internal string ValueStr = "";
|
||||
internal uint Value = 0;
|
||||
internal byte[] ValueBin = new byte[0];
|
||||
internal StringBuilder ProfileNames;
|
||||
internal uint ValueProfileCount;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
@@ -52,5 +52,21 @@ namespace nspector.Common
|
||||
}
|
||||
ProfileCount++;
|
||||
}
|
||||
|
||||
internal void AddBinaryValue(byte[] valueBin, string Profile)
|
||||
{
|
||||
|
||||
var setting = SettingValues.FirstOrDefault(s => s.ValueBin.SequenceEqual(valueBin));
|
||||
if (setting == null)
|
||||
{
|
||||
SettingValues.Add(new CachedSettingValue(valueBin, Profile));
|
||||
}
|
||||
else
|
||||
{
|
||||
setting.ProfileNames.Append(", " + Profile);
|
||||
setting.ValueProfileCount++;
|
||||
}
|
||||
ProfileCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace nspector.Common.CustomSettings
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
146
nspector/Common/DrsDecrypterService.cs
Normal file
146
nspector/Common/DrsDecrypterService.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using nspector.Common.Helper;
|
||||
using nspector.Native.NVAPI2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace nspector.Common
|
||||
{
|
||||
internal class DrsDecrypterService : DrsSettingsServiceBase
|
||||
{
|
||||
|
||||
private static readonly byte[] _InternalSettingsKey = new byte[] {
|
||||
0x2f, 0x7c, 0x4f, 0x8b, 0x20, 0x24, 0x52, 0x8d, 0x26, 0x3c, 0x94, 0x77, 0xf3, 0x7c, 0x98, 0xa5,
|
||||
0xfa, 0x71, 0xb6, 0x80, 0xdd, 0x35, 0x84, 0xba, 0xfd, 0xb6, 0xa6, 0x1b, 0x39, 0xc4, 0xcc, 0xb0,
|
||||
0x7e, 0x95, 0xd9, 0xee, 0x18, 0x4b, 0x9c, 0xf5, 0x2d, 0x4e, 0xd0, 0xc1, 0x55, 0x17, 0xdf, 0x18,
|
||||
0x1e, 0x0b, 0x18, 0x8b, 0x88, 0x58, 0x86, 0x5a, 0x1e, 0x03, 0xed, 0x56, 0xfb, 0x16, 0xfe, 0x8a,
|
||||
0x01, 0x32, 0x9c, 0x8d, 0xf2, 0xe8, 0x4a, 0xe6, 0x90, 0x8e, 0x15, 0x68, 0xe8, 0x2d, 0xf4, 0x40,
|
||||
0x37, 0x9a, 0x72, 0xc7, 0x02, 0x0c, 0xd1, 0xd3, 0x58, 0xea, 0x62, 0xd1, 0x98, 0x36, 0x2b, 0xb2,
|
||||
0x16, 0xd5, 0xde, 0x93, 0xf1, 0xba, 0x74, 0xe3, 0x32, 0xc4, 0x9f, 0xf6, 0x12, 0xfe, 0x18, 0xc0,
|
||||
0xbb, 0x35, 0x79, 0x9c, 0x6b, 0x7a, 0x23, 0x7f, 0x2b, 0x15, 0x9b, 0x42, 0x07, 0x1a, 0xff, 0x69,
|
||||
0xfb, 0x9c, 0xbd, 0x23, 0x97, 0xa8, 0x22, 0x63, 0x8f, 0x32, 0xc8, 0xe9, 0x9b, 0x63, 0x1c, 0xee,
|
||||
0x2c, 0xd9, 0xed, 0x8d, 0x3a, 0x35, 0x9c, 0xb1, 0x60, 0xae, 0x5e, 0xf5, 0x97, 0x6b, 0x9f, 0x20,
|
||||
0x8c, 0xf7, 0x98, 0x2c, 0x43, 0x79, 0x95, 0x1d, 0xcd, 0x46, 0x36, 0x6c, 0xd9, 0x67, 0x20, 0xab,
|
||||
0x41, 0x22, 0x21, 0xe5, 0x55, 0x82, 0xf5, 0x27, 0x20, 0xf5, 0x08, 0x07, 0x3f, 0x6d, 0x69, 0xd9,
|
||||
0x1c, 0x4b, 0xf8, 0x26, 0x03, 0x6e, 0xb2, 0x3f, 0x1e, 0xe6, 0xca, 0x3d, 0x61, 0x44, 0xb0, 0x92,
|
||||
0xaf, 0xf0, 0x88, 0xca, 0xe0, 0x5f, 0x5d, 0xf4, 0xdf, 0xc6, 0x4c, 0xa4, 0xe0, 0xca, 0xb0, 0x20,
|
||||
0x5d, 0xc0, 0xfa, 0xdd, 0x9a, 0x34, 0x8f, 0x50, 0x79, 0x5a, 0x5f, 0x7c, 0x19, 0x9e, 0x40, 0x70,
|
||||
0x71, 0xb5, 0x45, 0x19, 0xb8, 0x53, 0xfc, 0xdf, 0x24, 0xbe, 0x22, 0x1c, 0x79, 0xbf, 0x42, 0x89 };
|
||||
|
||||
public DrsDecrypterService(DrsSettingsMetaService metaService) : base(metaService)
|
||||
{
|
||||
try
|
||||
{
|
||||
CreateInternalSettingMap();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private uint GetDwordFromKey(uint offset)
|
||||
{
|
||||
var bytes = new byte[4];
|
||||
bytes[0] = _InternalSettingsKey[(offset + 0) % 256];
|
||||
bytes[1] = _InternalSettingsKey[(offset + 1) % 256];
|
||||
bytes[2] = _InternalSettingsKey[(offset + 2) % 256];
|
||||
bytes[3] = _InternalSettingsKey[(offset + 3) % 256];
|
||||
return BitConverter.ToUInt32(bytes, 0);
|
||||
}
|
||||
|
||||
public uint DecryptDwordValue(uint orgValue, uint settingId)
|
||||
{
|
||||
var keyOffset = (settingId << 1);
|
||||
var key = GetDwordFromKey(keyOffset);
|
||||
return orgValue ^ key;
|
||||
}
|
||||
|
||||
public string DecryptStringValue(byte[] rawData, uint settingId)
|
||||
{
|
||||
var keyOffset = (settingId << 1);
|
||||
for (uint i = 0; i < (uint)rawData.Length; i++)
|
||||
{
|
||||
rawData[i] ^= _InternalSettingsKey[(keyOffset + i) % 256];
|
||||
}
|
||||
return Encoding.Unicode.GetString(rawData).Trim('\0');
|
||||
}
|
||||
|
||||
public void DecryptSettingIfNeeded(string profileName, ref NVDRS_SETTING setting)
|
||||
{
|
||||
if (setting.isPredefinedValid == 1)
|
||||
{
|
||||
if (IsInternalSetting(profileName, setting.settingId))
|
||||
{
|
||||
if (setting.settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE)
|
||||
{
|
||||
setting.predefinedValue.stringValue = DecryptStringValue(setting.predefinedValue.rawData, setting.settingId);
|
||||
if (setting.isCurrentPredefined == 1)
|
||||
setting.currentValue.stringValue = DecryptStringValue(setting.currentValue.rawData, setting.settingId);
|
||||
}
|
||||
else if (setting.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE)
|
||||
{
|
||||
setting.predefinedValue.dwordValue = DecryptDwordValue(setting.predefinedValue.dwordValue, setting.settingId);
|
||||
if (setting.isCurrentPredefined == 1)
|
||||
setting.currentValue.dwordValue = DecryptDwordValue(setting.currentValue.dwordValue, setting.settingId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string FormatInternalSettingKey(string profileName, uint settingId)
|
||||
{
|
||||
return profileName + settingId.ToString("X8").ToLower();
|
||||
}
|
||||
|
||||
public bool IsInternalSetting(string profileName, uint settingId)
|
||||
{
|
||||
return _InternalSettings.Contains(FormatInternalSettingKey(profileName, settingId));
|
||||
}
|
||||
|
||||
private HashSet<string> _InternalSettings = new HashSet<string>();
|
||||
|
||||
private void CreateInternalSettingMap()
|
||||
{
|
||||
string tmpfile = TempFile.GetTempFileName();
|
||||
|
||||
try
|
||||
{
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
SaveSettingsFileEx(hSession, tmpfile);
|
||||
});
|
||||
|
||||
if (File.Exists(tmpfile))
|
||||
{
|
||||
var lines = File.ReadAllLines(tmpfile);
|
||||
|
||||
_InternalSettings = new HashSet<string>();
|
||||
|
||||
var paProfile = "Profile\\s\\\"(?<profileName>.*?)\\\"";
|
||||
var rxProfile = new Regex(paProfile, RegexOptions.Compiled);
|
||||
|
||||
var paSetting = "ID_0x(?<sid>[0-9a-fA-F]+)\\s\\=.*?InternalSettingFlag\\=V0";
|
||||
var rxSetting = new Regex(paSetting, RegexOptions.Compiled);
|
||||
|
||||
var currentProfileName = "";
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
foreach (Match ms in rxProfile.Matches(lines[i]))
|
||||
{
|
||||
currentProfileName = ms.Result("${profileName}");
|
||||
}
|
||||
foreach (Match ms in rxSetting.Matches(lines[i]))
|
||||
{
|
||||
_InternalSettings.Add(currentProfileName + ms.Result("${sid}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(tmpfile))
|
||||
File.Delete(tmpfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -14,11 +13,19 @@ namespace nspector.Common
|
||||
{
|
||||
|
||||
private readonly DrsSettingsService _SettingService;
|
||||
private readonly DrsScannerService _ScannerService;
|
||||
private readonly DrsDecrypterService _DecrypterService;
|
||||
|
||||
public DrsImportService(DrsSettingsMetaService metaService, DrsSettingsService settingService)
|
||||
public DrsImportService(
|
||||
DrsSettingsMetaService metaService,
|
||||
DrsSettingsService settingService,
|
||||
DrsScannerService scannerService,
|
||||
DrsDecrypterService decrypterService)
|
||||
: base(metaService)
|
||||
{
|
||||
_SettingService = settingService;
|
||||
_ScannerService = scannerService;
|
||||
_DecrypterService = decrypterService;
|
||||
}
|
||||
|
||||
internal void ExportAllProfilesToNvidiaTextFile(string filename)
|
||||
@@ -35,7 +42,7 @@ namespace nspector.Common
|
||||
{
|
||||
LoadSettingsFileEx(hSession, filename);
|
||||
SaveSettings(hSession);
|
||||
});
|
||||
}, forceNonGlobalSession: true, preventLoadSettings: true);
|
||||
}
|
||||
|
||||
internal void ExportProfiles(List<string> profileNames, string filename, bool includePredefined)
|
||||
@@ -62,70 +69,98 @@ namespace nspector.Common
|
||||
if (hProfile != IntPtr.Zero)
|
||||
{
|
||||
|
||||
var settings = GetProfileSettings(hSession, hProfile);
|
||||
if (settings.Count > 0)
|
||||
result.ProfileName = profileName;
|
||||
|
||||
var apps = GetProfileApplications(hSession, hProfile);
|
||||
foreach (var app in apps)
|
||||
{
|
||||
result.ProfileName = profileName;
|
||||
result.Executeables.Add(app.appName);
|
||||
}
|
||||
|
||||
var apps = GetProfileApplications(hSession, hProfile);
|
||||
foreach (var app in apps)
|
||||
var settings = GetProfileSettings(hSession, hProfile);
|
||||
foreach (var setting in settings)
|
||||
{
|
||||
var isPredefined = setting.isCurrentPredefined == 1;
|
||||
var isCurrentProfile = setting.settingLocation ==
|
||||
NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION;
|
||||
|
||||
if (isCurrentProfile && (!isPredefined || includePredefined))
|
||||
{
|
||||
result.Executeables.Add(app.appName);
|
||||
}
|
||||
var exportSetting = setting;
|
||||
_DecrypterService.DecryptSettingIfNeeded(profileName, ref exportSetting);
|
||||
|
||||
foreach (var setting in settings)
|
||||
{
|
||||
var isPredefined = setting.isCurrentPredefined == 1;
|
||||
var isDwordSetting = setting.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
|
||||
var isCurrentProfile = setting.settingLocation ==
|
||||
NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION;
|
||||
var profileSetting = ImportExportUitl
|
||||
.ConvertDrsSettingToProfileSetting(exportSetting);
|
||||
|
||||
if (isDwordSetting && isCurrentProfile)
|
||||
{
|
||||
if (!isPredefined || includePredefined)
|
||||
{
|
||||
var profileSetting = new ProfileSetting()
|
||||
{
|
||||
SettingNameInfo = setting.settingName,
|
||||
SettingId = setting.settingId,
|
||||
SettingValue = setting.currentValue.dwordValue,
|
||||
};
|
||||
result.Settings.Add(profileSetting);
|
||||
}
|
||||
}
|
||||
result.Settings.Add(profileSetting);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void ImportProfiles(string filename)
|
||||
internal string ImportProfiles(string filename)
|
||||
{
|
||||
var sbFailedProfilesMessage = new StringBuilder();
|
||||
var appInUseHint = false;
|
||||
var profiles = XMLHelper<Profiles>.DeserializeFromXMLFile(filename);
|
||||
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
foreach (Profile profile in profiles)
|
||||
{
|
||||
var profileCreated = false;
|
||||
var hProfile = GetProfileHandle(hSession, profile.ProfileName);
|
||||
if (hProfile == IntPtr.Zero)
|
||||
{
|
||||
hProfile = CreateProfile(hSession, profile.ProfileName);
|
||||
nvw.DRS_SaveSettings(hSession);
|
||||
profileCreated = true;
|
||||
}
|
||||
|
||||
if (hProfile != IntPtr.Zero)
|
||||
{
|
||||
var modified = false;
|
||||
_SettingService.ResetProfile(profile.ProfileName, out modified);
|
||||
try
|
||||
{
|
||||
UpdateApplications(hSession, hProfile, profile);
|
||||
UpdateSettings(hSession, hProfile, profile, profile.ProfileName);
|
||||
}
|
||||
catch (NvapiException nex)
|
||||
{
|
||||
if (profileCreated)
|
||||
{
|
||||
nvw.DRS_DeleteProfile(hSession, hProfile);
|
||||
}
|
||||
|
||||
UpdateApplications(hSession, hProfile, profile);
|
||||
UpdateSettings(hSession, hProfile, profile);
|
||||
sbFailedProfilesMessage.AppendLine(string.Format("Failed to import profile '{0}'", profile.ProfileName));
|
||||
var appEx = nex as NvapiAddApplicationException;
|
||||
if (appEx != null)
|
||||
{
|
||||
var profilesWithThisApp = _ScannerService.FindProfilesUsingApplication(appEx.ApplicationName);
|
||||
sbFailedProfilesMessage.AppendLine(string.Format("- application '{0}' is already in use by profile '{1}'", appEx.ApplicationName, profilesWithThisApp));
|
||||
appInUseHint = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sbFailedProfilesMessage.AppendLine(string.Format("- {0}", nex.Message));
|
||||
}
|
||||
sbFailedProfilesMessage.AppendLine("");
|
||||
}
|
||||
nvw.DRS_SaveSettings(hSession);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (appInUseHint)
|
||||
{
|
||||
sbFailedProfilesMessage.AppendLine("Hint: If just the profile name has been changed by nvidia, consider to manually modify the profile name inside the import file using a text editor.");
|
||||
}
|
||||
|
||||
return sbFailedProfilesMessage.ToString();
|
||||
}
|
||||
|
||||
private bool ExistsImportApp(string appName, Profile importProfile)
|
||||
@@ -150,7 +185,14 @@ namespace nspector.Common
|
||||
{
|
||||
if (!alreadySet.Contains(appName))
|
||||
{
|
||||
AddApplication(hSession, hProfile, appName);
|
||||
try
|
||||
{
|
||||
AddApplication(hSession, hProfile, appName);
|
||||
}
|
||||
catch (NvapiException)
|
||||
{
|
||||
throw new NvapiAddApplicationException(appName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,18 +203,24 @@ namespace nspector.Common
|
||||
.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
|
||||
if (setting != null)
|
||||
return setting.SettingValue;
|
||||
return uint.Parse(setting.SettingValue);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private ProfileSetting GetImportProfileSetting(uint settingId, Profile importProfile)
|
||||
{
|
||||
return importProfile.Settings
|
||||
.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
}
|
||||
|
||||
private bool ExistsImportValue(uint settingId, Profile importProfile)
|
||||
{
|
||||
return importProfile.Settings
|
||||
.Any(x => x.SettingId.Equals(settingId));
|
||||
}
|
||||
|
||||
private void UpdateSettings(IntPtr hSession, IntPtr hProfile, Profile importProfile)
|
||||
private void UpdateSettings(IntPtr hSession, IntPtr hProfile, Profile importProfile, string profileName)
|
||||
{
|
||||
var alreadySet = new HashSet<uint>();
|
||||
|
||||
@@ -180,20 +228,24 @@ namespace nspector.Common
|
||||
foreach (var setting in settings)
|
||||
{
|
||||
var isCurrentProfile = setting.settingLocation == NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION;
|
||||
var isDwordSetting = setting.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
|
||||
var isPredefined = setting.isCurrentPredefined == 1;
|
||||
|
||||
if (isCurrentProfile && isDwordSetting)
|
||||
if (isCurrentProfile)
|
||||
{
|
||||
bool exitsValue = ExistsImportValue(setting.settingId, importProfile);
|
||||
uint importValue = GetImportValue(setting.settingId, importProfile);
|
||||
if (isPredefined && exitsValue && importValue == setting.currentValue.dwordValue)
|
||||
bool exitsValueInImport = ExistsImportValue(setting.settingId, importProfile);
|
||||
var importSetting = GetImportProfileSetting(setting.settingId, importProfile);
|
||||
|
||||
var decryptedSetting = setting;
|
||||
_DecrypterService.DecryptSettingIfNeeded(profileName, ref decryptedSetting);
|
||||
|
||||
if (isPredefined && exitsValueInImport && ImportExportUitl.AreDrsSettingEqualToProfileSetting(decryptedSetting, importSetting))
|
||||
{
|
||||
alreadySet.Add(setting.settingId);
|
||||
}
|
||||
else if (exitsValue)
|
||||
else if (exitsValueInImport)
|
||||
{
|
||||
StoreDwordValue(hSession, hProfile, setting.settingId, importValue);
|
||||
var updatedSetting = ImportExportUitl.ConvertProfileSettingToDrsSetting(importSetting);
|
||||
StoreSetting(hSession, hProfile, updatedSetting);
|
||||
alreadySet.Add(setting.settingId);
|
||||
}
|
||||
else if (!isPredefined)
|
||||
@@ -207,7 +259,16 @@ namespace nspector.Common
|
||||
{
|
||||
if (!alreadySet.Contains(setting.SettingId))
|
||||
{
|
||||
StoreDwordValue(hSession, hProfile, setting.SettingId, setting.SettingValue);
|
||||
var newSetting = ImportExportUitl.ConvertProfileSettingToDrsSetting(setting);
|
||||
try
|
||||
{
|
||||
StoreSetting(hSession, hProfile, newSetting);
|
||||
}
|
||||
catch (NvapiException ex)
|
||||
{
|
||||
if (ex.Status != NvAPI_Status.NVAPI_SETTING_NOT_FOUND)
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +1,34 @@
|
||||
using System;
|
||||
using nspector.Common.Helper;
|
||||
using nspector.Native.NVAPI2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using nspector.Common.Import;
|
||||
using nspector.Native.NVAPI2;
|
||||
using System.Threading.Tasks;
|
||||
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
|
||||
using nspector.Common.Helper;
|
||||
|
||||
namespace nspector.Common
|
||||
{
|
||||
|
||||
internal delegate void SettingScanDoneEvent();
|
||||
internal delegate void SettingScanProgressEvent(int percent);
|
||||
|
||||
internal class DrsScannerService : DrsSettingsServiceBase
|
||||
{
|
||||
|
||||
public DrsScannerService(DrsSettingsMetaService metaService)
|
||||
: base(metaService)
|
||||
public DrsScannerService(DrsSettingsMetaService metaService, DrsDecrypterService decrpterService)
|
||||
: base(metaService, decrpterService)
|
||||
{ }
|
||||
|
||||
public event SettingScanDoneEvent OnModifiedProfilesScanDone;
|
||||
public event SettingScanDoneEvent OnPredefinedSettingsScanDone;
|
||||
public event SettingScanProgressEvent OnSettingScanProgress;
|
||||
|
||||
internal List<CachedSettings> CachedSettings = new List<CachedSettings>();
|
||||
internal List<string> ModifiedProfiles = new List<string>();
|
||||
internal HashSet<string> UserProfiles = new HashSet<string>();
|
||||
|
||||
// most common setting ids as start pattern for the heuristic scan
|
||||
private readonly uint[] _commonSettingIds = new uint[] { 0x1095DEF8, 0x1033DCD2, 0x1033CEC1,
|
||||
0x10930F46, 0x00A06946, 0x10ECDB82, 0x20EBD7B8, 0x0095DEF9, 0x00D55F7D,
|
||||
0x1033DCD3, 0x1033CEC2, 0x2072F036, 0x00664339, 0x002C7F45, 0x209746C1,
|
||||
private readonly uint[] _commonSettingIds = new uint[] { 0x1095DEF8, 0x1033DCD2, 0x1033CEC1,
|
||||
0x10930F46, 0x00A06946, 0x10ECDB82, 0x20EBD7B8, 0x0095DEF9, 0x00D55F7D,
|
||||
0x1033DCD3, 0x1033CEC2, 0x2072F036, 0x00664339, 0x002C7F45, 0x209746C1,
|
||||
0x0076E164, 0x20FF7493, 0x204CFF7B };
|
||||
|
||||
|
||||
@@ -61,86 +55,82 @@ namespace nspector.Common
|
||||
}
|
||||
else if (addToScanResult)
|
||||
{
|
||||
if (decrypter != null)
|
||||
{
|
||||
decrypter.DecryptSettingIfNeeded(profile.profileName, ref setting);
|
||||
}
|
||||
|
||||
checkedSettingsCount++;
|
||||
AddScannedSettingToCache(profile, setting);
|
||||
alreadyCheckedSettingIds.Add(setting.settingId);
|
||||
return true;
|
||||
return (setting.isCurrentPredefined != 1);
|
||||
}
|
||||
else if (setting.isCurrentPredefined != 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ReportProgress(int current, int max)
|
||||
{
|
||||
int percent = (current > 0) ? (int)Math.Round((current * 100f) / max) : 0;
|
||||
|
||||
if (OnSettingScanProgress != null)
|
||||
OnSettingScanProgress(percent);
|
||||
|
||||
private int CalcPercent(int current, int max)
|
||||
{
|
||||
return (current > 0) ? (int)Math.Round((current * 100f) / max) : 0; ;
|
||||
}
|
||||
|
||||
private void ScanForModifiedProfiles()
|
||||
public async Task ScanProfileSettingsAsync(bool justModified, IProgress<int> progress, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
ModifiedProfiles = new List<string>();
|
||||
var knownPredefines = new List<uint>(_commonSettingIds);
|
||||
|
||||
DrsSession((hSession) =>
|
||||
await Task.Run(() =>
|
||||
{
|
||||
IntPtr hBaseProfile = GetProfileHandle(hSession, "");
|
||||
var profileHandles = EnumProfileHandles(hSession);
|
||||
ModifiedProfiles = new List<string>();
|
||||
UserProfiles = new HashSet<string>();
|
||||
var knownPredefines = new List<uint>(_commonSettingIds);
|
||||
|
||||
var maxProfileCount = profileHandles.Count;
|
||||
int curProfilePos = 0;
|
||||
|
||||
foreach (IntPtr hProfile in profileHandles)
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
ReportProgress(curProfilePos++, maxProfileCount);
|
||||
IntPtr hBaseProfile = GetProfileHandle(hSession, "");
|
||||
var profileHandles = EnumProfileHandles(hSession);
|
||||
|
||||
var profile = GetProfileInfo(hSession, hProfile);
|
||||
var maxProfileCount = profileHandles.Count;
|
||||
int curProfilePos = 0;
|
||||
|
||||
int checkedSettingsCount = 0;
|
||||
bool foundModifiedProfile = false;
|
||||
|
||||
if (profile.isPredefined == 0)
|
||||
foreach (IntPtr hProfile in profileHandles)
|
||||
{
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
continue;
|
||||
}
|
||||
if (token.IsCancellationRequested) break;
|
||||
|
||||
if ((hBaseProfile == hProfile || profile.numOfApps > 0) && profile.numOfSettings > 0)
|
||||
{
|
||||
progress?.Report(CalcPercent(curProfilePos++, maxProfileCount));
|
||||
|
||||
var profile = GetProfileInfo(hSession, hProfile);
|
||||
|
||||
int checkedSettingsCount = 0;
|
||||
var alreadyChecked = new List<uint>();
|
||||
|
||||
foreach (uint settingId in knownPredefines)
|
||||
bool foundModifiedProfile = false;
|
||||
if (profile.isPredefined == 0)
|
||||
{
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
UserProfiles.Add(profile.profileName);
|
||||
foundModifiedProfile = true;
|
||||
if (justModified) continue;
|
||||
}
|
||||
|
||||
|
||||
foreach (uint kpd in knownPredefines)
|
||||
{
|
||||
if (CheckCommonSetting(hSession, hProfile, profile,
|
||||
ref checkedSettingsCount, settingId, false, ref alreadyChecked))
|
||||
ref checkedSettingsCount, kpd, !justModified, ref alreadyChecked))
|
||||
{
|
||||
foundModifiedProfile = true;
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
break;
|
||||
if (!foundModifiedProfile)
|
||||
{
|
||||
foundModifiedProfile = true;
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
if (justModified) 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)
|
||||
if ((foundModifiedProfile && justModified) || checkedSettingsCount >= profile.numOfSettings)
|
||||
continue;
|
||||
|
||||
var settings = GetProfileSettings(hSession, hProfile);
|
||||
@@ -149,76 +139,25 @@ namespace nspector.Common
|
||||
if (knownPredefines.IndexOf(setting.settingId) < 0)
|
||||
knownPredefines.Add(setting.settingId);
|
||||
|
||||
if (!justModified && alreadyChecked.IndexOf(setting.settingId) < 0)
|
||||
AddScannedSettingToCache(profile, setting);
|
||||
|
||||
if (setting.isCurrentPredefined != 1)
|
||||
{
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
break;
|
||||
if (!foundModifiedProfile)
|
||||
{
|
||||
foundModifiedProfile = true;
|
||||
ModifiedProfiles.Add(profile.profileName);
|
||||
if (justModified) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
if (OnModifiedProfilesScanDone != null)
|
||||
OnModifiedProfilesScanDone();
|
||||
}
|
||||
|
||||
private void ScanForPredefinedProfileSettings()
|
||||
{
|
||||
var knownPredefines = new List<uint>(_commonSettingIds);
|
||||
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
var profileHandles = EnumProfileHandles(hSession);
|
||||
|
||||
var maxProfileCount = profileHandles.Count;
|
||||
int curProfilePos = 0;
|
||||
|
||||
foreach (IntPtr hProfile in profileHandles)
|
||||
{
|
||||
ReportProgress(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 (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 (alreadyChecked.IndexOf(setting.settingId) < 0)
|
||||
AddScannedSettingToCache(profile, setting);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (OnPredefinedSettingsScanDone != null)
|
||||
OnPredefinedSettingsScanDone();
|
||||
}
|
||||
|
||||
public void StartScanForModifiedProfilesAsync()
|
||||
{
|
||||
var thread = new Thread(ScanForModifiedProfiles);
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
public void StartScanForPredefinedSettingsAsync()
|
||||
{
|
||||
var thread = new Thread(ScanForPredefinedProfileSettings);
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
private void AddScannedSettingToCache(NVDRS_PROFILE profile, NVDRS_SETTING setting)
|
||||
{
|
||||
@@ -242,49 +181,59 @@ namespace nspector.Common
|
||||
if (allowAddValue)
|
||||
{
|
||||
if (setting.settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE)
|
||||
cachedSetting.AddStringValue(setting.currentValue.stringValue, profile.profileName);
|
||||
else
|
||||
cachedSetting.AddDwordValue(setting.currentValue.dwordValue, profile.profileName);
|
||||
cachedSetting.AddStringValue(setting.predefinedValue.stringValue, profile.profileName);
|
||||
else if (setting.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE)
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public string FindProfilesUsingApplication(string applicationName)
|
||||
{
|
||||
string lowerApplicationName = applicationName.ToLower();
|
||||
string tmpfile = Path.GetTempFileName();
|
||||
var result = new StringBuilder();
|
||||
string tmpfile = TempFile.GetTempFileName();
|
||||
|
||||
DrsSession((hSession) =>
|
||||
try
|
||||
{
|
||||
SaveSettingsFileEx(hSession, tmpfile);
|
||||
});
|
||||
|
||||
if (File.Exists(tmpfile))
|
||||
{
|
||||
string content = File.ReadAllText(tmpfile);
|
||||
string pattern = "\\sProfile\\s\\\"(?<profile>.*?)\\\"(?<scope>.*?Executable.*?)EndProfile";
|
||||
foreach (Match m in Regex.Matches(content, pattern, RegexOptions.Singleline))
|
||||
var matchingProfiles = new List<string>();
|
||||
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
string scope = m.Result("${scope}");
|
||||
foreach (Match ms in Regex.Matches(scope, "Executable\\s\\\"(?<app>.*?)\\\"", RegexOptions.Singleline))
|
||||
SaveSettingsFileEx(hSession, tmpfile);
|
||||
});
|
||||
|
||||
if (File.Exists(tmpfile))
|
||||
{
|
||||
string content = File.ReadAllText(tmpfile);
|
||||
string pattern = "\\sProfile\\s\\\"(?<profile>.*?)\\\"(?<scope>.*?Executable.*?)EndProfile";
|
||||
foreach (Match m in Regex.Matches(content, pattern, RegexOptions.Singleline))
|
||||
{
|
||||
if (ms.Result("${app}").ToLower() == lowerApplicationName)
|
||||
string scope = m.Result("${scope}");
|
||||
foreach (Match ms in Regex.Matches(scope, "Executable\\s\\\"(?<app>.*?)\\\"", RegexOptions.Singleline))
|
||||
{
|
||||
result.Append(m.Result("${profile}") + ";");
|
||||
if (ms.Result("${app}").ToLower() == lowerApplicationName)
|
||||
{
|
||||
matchingProfiles.Add(m.Result("${profile}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (File.Exists(tmpfile))
|
||||
File.Delete(tmpfile);
|
||||
|
||||
return result.ToString();
|
||||
return string.Join(";", matchingProfiles);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(tmpfile))
|
||||
File.Delete(tmpfile);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -20,6 +12,7 @@ namespace nspector.Common
|
||||
public static readonly DrsSettingsService SettingService;
|
||||
public static readonly DrsImportService ImportService;
|
||||
public static readonly DrsScannerService ScannerService;
|
||||
public static readonly DrsDecrypterService DecrypterService;
|
||||
|
||||
static DrsServiceLocator()
|
||||
{
|
||||
@@ -27,9 +20,10 @@ namespace nspector.Common
|
||||
ReferenceSettings = LoadReferenceSettings();
|
||||
|
||||
MetaService = new DrsSettingsMetaService(CustomSettings, ReferenceSettings);
|
||||
SettingService = new DrsSettingsService(MetaService);
|
||||
ImportService = new DrsImportService(MetaService, SettingService);
|
||||
ScannerService = new DrsScannerService(MetaService);
|
||||
DecrypterService = new DrsDecrypterService(MetaService);
|
||||
ScannerService = new DrsScannerService(MetaService, DecrypterService);
|
||||
SettingService = new DrsSettingsService(MetaService, DecrypterService);
|
||||
ImportService = new DrsImportService(MetaService, SettingService, ScannerService, DecrypterService);
|
||||
}
|
||||
|
||||
private static CustomSettingNames LoadCustomSettings()
|
||||
@@ -51,6 +45,6 @@ namespace nspector.Common
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using nspector.Native.NVAPI2;
|
||||
using nspector.Native.NVAPI2;
|
||||
using System;
|
||||
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
|
||||
|
||||
namespace nspector.Common
|
||||
@@ -18,11 +14,15 @@ namespace nspector.Common
|
||||
private static object _Sync = new object();
|
||||
|
||||
|
||||
public static T DrsSession<T>(Func<IntPtr, T> action)
|
||||
public static T DrsSession<T>(Func<IntPtr, T> action, bool forceNonGlobalSession = false, bool preventLoadSettings = false)
|
||||
{
|
||||
lock (_Sync)
|
||||
{
|
||||
if (HoldSession && (GlobalSession == IntPtr.Zero))
|
||||
if (!HoldSession || forceNonGlobalSession)
|
||||
return NonGlobalDrsSession<T>(action, preventLoadSettings);
|
||||
|
||||
|
||||
if (GlobalSession == IntPtr.Zero)
|
||||
{
|
||||
|
||||
#pragma warning disable CS0420
|
||||
@@ -32,18 +32,21 @@ namespace nspector.Common
|
||||
if (csRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_CreateSession", csRes);
|
||||
|
||||
var nvRes = nvw.DRS_LoadSettings(GlobalSession);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_LoadSettings", nvRes);
|
||||
if (!preventLoadSettings)
|
||||
{
|
||||
var nvRes = nvw.DRS_LoadSettings(GlobalSession);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_LoadSettings", nvRes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (HoldSession && GlobalSession != IntPtr.Zero)
|
||||
if (GlobalSession != IntPtr.Zero)
|
||||
{
|
||||
return action(GlobalSession);
|
||||
}
|
||||
|
||||
return NonGlobalDrsSession<T>(action);
|
||||
throw new Exception(nameof(GlobalSession) + " is Zero!");
|
||||
}
|
||||
|
||||
public static void DestroyGlobalSession()
|
||||
@@ -58,7 +61,7 @@ namespace nspector.Common
|
||||
}
|
||||
}
|
||||
|
||||
private static T NonGlobalDrsSession<T>(Func<IntPtr, T> action)
|
||||
private static T NonGlobalDrsSession<T>(Func<IntPtr, T> action, bool preventLoadSettings = false)
|
||||
{
|
||||
IntPtr hSession = IntPtr.Zero;
|
||||
var csRes = nvw.DRS_CreateSession(ref hSession);
|
||||
@@ -67,9 +70,12 @@ namespace nspector.Common
|
||||
|
||||
try
|
||||
{
|
||||
var nvRes = nvw.DRS_LoadSettings(hSession);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_LoadSettings", nvRes);
|
||||
if (!preventLoadSettings)
|
||||
{
|
||||
var nvRes = nvw.DRS_LoadSettings(hSession);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_LoadSettings", nvRes);
|
||||
}
|
||||
|
||||
return action(hSession);
|
||||
}
|
||||
@@ -82,6 +88,6 @@ namespace nspector.Common
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -123,7 +126,19 @@ namespace nspector.Common
|
||||
if (settingDefault != null)
|
||||
return settingDefault;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private byte[] GetBinaryDefaultValue(uint settingId)
|
||||
{
|
||||
foreach (var service in MetaServices.OrderBy(x => x.Service.Source))
|
||||
{
|
||||
var settingDefault = service.Service.GetBinaryDefaultValue(settingId);
|
||||
if (settingDefault != null)
|
||||
return settingDefault;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -133,18 +148,21 @@ namespace nspector.Common
|
||||
return a;
|
||||
|
||||
// force scanned settings to add instead of merge
|
||||
if (b.Count > 0 && b.First().ValueSource == SettingMetaSource.ScannedSettings)
|
||||
var isScannedValuesList = (b.Count > 0 && b.First().ValueSource == SettingMetaSource.ScannedSettings);
|
||||
if (isScannedValuesList)
|
||||
{
|
||||
a.AddRange(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newValues = b.Where(xb => !a.Select(xa => xa.Value).Contains(xb.Value)).ToList();
|
||||
a.AddRange(newValues);
|
||||
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);
|
||||
|
||||
foreach (var settingValue in a)
|
||||
{
|
||||
var bVal = b.FirstOrDefault(x => x.Value.Equals(settingValue.Value) && x.ValueSource != SettingMetaSource.ScannedSettings);
|
||||
var bVal = b.FirstOrDefault(x => x.Value.Equals(settingValue.Value) && settingValue.ValueSource != SettingMetaSource.ScannedSettings);
|
||||
if (bVal != null && bVal.ValueName != null)
|
||||
{
|
||||
settingValue.ValueName = bVal.ValueName;
|
||||
@@ -154,7 +172,23 @@ namespace nspector.Common
|
||||
}
|
||||
}
|
||||
|
||||
return a.OrderBy(x=>x.Value).ToList();
|
||||
var atmp = a.FirstOrDefault();
|
||||
if (atmp != null && atmp is IComparable)
|
||||
return a.OrderBy(x => x.Value).ToList();
|
||||
else
|
||||
return a.ToList();
|
||||
}
|
||||
|
||||
private List<SettingValue<byte[]>> GetBinaryValues(uint settingId)
|
||||
{
|
||||
var result = new List<SettingValue<byte[]>>();
|
||||
|
||||
foreach (var service in MetaServices.OrderByDescending(x => x.ValueNamePrio))
|
||||
{
|
||||
result = MergeSettingValues(result, service.Service.GetBinaryValues(settingId));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<SettingValue<string>> GetStringValues(uint settingId)
|
||||
@@ -165,7 +199,7 @@ namespace nspector.Common
|
||||
{
|
||||
result = MergeSettingValues(result, service.Service.GetStringValues(settingId));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -180,15 +214,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();
|
||||
@@ -197,11 +231,11 @@ namespace nspector.Common
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public List<uint> GetSettingIds(SettingViewMode viewMode)
|
||||
{
|
||||
var settingIds = new List<uint>();
|
||||
var allowedSourcesForViewMode = GetAllowedMetaSourcesForViewMode(viewMode);
|
||||
var allowedSourcesForViewMode = GetAllowedSettingIdMetaSourcesForViewMode(viewMode);
|
||||
|
||||
foreach (var service in MetaServices.OrderBy(x => x.Service.Source))
|
||||
{
|
||||
@@ -213,25 +247,47 @@ namespace nspector.Common
|
||||
return settingIds.Distinct().ToList();
|
||||
}
|
||||
|
||||
private SettingMetaSource[] GetAllowedMetaSourcesForViewMode(SettingViewMode viewMode)
|
||||
private SettingMetaSource[] GetAllowedSettingIdMetaSourcesForViewMode(SettingViewMode viewMode)
|
||||
{
|
||||
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.DriverSettings,
|
||||
SettingMetaSource.ScannedSettings,
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.DriverSettings,
|
||||
SettingMetaSource.ReferenceSettings,
|
||||
};
|
||||
default:
|
||||
return new [] {
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.DriverSettings,
|
||||
return new[] {
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.DriverSettings,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private SettingMetaSource[] GetAllowedSettingValueMetaSourcesForViewMode(SettingViewMode viewMode)
|
||||
{
|
||||
switch (viewMode)
|
||||
{
|
||||
case SettingViewMode.CustomSettingsOnly:
|
||||
return new[] {
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.ScannedSettings,
|
||||
};
|
||||
default:
|
||||
return new[] {
|
||||
SettingMetaSource.ConstantSettings,
|
||||
SettingMetaSource.ScannedSettings,
|
||||
SettingMetaSource.CustomSettings,
|
||||
SettingMetaSource.DriverSettings,
|
||||
SettingMetaSource.ReferenceSettings,
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -241,7 +297,7 @@ namespace nspector.Common
|
||||
var settingType = GetSettingValueType(settingId);
|
||||
var settingName = GetSettingName(settingId);
|
||||
var groupName = GetGroupName(settingId);
|
||||
|
||||
|
||||
if (groupName == null)
|
||||
groupName = GetLegacyGroupName(settingId, settingName);
|
||||
|
||||
@@ -251,14 +307,18 @@ namespace nspector.Common
|
||||
SettingName = settingName,
|
||||
GroupName = groupName,
|
||||
|
||||
DefaultDwordValue =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE
|
||||
DefaultDwordValue =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE
|
||||
? GetDwordDefaultValue(settingId) : 0,
|
||||
|
||||
DefaultStringValue =
|
||||
DefaultStringValue =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE
|
||||
? GetStringDefaultValue(settingId) : null,
|
||||
|
||||
DefaultBinaryValue =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE
|
||||
? GetBinaryDefaultValue(settingId) : null,
|
||||
|
||||
DwordValues =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE
|
||||
? GetDwordValues(settingId) : null,
|
||||
@@ -266,30 +326,65 @@ namespace nspector.Common
|
||||
StringValues =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE
|
||||
? GetStringValues(settingId) : null,
|
||||
|
||||
BinaryValues =
|
||||
settingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE
|
||||
? GetBinaryValues(settingId) : null,
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private SettingMeta PostProcessMeta(uint settingId, SettingMeta settingMeta)
|
||||
private SettingMeta PostProcessMeta(uint settingId, SettingMeta settingMeta, SettingViewMode viewMode)
|
||||
{
|
||||
if (string.IsNullOrEmpty(settingMeta.SettingName))
|
||||
settingMeta.SettingName = string.Format("0x{0:X8}", settingId);
|
||||
|
||||
return settingMeta;
|
||||
var newMeta = new SettingMeta()
|
||||
{
|
||||
DefaultDwordValue = settingMeta.DefaultDwordValue,
|
||||
DefaultStringValue = settingMeta.DefaultStringValue,
|
||||
DefaultBinaryValue = settingMeta.DefaultBinaryValue,
|
||||
SettingName = settingMeta.SettingName,
|
||||
SettingType = settingMeta.SettingType,
|
||||
GroupName = settingMeta.GroupName,
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(newMeta.SettingName))
|
||||
{
|
||||
newMeta.SettingName = string.Format("0x{0:X8}", settingId);
|
||||
}
|
||||
|
||||
var allowedSourcesForViewMode = GetAllowedSettingValueMetaSourcesForViewMode(viewMode);
|
||||
if (settingMeta.DwordValues != null)
|
||||
{
|
||||
newMeta.DwordValues = settingMeta.DwordValues
|
||||
.Where(x => allowedSourcesForViewMode.Contains(x.ValueSource)).ToList();
|
||||
}
|
||||
|
||||
if (settingMeta.StringValues != null)
|
||||
{
|
||||
newMeta.StringValues = settingMeta.StringValues
|
||||
.Where(x => allowedSourcesForViewMode.Contains(x.ValueSource)).ToList();
|
||||
}
|
||||
|
||||
if (settingMeta.BinaryValues != null)
|
||||
{
|
||||
newMeta.BinaryValues = settingMeta.BinaryValues
|
||||
.Where(x => allowedSourcesForViewMode.Contains(x.ValueSource)).ToList();
|
||||
}
|
||||
|
||||
return newMeta;
|
||||
}
|
||||
|
||||
public SettingMeta GetSettingMeta(uint settingId)
|
||||
public SettingMeta GetSettingMeta(uint settingId, SettingViewMode viewMode = SettingViewMode.Normal)
|
||||
{
|
||||
if (settingMetaCache.ContainsKey(settingId))
|
||||
{
|
||||
return PostProcessMeta(settingId, settingMetaCache[settingId]);
|
||||
return PostProcessMeta(settingId, settingMetaCache[settingId], viewMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
var settingMeta = CreateSettingMeta(settingId);
|
||||
settingMetaCache.Add(settingId, settingMeta);
|
||||
return PostProcessMeta(settingId, settingMeta);
|
||||
return PostProcessMeta(settingId, settingMeta, viewMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -17,8 +14,8 @@ namespace nspector.Common
|
||||
internal class DrsSettingsService : DrsSettingsServiceBase
|
||||
{
|
||||
|
||||
public DrsSettingsService(DrsSettingsMetaService metaService)
|
||||
: base(metaService)
|
||||
public DrsSettingsService(DrsSettingsMetaService metaService, DrsDecrypterService decrpterService)
|
||||
: base(metaService, decrpterService)
|
||||
{
|
||||
_baseProfileSettingIds = InitBaseProfileSettingIds();
|
||||
}
|
||||
@@ -38,6 +35,22 @@ namespace nspector.Common
|
||||
|
||||
private string GetDrsProgramPath()
|
||||
{
|
||||
var nvidiaInstallerFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"NVIDIA Corporation\Installer2");
|
||||
var driverFolders = Directory.EnumerateDirectories(nvidiaInstallerFolder, "Display.Driver.*");
|
||||
foreach (var folder in driverFolders)
|
||||
{
|
||||
var fiDbInstaller = new FileInfo(Path.Combine(folder, "dbInstaller.exe"));
|
||||
if (!fiDbInstaller.Exists) continue;
|
||||
|
||||
var fviDbInstaller = FileVersionInfo.GetVersionInfo(fiDbInstaller.FullName);
|
||||
|
||||
var fileversion = fviDbInstaller.FileVersion.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");
|
||||
}
|
||||
@@ -59,45 +72,56 @@ namespace nspector.Common
|
||||
|
||||
public void DeleteAllProfilesHard()
|
||||
{
|
||||
var tmpFile = Path.GetTempFileName();
|
||||
File.WriteAllText(tmpFile, "BaseProfile \"Base Profile\"\r\nProfile \"Base Profile\"\r\nShowOn All\r\nProfileType Global\r\nEndProfile\r\n");
|
||||
|
||||
DrsSession((hSession) =>
|
||||
var tmpFile = TempFile.GetTempFileName();
|
||||
try
|
||||
{
|
||||
LoadSettingsFileEx(hSession, tmpFile);
|
||||
SaveSettings(hSession);
|
||||
});
|
||||
File.WriteAllText(tmpFile, "BaseProfile \"Base Profile\"\r\nSelectedGlobalProfile \"Base Profile\"\r\nProfile \"Base Profile\"\r\nShowOn All\r\nProfileType Global\r\nEndProfile\r\n");
|
||||
|
||||
if (File.Exists(tmpFile))
|
||||
File.Delete(tmpFile);
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
LoadSettingsFileEx(hSession, tmpFile);
|
||||
SaveSettings(hSession);
|
||||
}, forceNonGlobalSession: true, preventLoadSettings: true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(tmpFile))
|
||||
File.Delete(tmpFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void DeleteProfileHard(string profileName)
|
||||
{
|
||||
var tmpFileName = Path.GetTempFileName();
|
||||
var tmpFileContent = "";
|
||||
var tmpFileName = TempFile.GetTempFileName();
|
||||
|
||||
DrsSession((hSession) =>
|
||||
try
|
||||
{
|
||||
SaveSettingsFileEx(hSession, tmpFileName);
|
||||
tmpFileContent = File.ReadAllText(tmpFileName);
|
||||
string pattern = "(?<rpl>\nProfile\\s\"" + Regex.Escape(profileName) + "\".*?EndProfile.*?\n)";
|
||||
tmpFileContent = Regex.Replace(tmpFileContent, pattern, "", RegexOptions.Singleline);
|
||||
File.WriteAllText(tmpFileName, tmpFileContent);
|
||||
});
|
||||
var tmpFileContent = "";
|
||||
|
||||
if (tmpFileContent != "")
|
||||
{
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
LoadSettingsFileEx(hSession, tmpFileName);
|
||||
SaveSettings(hSession);
|
||||
SaveSettingsFileEx(hSession, tmpFileName);
|
||||
tmpFileContent = File.ReadAllText(tmpFileName);
|
||||
string pattern = "(?<rpl>\nProfile\\s\"" + Regex.Escape(profileName) + "\".*?EndProfile.*?\n)";
|
||||
tmpFileContent = Regex.Replace(tmpFileContent, pattern, "", RegexOptions.Singleline);
|
||||
File.WriteAllText(tmpFileName, tmpFileContent);
|
||||
});
|
||||
}
|
||||
|
||||
if (File.Exists(tmpFileName))
|
||||
File.Delete(tmpFileName);
|
||||
if (tmpFileContent != "")
|
||||
{
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
LoadSettingsFileEx(hSession, tmpFileName);
|
||||
SaveSettings(hSession);
|
||||
});
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(tmpFileName))
|
||||
File.Delete(tmpFileName);
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteProfile(string profileName)
|
||||
@@ -110,13 +134,13 @@ 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 List<string> GetProfileNames(ref string baseProfileName)
|
||||
{
|
||||
var lstResult = new List<string>();
|
||||
@@ -127,7 +151,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);
|
||||
@@ -151,7 +175,7 @@ namespace nspector.Common
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
var hProfile = CreateProfile(hSession, profileName);
|
||||
|
||||
|
||||
if (applicationName != null)
|
||||
AddApplication(hSession, hProfile, applicationName);
|
||||
|
||||
@@ -228,7 +252,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;
|
||||
@@ -248,14 +272,14 @@ namespace nspector.Common
|
||||
removeFromModified = tmpRemoveFromModified;
|
||||
}
|
||||
|
||||
public uint GetDwordValueFromProfile(string profileName, uint settingId, bool returnDefaultValue = false)
|
||||
public uint GetDwordValueFromProfile(string profileName, uint settingId, bool returnDefaultValue = false, bool forceDedicatedScope = false)
|
||||
{
|
||||
return DrsSession((hSession) =>
|
||||
{
|
||||
var hProfile = GetProfileHandle(hSession, profileName);
|
||||
|
||||
var dwordValue = ReadDwordValue(hSession, hProfile, settingId);
|
||||
|
||||
|
||||
if (dwordValue != null)
|
||||
return dwordValue.Value;
|
||||
else if (returnDefaultValue)
|
||||
@@ -275,7 +299,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) =>
|
||||
{
|
||||
@@ -296,6 +320,11 @@ namespace nspector.Common
|
||||
var str = DrsUtil.ParseStringSettingValue(settingMeta, setting.Value);
|
||||
StoreStringValue(hSession, hProfile, setting.Key, str);
|
||||
}
|
||||
else if (settingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE)
|
||||
{
|
||||
var bin = DrsUtil.ParseBinarySettingValue(settingMeta, setting.Value);
|
||||
StoreBinaryValue(hSession, hProfile, setting.Key, bin);
|
||||
}
|
||||
}
|
||||
|
||||
SaveSettings(hSession);
|
||||
@@ -303,7 +332,7 @@ namespace nspector.Common
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private SettingItem CreateSettingItem(NVDRS_SETTING setting, bool useDefault = false)
|
||||
{
|
||||
@@ -317,9 +346,12 @@ namespace nspector.Common
|
||||
if (settingMeta.StringValues == null)
|
||||
settingMeta.StringValues = new List<SettingValue<string>>();
|
||||
|
||||
if (settingMeta.BinaryValues == null)
|
||||
settingMeta.BinaryValues = new List<SettingValue<byte[]>>();
|
||||
|
||||
|
||||
var settingState = SettingState.NotAssiged;
|
||||
string valueRaw = DrsUtil.StringValueRaw;
|
||||
string valueRaw = "";
|
||||
string valueText = "";
|
||||
|
||||
if (settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE)
|
||||
@@ -376,6 +408,31 @@ namespace nspector.Common
|
||||
}
|
||||
}
|
||||
|
||||
if (settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE)
|
||||
{
|
||||
if (useDefault)
|
||||
{
|
||||
valueRaw = DrsUtil.GetBinaryString(settingMeta.DefaultBinaryValue);
|
||||
valueText = DrsUtil.GetBinarySettingValueName(settingMeta, settingMeta.DefaultBinaryValue);
|
||||
}
|
||||
else if (setting.isCurrentPredefined == 1 && setting.isPredefinedValid == 1)
|
||||
{
|
||||
valueRaw = DrsUtil.GetBinaryString(setting.predefinedValue.binaryValue);
|
||||
valueText = DrsUtil.GetBinarySettingValueName(settingMeta, setting.predefinedValue.binaryValue);
|
||||
settingState = SettingState.NvidiaSetting;
|
||||
}
|
||||
else
|
||||
{
|
||||
valueRaw = DrsUtil.GetBinaryString(setting.currentValue.binaryValue);
|
||||
valueText = DrsUtil.GetBinarySettingValueName(settingMeta, setting.currentValue.binaryValue);
|
||||
|
||||
if (setting.settingLocation == NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION)
|
||||
settingState = SettingState.UserdefinedSetting;
|
||||
else
|
||||
settingState = SettingState.GlobalSetting;
|
||||
}
|
||||
}
|
||||
|
||||
return new SettingItem()
|
||||
{
|
||||
SettingId = setting.settingId,
|
||||
@@ -387,9 +444,9 @@ namespace nspector.Common
|
||||
IsStringValue = settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public List<SettingItem> GetSettingsForProfile(string profileName, SettingViewMode viewMode, ref List<string> applications)
|
||||
|
||||
public List<SettingItem> GetSettingsForProfile(string profileName, SettingViewMode viewMode, ref Dictionary<string, string> applications)
|
||||
{
|
||||
var result = new List<SettingItem>();
|
||||
var settingIds = meta.GetSettingIds(viewMode);
|
||||
@@ -399,7 +456,7 @@ namespace nspector.Common
|
||||
applications = DrsSession((hSession) =>
|
||||
{
|
||||
var hProfile = GetProfileHandle(hSession, profileName);
|
||||
|
||||
|
||||
var profileSettings = GetProfileSettings(hSession, hProfile);
|
||||
foreach (var profileSetting in profileSettings)
|
||||
{
|
||||
@@ -422,11 +479,11 @@ namespace nspector.Common
|
||||
}
|
||||
|
||||
return GetProfileApplications(hSession, hProfile)
|
||||
.Select(x => x.appName).ToList(); ;
|
||||
.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)
|
||||
@@ -439,26 +496,27 @@ namespace nspector.Common
|
||||
});
|
||||
}
|
||||
|
||||
public void DeleteApplication(string profileName, string applicationName)
|
||||
public void RemoveApplication(string profileName, string applicationFingerprint)
|
||||
{
|
||||
DrsSession((hSession) =>
|
||||
{
|
||||
var hProfile = GetProfileHandle(hSession, profileName);
|
||||
DeleteApplication(hSession, hProfile, applicationName);
|
||||
var applications = GetProfileApplications(hSession, hProfile);
|
||||
foreach (var app in applications)
|
||||
{
|
||||
if (GetApplicationFingerprint(app) != applicationFingerprint) continue;
|
||||
DeleteApplication(hSession, hProfile, app);
|
||||
break;
|
||||
}
|
||||
SaveSettings(hSession);
|
||||
});
|
||||
}
|
||||
|
||||
public List<string> GetApplications(string profileName)
|
||||
private string GetApplicationFingerprint(NVDRS_APPLICATION_V3 application)
|
||||
{
|
||||
return DrsSession((hSession) =>
|
||||
{
|
||||
var hProfile = GetProfileHandle(hSession, profileName);
|
||||
var applications = GetProfileApplications(hSession, hProfile);
|
||||
return applications.Select(x => x.appName).ToList();
|
||||
});
|
||||
return $"{application.appName}|{application.fileInFolder}|{application.userFriendlyName}|{application.launcher}";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,10 +16,12 @@ namespace nspector.Common
|
||||
{
|
||||
|
||||
protected DrsSettingsMetaService meta;
|
||||
protected DrsDecrypterService decrypter;
|
||||
|
||||
public DrsSettingsServiceBase(DrsSettingsMetaService metaService)
|
||||
public DrsSettingsServiceBase(DrsSettingsMetaService metaService, DrsDecrypterService decrpterService = null)
|
||||
{
|
||||
meta = metaService;
|
||||
decrypter = decrpterService;
|
||||
DriverVersion = GetDriverVersionInternal();
|
||||
}
|
||||
|
||||
@@ -39,18 +41,18 @@ namespace nspector.Common
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void DrsSession(Action<IntPtr> action)
|
||||
protected void DrsSession(Action<IntPtr> action, bool forceNonGlobalSession = false, bool preventLoadSettings = false)
|
||||
{
|
||||
DrsSessionScope.DrsSession<bool>((hSession) =>
|
||||
{
|
||||
action(hSession);
|
||||
return true;
|
||||
});
|
||||
}, forceNonGlobalSession: forceNonGlobalSession, preventLoadSettings: preventLoadSettings);
|
||||
}
|
||||
|
||||
protected T DrsSession<T>(Func<IntPtr,T> action)
|
||||
protected T DrsSession<T>(Func<IntPtr, T> action, bool forceDedicatedScope = false)
|
||||
{
|
||||
return DrsSessionScope.DrsSession<T>(action);
|
||||
return DrsSessionScope.DrsSession<T>(action, forceDedicatedScope);
|
||||
}
|
||||
|
||||
protected IntPtr GetProfileHandle(IntPtr hSession, string profileName)
|
||||
@@ -73,7 +75,7 @@ namespace nspector.Common
|
||||
|
||||
if (nvRes == NvAPI_Status.NVAPI_PROFILE_NOT_FOUND)
|
||||
return IntPtr.Zero;
|
||||
|
||||
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_FindProfileByName", nvRes);
|
||||
}
|
||||
@@ -84,7 +86,7 @@ namespace nspector.Common
|
||||
{
|
||||
if (string.IsNullOrEmpty(profileName))
|
||||
throw new ArgumentNullException("profileName");
|
||||
|
||||
|
||||
var hProfile = IntPtr.Zero;
|
||||
|
||||
var newProfile = new NVDRS_PROFILE()
|
||||
@@ -96,7 +98,7 @@ namespace nspector.Common
|
||||
var nvRes = nvw.DRS_CreateProfile(hSession, ref newProfile, ref hProfile);
|
||||
if (nvRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_CreateProfile", nvRes);
|
||||
|
||||
|
||||
return hProfile;
|
||||
}
|
||||
|
||||
@@ -113,6 +115,13 @@ namespace nspector.Common
|
||||
return tmpProfile;
|
||||
}
|
||||
|
||||
protected void StoreSetting(IntPtr hSession, IntPtr hProfile, NVDRS_SETTING newSetting)
|
||||
{
|
||||
var ssRes = nvw.DRS_SetSetting(hSession, hProfile, ref newSetting);
|
||||
if (ssRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_SetSetting", ssRes);
|
||||
}
|
||||
|
||||
protected void StoreDwordValue(IntPtr hSession, IntPtr hProfile, uint settingId, uint dwordValue)
|
||||
{
|
||||
var newSetting = new NVDRS_SETTING()
|
||||
@@ -153,6 +162,26 @@ namespace nspector.Common
|
||||
|
||||
}
|
||||
|
||||
protected void StoreBinaryValue(IntPtr hSession, IntPtr hProfile, uint settingId, byte[] binValue)
|
||||
{
|
||||
var newSetting = new NVDRS_SETTING()
|
||||
{
|
||||
version = nvw.NVDRS_SETTING_VER,
|
||||
settingId = settingId,
|
||||
settingType = NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE,
|
||||
settingLocation = NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION,
|
||||
currentValue = new NVDRS_SETTING_UNION()
|
||||
{
|
||||
binaryValue = binValue,
|
||||
},
|
||||
};
|
||||
|
||||
var ssRes = nvw.DRS_SetSetting(hSession, hProfile, ref newSetting);
|
||||
if (ssRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_SetSetting", ssRes);
|
||||
|
||||
}
|
||||
|
||||
protected NVDRS_SETTING? ReadSetting(IntPtr hSession, IntPtr hProfile, uint settingId)
|
||||
{
|
||||
var newSetting = new NVDRS_SETTING()
|
||||
@@ -163,10 +192,16 @@ namespace nspector.Common
|
||||
var ssRes = nvw.DRS_GetSetting(hSession, hProfile, settingId, ref newSetting);
|
||||
if (ssRes == NvAPI_Status.NVAPI_SETTING_NOT_FOUND)
|
||||
return null;
|
||||
|
||||
|
||||
if (ssRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_GetSetting", ssRes);
|
||||
|
||||
if (decrypter != null)
|
||||
{
|
||||
var profile = GetProfileInfo(hSession, hProfile);
|
||||
decrypter.DecryptSettingIfNeeded(profile.profileName, ref newSetting);
|
||||
}
|
||||
|
||||
return newSetting;
|
||||
}
|
||||
|
||||
@@ -177,7 +212,7 @@ namespace nspector.Common
|
||||
return null;
|
||||
return newSetting.Value.currentValue.dwordValue;
|
||||
}
|
||||
|
||||
|
||||
protected void AddApplication(IntPtr hSession, IntPtr hProfile, string applicationName)
|
||||
{
|
||||
var newApp = new NVDRS_APPLICATION_V3()
|
||||
@@ -192,9 +227,9 @@ namespace nspector.Common
|
||||
|
||||
}
|
||||
|
||||
protected void DeleteApplication(IntPtr hSession, IntPtr hProfile, string applicationName)
|
||||
protected void DeleteApplication(IntPtr hSession, IntPtr hProfile, NVDRS_APPLICATION_V3 application)
|
||||
{
|
||||
var caRes = nvw.DRS_DeleteApplication(hSession, hProfile, new StringBuilder(applicationName));
|
||||
var caRes = nvw.DRS_DeleteApplicationEx(hSession, hProfile, ref application);
|
||||
if (caRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_DeleteApplication", caRes);
|
||||
}
|
||||
@@ -227,7 +262,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);
|
||||
@@ -238,6 +273,15 @@ namespace nspector.Common
|
||||
if (esRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_EnumSettings", esRes);
|
||||
|
||||
if (decrypter != null)
|
||||
{
|
||||
var profile = GetProfileInfo(hSession, hProfile);
|
||||
for (int i = 0; i < settingCount; i++)
|
||||
{
|
||||
decrypter.DecryptSettingIfNeeded(profile.profileName, ref settings[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return settings.ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
@@ -50,7 +48,7 @@ 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)
|
||||
@@ -70,5 +68,52 @@ namespace nspector.Common
|
||||
return settingValue == null ? stringValue : settingValue.ValueName;
|
||||
}
|
||||
|
||||
public static string GetBinaryString(byte[] binaryValue)
|
||||
{
|
||||
if (binaryValue == null)
|
||||
return "";
|
||||
|
||||
if (binaryValue.Length == 8)
|
||||
return string.Format("0x{0:X16}", BitConverter.ToUInt64(binaryValue, 0));
|
||||
|
||||
return BitConverter.ToString(binaryValue);
|
||||
}
|
||||
|
||||
internal static string GetBinarySettingValueName(SettingMeta meta, byte[] binaryValue)
|
||||
{
|
||||
var settingValue = meta.BinaryValues?
|
||||
.FirstOrDefault(x => x.Value.Equals(binaryValue));
|
||||
|
||||
return settingValue == null ? GetBinaryString(binaryValue) : settingValue.ValueName;
|
||||
}
|
||||
|
||||
internal static byte[] ParseBinarySettingValue(SettingMeta meta, string text)
|
||||
{
|
||||
var valueByName = meta.BinaryValues.FirstOrDefault(x => x.ValueName != null && x.ValueName.Equals(text));
|
||||
if (valueByName != null)
|
||||
return valueByName.Value;
|
||||
|
||||
return ParseBinaryByInputSafe(text);
|
||||
}
|
||||
|
||||
public static byte[] ParseBinaryByInputSafe(string input)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(input))
|
||||
return null;
|
||||
|
||||
if (input.StartsWith("0x"))
|
||||
{
|
||||
int blankPos = input.IndexOf(' ');
|
||||
int parseLen = blankPos > 2 ? blankPos - 2 : input.Length - 2;
|
||||
var qword = ulong.Parse(input.Substring(2, parseLen), NumberStyles.AllowHexSpecifier);
|
||||
return BitConverter.GetBytes(qword);
|
||||
}
|
||||
|
||||
if (input.Contains("-"))
|
||||
return Array.ConvertAll<string, byte>(input.Split('-'), s => Convert.ToByte(s, 16));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace nspector.Common.Helper
|
||||
var buttonCancel = 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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
85
nspector/Common/Helper/ShortcutResolver.cs
Normal file
85
nspector/Common/Helper/ShortcutResolver.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System.IO;
|
||||
using nspector.Native.WINAPI;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
{
|
||||
public class ShortcutResolver
|
||||
{
|
||||
|
||||
public static string GetUrlFromInternetShortcut(string filePath)
|
||||
{
|
||||
var lines = File.ReadAllLines(filePath);
|
||||
foreach (var line in lines)
|
||||
{
|
||||
if (line.StartsWith("URL="))
|
||||
{
|
||||
string[] splitLine = line.Split('=');
|
||||
if (splitLine.Length > 0)
|
||||
{
|
||||
return splitLine[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static string ResolveExecuteable(string filename, out string profileName)
|
||||
{
|
||||
var fileInfo = new FileInfo(filename);
|
||||
profileName = fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length);
|
||||
|
||||
try
|
||||
{
|
||||
switch (fileInfo.Extension.ToLower())
|
||||
{
|
||||
case ".lnk": return ResolveFromShellLinkFile(fileInfo.FullName);
|
||||
case ".url": return ResolveFromUrlFile(fileInfo.FullName);
|
||||
case ".exe": return fileInfo.Name;
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private static string ResolveFromShellLinkFile(string filename)
|
||||
{
|
||||
var shellLink = new ShellLink(filename);
|
||||
if (shellLink.Arguments.StartsWith(SteamAppResolver.SteamUrlPattern))
|
||||
{
|
||||
var resolver = new SteamAppResolver();
|
||||
return resolver.ResolveExeFromSteamUrl(shellLink.Arguments);
|
||||
}
|
||||
|
||||
var targetInfo = new FileInfo(shellLink.Target);
|
||||
if (targetInfo.Name.ToLower() == SteamAppResolver.SteamExeName)
|
||||
{
|
||||
if (shellLink.Arguments.Contains(SteamAppResolver.SteamArgumentPattern))
|
||||
{
|
||||
var resolver = new SteamAppResolver();
|
||||
return resolver.ResolveExeFromSteamArguments(shellLink.Arguments);
|
||||
}
|
||||
}
|
||||
|
||||
if (targetInfo.Extension.ToLower().Equals(".exe"))
|
||||
{
|
||||
return targetInfo.Name;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private static string ResolveFromUrlFile(string filename)
|
||||
{
|
||||
var url = GetUrlFromInternetShortcut(filename);
|
||||
if (url.StartsWith(SteamAppResolver.SteamUrlPattern))
|
||||
{
|
||||
var resolver = new SteamAppResolver();
|
||||
return resolver.ResolveExeFromSteamUrl(url);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
206
nspector/Common/Helper/SteamAppResolver.cs
Normal file
206
nspector/Common/Helper/SteamAppResolver.cs
Normal file
@@ -0,0 +1,206 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
{
|
||||
public class SteamAppResolver
|
||||
{
|
||||
|
||||
public const string SteamExeName = "steam.exe";
|
||||
public const string SteamUrlPattern = "steam://rungameid/";
|
||||
public const string SteamArgumentPattern = "-applaunch";
|
||||
|
||||
private byte[] _appinfoBytes;
|
||||
|
||||
public SteamAppResolver()
|
||||
{
|
||||
var appInfoLocation = GetSteamAppInfoLocation();
|
||||
if (File.Exists(appInfoLocation))
|
||||
_appinfoBytes = File.ReadAllBytes(appInfoLocation);
|
||||
else
|
||||
_appinfoBytes = null;
|
||||
}
|
||||
|
||||
private string GetSteamAppInfoLocation()
|
||||
{
|
||||
var reg = Registry.CurrentUser.OpenSubKey(@"Software\Valve\Steam", false);
|
||||
|
||||
if (reg != null)
|
||||
{
|
||||
string steamPath = (string)reg.GetValue("SteamPath", null);
|
||||
if (steamPath != null)
|
||||
return Path.Combine(steamPath, @"appcache\appinfo.vdf");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public string ResolveExeFromSteamUrl(string url)
|
||||
{
|
||||
if (url.StartsWith(SteamUrlPattern))
|
||||
{
|
||||
var appIdStr = url.Substring(SteamUrlPattern.Length);
|
||||
int appid = 0;
|
||||
if (int.TryParse(appIdStr, out appid))
|
||||
{
|
||||
return FindCommonExecutableForApp(appid);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public string ResolveExeFromSteamArguments(string arguments)
|
||||
{
|
||||
if (arguments.Contains(SteamArgumentPattern))
|
||||
{
|
||||
var rxRungame = new Regex(SteamArgumentPattern + @"\s+(?<appid>\d+)");
|
||||
foreach (Match m in rxRungame.Matches(arguments))
|
||||
{
|
||||
var appIdStr = m.Result("${appid}");
|
||||
int appid = 0;
|
||||
if (int.TryParse(appIdStr, out appid))
|
||||
{
|
||||
return FindCommonExecutableForApp(appid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private string FindCommonExecutableForApp(int appid)
|
||||
{
|
||||
var apps = FindAllExecutablesForApp(appid);
|
||||
if (apps.Count > 0)
|
||||
{
|
||||
return new FileInfo(apps[0]).Name;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private List<string> FindAllExecutablesForApp(int appid)
|
||||
{
|
||||
if (_appinfoBytes == null)
|
||||
return new List<string>();
|
||||
|
||||
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 };
|
||||
|
||||
var appidOffset = FindOffset(_appinfoBytes, appidPattern, offset);
|
||||
if (appidOffset == -1)
|
||||
return new List<string>();
|
||||
else
|
||||
offset = appidOffset + appidPattern.Length;
|
||||
|
||||
var launchOffset = FindOffset(_appinfoBytes, launchPattern, offset);
|
||||
if (launchOffset == -1)
|
||||
return new List<string>();
|
||||
else
|
||||
offset = launchOffset;
|
||||
|
||||
var executables = new List<string>();
|
||||
FindExecutables(_appinfoBytes, ref offset, ref executables);
|
||||
return executables;
|
||||
}
|
||||
|
||||
|
||||
private void FindExecutables(byte[] bytes, ref int offset, ref List<string> executables)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
var valueType = ReadByte(bytes, ref offset);
|
||||
if (valueType == 0x08)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
var valueName = ReadCString(bytes, ref offset);
|
||||
var valueString = "";
|
||||
switch (valueType)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
FindExecutables(bytes, ref offset, ref executables);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
valueString = ReadCString(bytes, ref offset);
|
||||
|
||||
if (valueName == "executable" && valueString.EndsWith(".exe"))
|
||||
{
|
||||
executables.Add(valueString);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
offset += 4;
|
||||
break;
|
||||
}
|
||||
|
||||
case 7:
|
||||
{
|
||||
offset += 8;
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 byte ReadByte(byte[] bytes, ref int offset)
|
||||
{
|
||||
offset += 1;
|
||||
return bytes[offset - 1];
|
||||
}
|
||||
|
||||
private static string ReadCString(byte[] bytes, ref int offset)
|
||||
{
|
||||
var tmpOffset = offset;
|
||||
while (bytes[tmpOffset] != 0)
|
||||
{
|
||||
tmpOffset++;
|
||||
}
|
||||
|
||||
var start = offset;
|
||||
var length = tmpOffset - offset;
|
||||
offset += length + 1;
|
||||
|
||||
return Encoding.UTF8.GetString(bytes, start, length);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
24
nspector/Common/Helper/TempFile.cs
Normal file
24
nspector/Common/Helper/TempFile.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
{
|
||||
internal static class TempFile
|
||||
{
|
||||
public static string GetTempFileName()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
var tempFile = GenerateTempFileName();
|
||||
if (!File.Exists(tempFile))
|
||||
return tempFile;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GenerateTempFileName()
|
||||
{
|
||||
return Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString().Replace("-", ""));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
47
nspector/Common/Helper/UserSettings.cs
Normal file
47
nspector/Common/Helper/UserSettings.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace nspector.Common.Helper
|
||||
{
|
||||
public class UserSettings
|
||||
{
|
||||
public int WindowTop { get; set; }
|
||||
|
||||
public int WindowLeft { get; set; }
|
||||
|
||||
public int WindowWidth { get; set; }
|
||||
|
||||
public int WindowHeight { get; set; }
|
||||
|
||||
public FormWindowState WindowState { get; set; }
|
||||
|
||||
public bool ShowCustomizedSettingNamesOnly { get; set; } = false;
|
||||
|
||||
public bool ShowScannedUnknownSettings { 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"); ;
|
||||
}
|
||||
|
||||
public void SaveSettings()
|
||||
{
|
||||
XMLHelper<UserSettings>.SerializeToXmlFile(this, GetSettingsFilename(), Encoding.Unicode, true);
|
||||
}
|
||||
|
||||
public static UserSettings LoadSettings()
|
||||
{
|
||||
var filename = GetSettingsFilename();
|
||||
if (!File.Exists(filename)) return new UserSettings();
|
||||
|
||||
return XMLHelper<UserSettings>.DeserializeFromXMLFile(GetSettingsFilename());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,7 @@ namespace nspector.Common.Helper
|
||||
|
||||
static XMLHelper()
|
||||
{
|
||||
//TODO: Fix It!
|
||||
//xmlSerializer = new XmlSerializer(typeof(T));
|
||||
xmlSerializer = XmlSerializer.FromTypes(new[]{typeof(T)})[0];
|
||||
xmlSerializer = new XmlSerializer(typeof(T));
|
||||
}
|
||||
|
||||
internal static string SerializeToXmlString(T xmlObject, Encoding encoding, bool removeNamespace)
|
||||
|
||||
107
nspector/Common/Import/ImportExportUitl.cs
Normal file
107
nspector/Common/Import/ImportExportUitl.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using nspector.Native.NVAPI2;
|
||||
|
||||
namespace nspector.Common.Import
|
||||
{
|
||||
internal class ImportExportUitl
|
||||
{
|
||||
public static bool AreDrsSettingEqualToProfileSetting(NVDRS_SETTING drsSetting, ProfileSetting profileSetting)
|
||||
{
|
||||
var profileSettingCompare = ConvertDrsSettingToProfileSetting(drsSetting);
|
||||
return profileSetting.SettingValue.Equals(profileSettingCompare.SettingValue);
|
||||
}
|
||||
|
||||
public static ProfileSetting ConvertDrsSettingToProfileSetting(NVDRS_SETTING setting)
|
||||
{
|
||||
return new ProfileSetting
|
||||
{
|
||||
SettingId = setting.settingId,
|
||||
SettingNameInfo = setting.settingName,
|
||||
SettingValue = ConvertSettingValueToString(setting),
|
||||
ValueType = MapValueType(setting.settingType),
|
||||
};
|
||||
}
|
||||
|
||||
private static string ConvertSettingValueToString(NVDRS_SETTING setting)
|
||||
{
|
||||
var settingUnion = setting.currentValue;
|
||||
if (setting.isCurrentPredefined == 1)
|
||||
{
|
||||
settingUnion = setting.predefinedValue;
|
||||
}
|
||||
|
||||
switch (setting.settingType)
|
||||
{
|
||||
case NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE:
|
||||
return settingUnion.dwordValue.ToString();
|
||||
case NVDRS_SETTING_TYPE.NVDRS_STRING_TYPE:
|
||||
return settingUnion.ansiStringValue;
|
||||
case NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE:
|
||||
return settingUnion.stringValue;
|
||||
case NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE:
|
||||
return Convert.ToBase64String(settingUnion.binaryValue);
|
||||
default:
|
||||
throw new Exception("invalid setting type");
|
||||
}
|
||||
}
|
||||
|
||||
private static SettingValueType MapValueType(NVDRS_SETTING_TYPE input)
|
||||
{
|
||||
switch (input)
|
||||
{
|
||||
case NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE: return SettingValueType.Binary;
|
||||
case NVDRS_SETTING_TYPE.NVDRS_STRING_TYPE: return SettingValueType.AnsiString;
|
||||
case NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE: return SettingValueType.String;
|
||||
default: return SettingValueType.Dword;
|
||||
}
|
||||
}
|
||||
|
||||
public static NVDRS_SETTING ConvertProfileSettingToDrsSetting(ProfileSetting setting)
|
||||
{
|
||||
var newSetting = new NVDRS_SETTING()
|
||||
{
|
||||
version = NvapiDrsWrapper.NVDRS_SETTING_VER,
|
||||
settingId = setting.SettingId,
|
||||
settingType = MapValueType(setting.ValueType),
|
||||
settingLocation = NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION,
|
||||
currentValue = ConvertStringToSettingUnion(setting.ValueType, setting.SettingValue),
|
||||
};
|
||||
return newSetting;
|
||||
}
|
||||
|
||||
private static NVDRS_SETTING_UNION ConvertStringToSettingUnion(SettingValueType valueType, string valueString)
|
||||
{
|
||||
var union = new NVDRS_SETTING_UNION();
|
||||
switch (valueType)
|
||||
{
|
||||
case SettingValueType.Dword:
|
||||
union.dwordValue = uint.Parse(valueString);
|
||||
break;
|
||||
case SettingValueType.String:
|
||||
union.stringValue = valueString;
|
||||
break;
|
||||
case SettingValueType.AnsiString:
|
||||
union.ansiStringValue = valueString;
|
||||
break;
|
||||
case SettingValueType.Binary:
|
||||
union.binaryValue = Convert.FromBase64String(valueString);
|
||||
break;
|
||||
default:
|
||||
throw new Exception("invalid value type");
|
||||
}
|
||||
return union;
|
||||
}
|
||||
|
||||
private static NVDRS_SETTING_TYPE MapValueType(SettingValueType input)
|
||||
{
|
||||
switch (input)
|
||||
{
|
||||
case SettingValueType.Binary: return NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE;
|
||||
case SettingValueType.AnsiString: return NVDRS_SETTING_TYPE.NVDRS_STRING_TYPE;
|
||||
case SettingValueType.String: return NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE;
|
||||
default: return NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,9 @@ namespace nspector.Common.Import
|
||||
|
||||
[XmlElement(ElementName = "SettingID")]
|
||||
public uint SettingId = 0;
|
||||
|
||||
public uint SettingValue = 0;
|
||||
|
||||
public string SettingValue = "0";
|
||||
|
||||
public SettingValueType ValueType = SettingValueType.Dword;
|
||||
}
|
||||
}
|
||||
10
nspector/Common/Import/SettingValueType.cs
Normal file
10
nspector/Common/Import/SettingValueType.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace nspector.Common.Import
|
||||
{
|
||||
public enum SettingValueType : int
|
||||
{
|
||||
Dword,
|
||||
AnsiString,
|
||||
String,
|
||||
Binary
|
||||
}
|
||||
}
|
||||
@@ -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,16 @@ namespace nspector.Common.Meta
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] GetBinaryDefaultValue(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<SettingValue<byte[]>> GetBinaryValues(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public SettingMetaSource Source
|
||||
{
|
||||
get { return SettingMetaSource.ConstantSettings; }
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using nspector.Common.CustomSettings;
|
||||
using nspector.Native.NVAPI2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
@@ -74,11 +72,11 @@ namespace nspector.Common.Meta
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public List<uint> GetSettingIds()
|
||||
{
|
||||
return customSettings.Settings
|
||||
.Select(x => x.SettingId).ToList();
|
||||
return customSettings.Settings
|
||||
.Select(x => x.SettingId).ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +91,16 @@ namespace nspector.Common.Meta
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] GetBinaryDefaultValue(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<SettingValue<byte[]>> GetBinaryValues(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
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,14 +20,14 @@ 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)
|
||||
{
|
||||
var values = new NVDRS_SETTING_VALUES();
|
||||
@@ -44,10 +38,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 +52,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 +66,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;
|
||||
@@ -96,8 +92,27 @@ namespace nspector.Common.Meta
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE)
|
||||
{
|
||||
result.DefaultBinaryValue = values.defaultValue.binaryValue;
|
||||
result.BinaryValues = new List<SettingValue<byte[]>>();
|
||||
for (int i = 0; i < values.numSettingValues; i++)
|
||||
{
|
||||
var binValue = values.settingValues[i].binaryValue;
|
||||
if (binValue != null)
|
||||
{
|
||||
result.BinaryValues.Add(
|
||||
new SettingValue<byte[]>(Source)
|
||||
{
|
||||
Value = binValue,
|
||||
ValueName = DrsUtil.GetBinaryString(binValue),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private SettingMeta GetSettingsMeta(uint settingId)
|
||||
@@ -116,13 +131,13 @@ namespace nspector.Common.Meta
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string GetSettingName(uint settingId)
|
||||
{
|
||||
var settingMeta = GetSettingsMeta(settingId);
|
||||
if (settingMeta != null)
|
||||
return settingMeta.SettingName;
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -161,7 +176,7 @@ namespace nspector.Common.Meta
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public List<uint> GetSettingIds()
|
||||
{
|
||||
return _settingIds;
|
||||
@@ -175,12 +190,30 @@ namespace nspector.Common.Meta
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public string GetGroupName(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] GetBinaryDefaultValue(uint settingId)
|
||||
{
|
||||
var settingMeta = GetSettingsMeta(settingId);
|
||||
if (settingMeta != null)
|
||||
return settingMeta.DefaultBinaryValue;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<SettingValue<byte[]>> GetBinaryValues(uint settingId)
|
||||
{
|
||||
var settingMeta = GetSettingsMeta(settingId);
|
||||
if (settingMeta != null)
|
||||
return settingMeta.BinaryValues;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public SettingMetaSource Source
|
||||
{
|
||||
get { return SettingMetaSource.DriverSettings; }
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace nspector.Common.Meta
|
||||
{
|
||||
internal interface ISettingMetaService
|
||||
{
|
||||
SettingMetaSource Source {get; }
|
||||
SettingMetaSource Source { get; }
|
||||
|
||||
NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId);
|
||||
|
||||
@@ -20,10 +20,14 @@ namespace nspector.Common.Meta
|
||||
|
||||
string GetStringDefaultValue(uint settingId);
|
||||
|
||||
byte[] GetBinaryDefaultValue(uint settingId);
|
||||
|
||||
List<SettingValue<string>> GetStringValues(uint settingId);
|
||||
|
||||
List<SettingValue<uint>> GetDwordValues(uint settingId);
|
||||
|
||||
List<SettingValue<byte[]>> GetBinaryValues(uint settingId);
|
||||
|
||||
List<uint> GetSettingIds();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,179 +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)
|
||||
{
|
||||
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;
|
||||
|
||||
public NvD3dUmxSettingMetaService()
|
||||
{
|
||||
var systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);
|
||||
var nvD3dUmxPath = Path.Combine(systemPath, "nvd3dumx.dll");
|
||||
_SettingNames = ParseNvD3dUmxNames(nvD3dUmxPath);
|
||||
}
|
||||
|
||||
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 null;
|
||||
}
|
||||
|
||||
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 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);
|
||||
|
||||
@@ -69,7 +69,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)
|
||||
{
|
||||
@@ -85,5 +85,24 @@ namespace nspector.Common.Meta
|
||||
{
|
||||
return CachedSettings.Select(c => c.SettingId).ToList();
|
||||
}
|
||||
|
||||
public byte[] GetBinaryDefaultValue(uint settingId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<SettingValue<byte[]>> GetBinaryValues(uint settingId)
|
||||
{
|
||||
var cached = CachedSettings.FirstOrDefault(x => x.SettingId.Equals(settingId));
|
||||
if (cached != null)
|
||||
return cached.SettingValues.Select(s => new SettingValue<byte[]>(Source)
|
||||
{
|
||||
Value = s.ValueBin,
|
||||
ValueName = string.Format("{0} ({1})", DrsUtil.GetBinaryString(s.ValueBin), s.ProfileNames),
|
||||
|
||||
}).ToList();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using nspector.Native.NVAPI2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace nspector.Common.Meta
|
||||
{
|
||||
@@ -18,8 +15,12 @@ namespace nspector.Common.Meta
|
||||
|
||||
public uint DefaultDwordValue { get; set; }
|
||||
|
||||
public byte[] DefaultBinaryValue { get; set; }
|
||||
|
||||
public List<SettingValue<string>> StringValues { get; set; }
|
||||
|
||||
public List<SettingValue<uint>> DwordValues { get; set; }
|
||||
|
||||
public List<SettingValue<byte[]>> BinaryValues { 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; }
|
||||
@@ -22,9 +17,10 @@ namespace nspector.Common.Meta
|
||||
public override string ToString()
|
||||
{
|
||||
if (typeof(T) == typeof(uint))
|
||||
return string.Format("Value=0x{0:X8}; ValueName={1};", Value, ValueName);
|
||||
return string.Format("Value=0x{0:X8}; ValueName={1}; Source={2};", Value, ValueName, ValueSource);
|
||||
|
||||
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
|
||||
@@ -9,7 +6,7 @@ namespace nspector.Common
|
||||
public class NvapiException : Exception
|
||||
{
|
||||
public readonly NvAPI_Status Status;
|
||||
|
||||
|
||||
public NvapiException(string function, NvAPI_Status status)
|
||||
: base(function + " failed: " + status)
|
||||
{
|
||||
@@ -17,4 +14,16 @@ namespace nspector.Common
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class NvapiAddApplicationException : NvapiException
|
||||
{
|
||||
public readonly string ApplicationName;
|
||||
|
||||
public NvapiAddApplicationException(string applicationName)
|
||||
: base("DRS_CreateApplication", NvAPI_Status.NVAPI_EXECUTABLE_ALREADY_IN_USE)
|
||||
{
|
||||
ApplicationName = applicationName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -187,40 +187,114 @@ namespace nspector.Native.NVAPI2
|
||||
// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
// public string stringValue;
|
||||
//}
|
||||
|
||||
|
||||
//[StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode, Size = 4100)]
|
||||
//internal struct NVDRS_SETTING_UNION
|
||||
//{
|
||||
// public uint dwordValue;
|
||||
|
||||
// //massive hack for marshalling issues with unicode string overlapping
|
||||
// public string stringValue
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// var firstPart = Encoding.Unicode.GetString(BitConverter.GetBytes(dwordValue)).Trim('\0');
|
||||
// return firstPart + stringRaw;
|
||||
// }
|
||||
|
||||
// set
|
||||
// {
|
||||
// var bytesRaw = Encoding.Unicode.GetBytes(value);
|
||||
// var bytesFirst = new byte[4];
|
||||
// var firstLength = bytesRaw.Length;
|
||||
// if (firstLength > 4)
|
||||
// firstLength = 4;
|
||||
// Buffer.BlockCopy(bytesRaw, 0, bytesFirst, 0, firstLength);
|
||||
// dwordValue = BitConverter.ToUInt32(bytesFirst, 0);
|
||||
|
||||
// if (value.Length > 2)
|
||||
// {
|
||||
// stringRaw = value.Substring(2);
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
// private string stringRaw;
|
||||
|
||||
//}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode, Size = 4100)]
|
||||
internal struct NVDRS_SETTING_UNION
|
||||
{
|
||||
public uint dwordValue;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4100)]
|
||||
public byte[] rawData;
|
||||
|
||||
//massive hack for marshalling issues with unicode string overlapping
|
||||
public string stringValue
|
||||
public byte[] binaryValue
|
||||
{
|
||||
get {
|
||||
var firstPart = Encoding.Unicode.GetString(BitConverter.GetBytes(dwordValue)).Trim('\0');
|
||||
return firstPart + stringRaw;
|
||||
get
|
||||
{
|
||||
var length = BitConverter.ToUInt32(rawData, 0);
|
||||
var tmpData = new byte[length];
|
||||
Buffer.BlockCopy(rawData, 4, tmpData, 0, (int)length);
|
||||
return tmpData;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
var bytesRaw = Encoding.Unicode.GetBytes(value);
|
||||
var bytesFirst = new byte[4];
|
||||
var firstLength = bytesRaw.Length;
|
||||
if (firstLength > 4)
|
||||
firstLength = 4;
|
||||
Buffer.BlockCopy(bytesRaw, 0, bytesFirst, 0, firstLength);
|
||||
dwordValue = BitConverter.ToUInt32(bytesFirst, 0);
|
||||
|
||||
if (value.Length > 2)
|
||||
rawData = new byte[4100];
|
||||
if (value != null)
|
||||
{
|
||||
stringRaw = value.Substring(2);
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(value.Length), 0, rawData, 0, 4);
|
||||
Buffer.BlockCopy(value, 0, rawData, 4, value.Length);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
private string stringRaw;
|
||||
|
||||
public uint dwordValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return BitConverter.ToUInt32(rawData, 0);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
rawData = new byte[4100];
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(value), 0, rawData, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
public string stringValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return Encoding.Unicode.GetString(rawData).Split(new[] { '\0' }, 2)[0];
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
rawData = new byte[4100];
|
||||
var bytesRaw = Encoding.Unicode.GetBytes(value);
|
||||
Buffer.BlockCopy(bytesRaw, 0, rawData, 0, bytesRaw.Length);
|
||||
}
|
||||
}
|
||||
|
||||
public string ansiStringValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return Encoding.Default.GetString(rawData).Split(new[] { '\0' }, 2)[0];
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
rawData = new byte[4100];
|
||||
var bytesRaw = Encoding.Default.GetBytes(value);
|
||||
Buffer.BlockCopy(bytesRaw, 0, rawData, 0, bytesRaw.Length);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -23,84 +23,91 @@ namespace nspector
|
||||
SafeNativeMethods.DeleteFile(Application.ExecutablePath + ":Zone.Identifier");
|
||||
}
|
||||
catch { }
|
||||
|
||||
#if RELEASE
|
||||
try
|
||||
{
|
||||
#endif
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
DropDownMenuScrollWheelHandler.Enable(true);
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
var argFileIndex = ArgFileIndex(args);
|
||||
if (argFileIndex != -1)
|
||||
{
|
||||
|
||||
if (args.Length == 1 && File.Exists(args[0]))
|
||||
if (new FileInfo(args[argFileIndex]).Extension.ToLower() == ".nip")
|
||||
{
|
||||
|
||||
if (new FileInfo(args[0]).Extension.ToLower() == ".nip")
|
||||
try
|
||||
{
|
||||
try
|
||||
var import = DrsServiceLocator.ImportService;
|
||||
var importReport = import.ImportProfiles(args[argFileIndex]);
|
||||
GC.Collect();
|
||||
Process current = Process.GetCurrentProcess();
|
||||
foreach (
|
||||
Process process in
|
||||
Process.GetProcessesByName(current.ProcessName.Replace(".vshost", "")))
|
||||
{
|
||||
var import = DrsServiceLocator.ImportService;
|
||||
import.ImportProfiles(args[0]);
|
||||
GC.Collect();
|
||||
Process current = Process.GetCurrentProcess();
|
||||
foreach (
|
||||
Process process in
|
||||
Process.GetProcessesByName(current.ProcessName.Replace(".vshost", "")))
|
||||
if (process.Id != current.Id && process.MainWindowTitle.Contains("Settings"))
|
||||
{
|
||||
if (process.Id != current.Id && process.MainWindowTitle.Contains("Settings"))
|
||||
{
|
||||
MessageHelper mh = new MessageHelper();
|
||||
mh.sendWindowsStringMessage((int)process.MainWindowHandle, 0, "ProfilesImported");
|
||||
}
|
||||
MessageHelper mh = new MessageHelper();
|
||||
mh.sendWindowsStringMessage((int)process.MainWindowHandle, 0, "ProfilesImported");
|
||||
}
|
||||
MessageBox.Show("Profile(s) successfully imported!", Application.ProductName,
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
if (string.IsNullOrEmpty(importReport) && !ArgExists(args, "-silentImport") && !ArgExists(args, "-silent"))
|
||||
{
|
||||
MessageBox.Show("Import Error: " + ex.Message, Application.ProductName + " Error",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
frmDrvSettings.ShowImportDoneMessage(importReport);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (ArgExists(args, "-createCSN"))
|
||||
{
|
||||
File.WriteAllText("CustomSettingNames.xml", Properties.Resources.CustomSettingNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
bool createdNew = true;
|
||||
using (Mutex mutex = new Mutex(true, Application.ProductName, out createdNew))
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (createdNew)
|
||||
MessageBox.Show("Import Error: " + ex.Message, Application.ProductName + " Error",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (ArgExists(args, "-createCSN"))
|
||||
{
|
||||
File.WriteAllText("CustomSettingNames.xml", Properties.Resources.CustomSettingNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
bool createdNew = true;
|
||||
using (Mutex mutex = new Mutex(true, Application.ProductName, out createdNew))
|
||||
{
|
||||
if (createdNew)
|
||||
{
|
||||
Application.Run(new frmDrvSettings(ArgExists(args, "-showOnlyCSN"), ArgExists(args, "-disableScan")));
|
||||
}
|
||||
else
|
||||
{
|
||||
Process current = Process.GetCurrentProcess();
|
||||
foreach (
|
||||
Process process in
|
||||
Process.GetProcessesByName(current.ProcessName.Replace(".vshost", "")))
|
||||
{
|
||||
Application.Run(new frmDrvSettings(ArgExists(args, "-showOnlyCSN"), ArgExists(args, "-disableScan")));
|
||||
}
|
||||
else
|
||||
{
|
||||
Process current = Process.GetCurrentProcess();
|
||||
foreach (
|
||||
Process process in
|
||||
Process.GetProcessesByName(current.ProcessName.Replace(".vshost", "")))
|
||||
if (process.Id != current.Id && process.MainWindowTitle.Contains("Settings"))
|
||||
{
|
||||
if (process.Id != current.Id && process.MainWindowTitle.Contains("Settings"))
|
||||
{
|
||||
MessageHelper mh = new MessageHelper();
|
||||
mh.bringAppToFront((int)process.MainWindowHandle);
|
||||
}
|
||||
MessageHelper mh = new MessageHelper();
|
||||
mh.bringAppToFront((int)process.MainWindowHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#if RELEASE
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message + "\r\n\r\n" + ex.StackTrace ,"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
static bool ArgExists(string[] args, string arg)
|
||||
{
|
||||
foreach (string a in args)
|
||||
@@ -110,5 +117,16 @@ namespace nspector
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static int ArgFileIndex(string[] args)
|
||||
{
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
if (File.Exists(args[i]))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NVIDIA Profile Inspector")]
|
||||
[assembly: AssemblyCopyright("©2016 by Orbmu2k")]
|
||||
[assembly: AssemblyCopyright("©2020 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.1.1.2")]
|
||||
[assembly: AssemblyFileVersion("2.1.1.2")]
|
||||
[assembly: AssemblyVersion("2.3.0.0")]
|
||||
[assembly: AssemblyFileVersion("2.3.0.0")]
|
||||
|
||||
|
||||
|
||||
17
nspector/Properties/Resources.Designer.cs
generated
17
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", "4.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Resources {
|
||||
@@ -76,13 +76,14 @@ namespace nspector.Properties {
|
||||
/// <ShowCustomizedSettingNamesOnly>false</ShowCustomizedSettingNamesOnly>
|
||||
/// <Settings>
|
||||
/// <CustomSetting>
|
||||
/// <UserfriendlyName>Enable Maxwell sample interleaving (MFAA)</UserfriendlyName>
|
||||
/// <HexSettingID>0x0098C1AC</HexSettingID>
|
||||
/// <GroupName>3 - Antialiasing</GroupName>
|
||||
/// <MinRequiredDriverVersion>344.11</MinRequiredDriverVersion>
|
||||
/// <SettingValues>
|
||||
/// <CustomSettingValue>
|
||||
/// <UserfriendlyName>Off</Userfrie [Rest der Zeichenfolge wurde abgeschnitten]"; ähnelt.
|
||||
/// <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.
|
||||
/// </summary>
|
||||
public static string CustomSettingNames {
|
||||
get {
|
||||
|
||||
4975
nspector/Reference.xml
Normal file
4975
nspector/Reference.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
@@ -9,7 +9,7 @@
|
||||
</asmv2:trustInfo>
|
||||
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>false</dpiAware>
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
@@ -4,6 +4,7 @@ using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using nspector.Common;
|
||||
using nspector.Common.CustomSettings;
|
||||
@@ -210,24 +211,30 @@ namespace nspector
|
||||
.SetDwordValueToProfile(_SettingsOwner._CurrentProfile, _Settingid, val);
|
||||
}
|
||||
|
||||
private uint GetStoredValue()
|
||||
{
|
||||
return DrsServiceLocator
|
||||
.SettingService
|
||||
.GetDwordValueFromProfile(_SettingsOwner._CurrentProfile, _Settingid);
|
||||
}
|
||||
|
||||
private void btnDirectApply_Click(object sender, EventArgs e)
|
||||
private async void btnDirectApply_Click(object sender, EventArgs e)
|
||||
{
|
||||
ApplyValueToProfile(_CurrentValue);
|
||||
while (GetStoredValue() != _CurrentValue)
|
||||
Application.DoEvents();
|
||||
|
||||
await CheckIfSettingIsStored();
|
||||
|
||||
if (File.Exists(tbGamePath.Text))
|
||||
{
|
||||
Process.Start(tbGamePath.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task CheckIfSettingIsStored()
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
while (_CurrentValue != DrsServiceLocator.SettingService
|
||||
.GetDwordValueFromProfile(_SettingsOwner._CurrentProfile, _Settingid, false, true))
|
||||
{
|
||||
await Task.Delay(50);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void btnBrowseGame_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
|
||||
144
nspector/frmDrvSettings.Designer.cs
generated
144
nspector/frmDrvSettings.Designer.cs
generated
@@ -46,8 +46,9 @@
|
||||
this.tssbRemoveApplication = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.tsSep3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.tsbExportProfiles = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.exportUserdefinedProfilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exportUserdefinedProfilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsbImportProfiles = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.importProfilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -90,10 +91,10 @@
|
||||
//
|
||||
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(12, 692);
|
||||
this.pbMain.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.pbMain.Location = new System.Drawing.Point(16, 585);
|
||||
this.pbMain.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.pbMain.Name = "pbMain";
|
||||
this.pbMain.Size = new System.Drawing.Size(883, 9);
|
||||
this.pbMain.Size = new System.Drawing.Size(1120, 11);
|
||||
this.pbMain.TabIndex = 19;
|
||||
//
|
||||
// tsMain
|
||||
@@ -131,10 +132,10 @@
|
||||
this.tsSep6,
|
||||
this.tsbApplyProfile});
|
||||
this.tsMain.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
|
||||
this.tsMain.Location = new System.Drawing.Point(12, 4);
|
||||
this.tsMain.Location = new System.Drawing.Point(16, 5);
|
||||
this.tsMain.Name = "tsMain";
|
||||
this.tsMain.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
|
||||
this.tsMain.Size = new System.Drawing.Size(883, 25);
|
||||
this.tsMain.Size = new System.Drawing.Size(1120, 31);
|
||||
this.tsMain.TabIndex = 24;
|
||||
this.tsMain.Text = "toolStrip1";
|
||||
//
|
||||
@@ -143,7 +144,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(49, 18);
|
||||
this.tslProfiles.Size = new System.Drawing.Size(61, 24);
|
||||
this.tslProfiles.Text = "Profiles:";
|
||||
//
|
||||
// cbProfiles
|
||||
@@ -155,7 +156,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(290, 23);
|
||||
this.cbProfiles.Size = new System.Drawing.Size(385, 28);
|
||||
this.cbProfiles.SelectedIndexChanged += new System.EventHandler(this.cbProfiles_SelectedIndexChanged);
|
||||
this.cbProfiles.TextChanged += new System.EventHandler(this.cbProfiles_TextChanged);
|
||||
//
|
||||
@@ -166,7 +167,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(36, 22);
|
||||
this.tsbModifiedProfiles.Size = new System.Drawing.Size(39, 28);
|
||||
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);
|
||||
@@ -175,7 +176,7 @@
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 31);
|
||||
//
|
||||
// tsbRefreshProfile
|
||||
//
|
||||
@@ -183,7 +184,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, 22);
|
||||
this.tsbRefreshProfile.Size = new System.Drawing.Size(24, 28);
|
||||
this.tsbRefreshProfile.Text = "Refresh current profile.";
|
||||
this.tsbRefreshProfile.Click += new System.EventHandler(this.tsbRefreshProfile_Click);
|
||||
//
|
||||
@@ -193,7 +194,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, 22);
|
||||
this.tsbRestoreProfile.Size = new System.Drawing.Size(24, 28);
|
||||
this.tsbRestoreProfile.Text = "Restore current profile to NVIDIA defaults.";
|
||||
this.tsbRestoreProfile.Click += new System.EventHandler(this.tsbRestoreProfile_Click);
|
||||
//
|
||||
@@ -203,7 +204,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, 22);
|
||||
this.tsbCreateProfile.Size = new System.Drawing.Size(24, 28);
|
||||
this.tsbCreateProfile.Text = "Create new profile";
|
||||
this.tsbCreateProfile.Click += new System.EventHandler(this.tsbCreateProfile_Click);
|
||||
//
|
||||
@@ -213,14 +214,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, 22);
|
||||
this.tsbDeleteProfile.Size = new System.Drawing.Size(24, 28);
|
||||
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, 25);
|
||||
this.tsSep2.Size = new System.Drawing.Size(6, 31);
|
||||
//
|
||||
// tsbAddApplication
|
||||
//
|
||||
@@ -228,7 +229,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, 22);
|
||||
this.tsbAddApplication.Size = new System.Drawing.Size(24, 28);
|
||||
this.tsbAddApplication.Text = "Add application to current profile.";
|
||||
this.tsbAddApplication.Click += new System.EventHandler(this.tsbAddApplication_Click);
|
||||
//
|
||||
@@ -238,7 +239,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(36, 22);
|
||||
this.tssbRemoveApplication.Size = new System.Drawing.Size(39, 28);
|
||||
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);
|
||||
@@ -246,40 +247,48 @@
|
||||
// tsSep3
|
||||
//
|
||||
this.tsSep3.Name = "tsSep3";
|
||||
this.tsSep3.Size = new System.Drawing.Size(6, 25);
|
||||
this.tsSep3.Size = new System.Drawing.Size(6, 31);
|
||||
//
|
||||
// tsbExportProfiles
|
||||
//
|
||||
this.tsbExportProfiles.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.tsbExportProfiles.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.exportUserdefinedProfilesToolStripMenuItem,
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem,
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem,
|
||||
this.exportUserdefinedProfilesToolStripMenuItem,
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem});
|
||||
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(36, 22);
|
||||
this.tsbExportProfiles.Size = new System.Drawing.Size(39, 28);
|
||||
this.tsbExportProfiles.Text = "Export user defined profiles";
|
||||
this.tsbExportProfiles.Click += new System.EventHandler(this.tsbExportProfiles_Click);
|
||||
//
|
||||
// exportUserdefinedProfilesToolStripMenuItem
|
||||
//
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Name = "exportUserdefinedProfilesToolStripMenuItem";
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Size = new System.Drawing.Size(312, 22);
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Text = "Export all customized profiles";
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Click += new System.EventHandler(this.exportUserdefinedProfilesToolStripMenuItem_Click);
|
||||
//
|
||||
// exportCurrentProfileOnlyToolStripMenuItem
|
||||
//
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Name = "exportCurrentProfileOnlyToolStripMenuItem";
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Size = new System.Drawing.Size(312, 22);
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Size = new System.Drawing.Size(422, 26);
|
||||
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.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.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(312, 22);
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(422, 26);
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Export all driver profiles (NVIDIA Text Format)";
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.exportAllProfilesNVIDIATextFormatToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -292,28 +301,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(36, 22);
|
||||
this.tsbImportProfiles.Size = new System.Drawing.Size(39, 28);
|
||||
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(364, 22);
|
||||
this.importProfilesToolStripMenuItem.Size = new System.Drawing.Size(453, 26);
|
||||
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(364, 22);
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(453, 26);
|
||||
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, 25);
|
||||
this.tsSep4.Size = new System.Drawing.Size(6, 31);
|
||||
//
|
||||
// tscbShowCustomSettingNamesOnly
|
||||
//
|
||||
@@ -322,14 +331,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, 22);
|
||||
this.tscbShowCustomSettingNamesOnly.Size = new System.Drawing.Size(24, 28);
|
||||
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, 25);
|
||||
this.tsSep5.Size = new System.Drawing.Size(6, 31);
|
||||
//
|
||||
// tscbShowScannedUnknownSettings
|
||||
//
|
||||
@@ -339,7 +348,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, 22);
|
||||
this.tscbShowScannedUnknownSettings.Size = new System.Drawing.Size(24, 28);
|
||||
this.tscbShowScannedUnknownSettings.Text = "Show unknown settings from NVIDIA predefined profiles";
|
||||
this.tscbShowScannedUnknownSettings.Click += new System.EventHandler(this.tscbShowScannedUnknownSettings_Click);
|
||||
//
|
||||
@@ -349,14 +358,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, 22);
|
||||
this.tsbBitValueEditor.Size = new System.Drawing.Size(24, 28);
|
||||
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, 25);
|
||||
this.tsSep6.Size = new System.Drawing.Size(6, 31);
|
||||
//
|
||||
// tsbApplyProfile
|
||||
//
|
||||
@@ -365,7 +374,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(109, 22);
|
||||
this.tsbApplyProfile.Size = new System.Drawing.Size(130, 28);
|
||||
this.tsbApplyProfile.Text = "Apply changes";
|
||||
this.tsbApplyProfile.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.tsbApplyProfile.Click += new System.EventHandler(this.tsbApplyProfile_Click);
|
||||
@@ -375,10 +384,10 @@
|
||||
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(775, 175);
|
||||
this.btnResetValue.Location = new System.Drawing.Point(976, 215);
|
||||
this.btnResetValue.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
|
||||
this.btnResetValue.Name = "btnResetValue";
|
||||
this.btnResetValue.Size = new System.Drawing.Size(25, 19);
|
||||
this.btnResetValue.Size = new System.Drawing.Size(33, 23);
|
||||
this.btnResetValue.TabIndex = 7;
|
||||
this.btnResetValue.UseVisualStyleBackColor = true;
|
||||
this.btnResetValue.Click += new System.EventHandler(this.btnResetValue_Click);
|
||||
@@ -390,10 +399,10 @@
|
||||
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(12, 32);
|
||||
this.lblApplications.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblApplications.Location = new System.Drawing.Point(16, 39);
|
||||
this.lblApplications.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.lblApplications.Name = "lblApplications";
|
||||
this.lblApplications.Size = new System.Drawing.Size(883, 17);
|
||||
this.lblApplications.Size = new System.Drawing.Size(1120, 21);
|
||||
this.lblApplications.TabIndex = 25;
|
||||
this.lblApplications.Text = "fsagame.exe, bond.exe, herozero.exe";
|
||||
//
|
||||
@@ -431,10 +440,10 @@
|
||||
//
|
||||
this.cbValues.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.cbValues.FormattingEnabled = true;
|
||||
this.cbValues.Location = new System.Drawing.Point(524, 175);
|
||||
this.cbValues.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.cbValues.Location = new System.Drawing.Point(699, 215);
|
||||
this.cbValues.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.cbValues.Name = "cbValues";
|
||||
this.cbValues.Size = new System.Drawing.Size(72, 21);
|
||||
this.cbValues.Size = new System.Drawing.Size(95, 24);
|
||||
this.cbValues.TabIndex = 5;
|
||||
this.cbValues.Visible = false;
|
||||
this.cbValues.SelectedValueChanged += new System.EventHandler(this.cbValues_SelectedValueChanged);
|
||||
@@ -442,40 +451,40 @@
|
||||
//
|
||||
// lblWidth96
|
||||
//
|
||||
this.lblWidth96.Location = new System.Drawing.Point(77, 233);
|
||||
this.lblWidth96.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth96.Location = new System.Drawing.Point(103, 287);
|
||||
this.lblWidth96.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.lblWidth96.Name = "lblWidth96";
|
||||
this.lblWidth96.Size = new System.Drawing.Size(96, 18);
|
||||
this.lblWidth96.Size = new System.Drawing.Size(128, 22);
|
||||
this.lblWidth96.TabIndex = 77;
|
||||
this.lblWidth96.Text = "96";
|
||||
this.lblWidth96.Visible = false;
|
||||
//
|
||||
// lblWidth330
|
||||
//
|
||||
this.lblWidth330.Location = new System.Drawing.Point(77, 210);
|
||||
this.lblWidth330.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth330.Location = new System.Drawing.Point(103, 258);
|
||||
this.lblWidth330.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.lblWidth330.Name = "lblWidth330";
|
||||
this.lblWidth330.Size = new System.Drawing.Size(330, 22);
|
||||
this.lblWidth330.Size = new System.Drawing.Size(440, 27);
|
||||
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(77, 269);
|
||||
this.lblWidth16.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth16.Location = new System.Drawing.Point(103, 331);
|
||||
this.lblWidth16.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.lblWidth16.Name = "lblWidth16";
|
||||
this.lblWidth16.Size = new System.Drawing.Size(16, 18);
|
||||
this.lblWidth16.Size = new System.Drawing.Size(21, 22);
|
||||
this.lblWidth16.TabIndex = 79;
|
||||
this.lblWidth16.Text = "16";
|
||||
this.lblWidth16.Visible = false;
|
||||
//
|
||||
// lblWidth30
|
||||
//
|
||||
this.lblWidth30.Location = new System.Drawing.Point(77, 251);
|
||||
this.lblWidth30.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth30.Location = new System.Drawing.Point(103, 309);
|
||||
this.lblWidth30.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.lblWidth30.Name = "lblWidth30";
|
||||
this.lblWidth30.Size = new System.Drawing.Size(30, 18);
|
||||
this.lblWidth30.Size = new System.Drawing.Size(40, 22);
|
||||
this.lblWidth30.TabIndex = 80;
|
||||
this.lblWidth30.Text = "30";
|
||||
this.lblWidth30.Visible = false;
|
||||
@@ -492,12 +501,12 @@
|
||||
this.lvSettings.FullRowSelect = true;
|
||||
this.lvSettings.GridLines = true;
|
||||
this.lvSettings.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||
this.lvSettings.Location = new System.Drawing.Point(12, 51);
|
||||
this.lvSettings.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.lvSettings.Location = new System.Drawing.Point(16, 63);
|
||||
this.lvSettings.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.lvSettings.MultiSelect = false;
|
||||
this.lvSettings.Name = "lvSettings";
|
||||
this.lvSettings.ShowItemToolTips = true;
|
||||
this.lvSettings.Size = new System.Drawing.Size(883, 635);
|
||||
this.lvSettings.Size = new System.Drawing.Size(1119, 514);
|
||||
this.lvSettings.SmallImageList = this.ilListView;
|
||||
this.lvSettings.TabIndex = 2;
|
||||
this.lvSettings.UseCompatibleStateImageBehavior = false;
|
||||
@@ -506,6 +515,7 @@
|
||||
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);
|
||||
//
|
||||
// chSettingID
|
||||
//
|
||||
@@ -524,9 +534,9 @@
|
||||
//
|
||||
// frmDrvSettings
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(907, 709);
|
||||
this.ClientSize = new System.Drawing.Size(1152, 606);
|
||||
this.Controls.Add(this.lblWidth30);
|
||||
this.Controls.Add(this.lblWidth16);
|
||||
this.Controls.Add(this.lblWidth330);
|
||||
@@ -537,12 +547,13 @@
|
||||
this.Controls.Add(this.pbMain);
|
||||
this.Controls.Add(this.btnResetValue);
|
||||
this.Controls.Add(this.cbValues);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.MinimumSize = new System.Drawing.Size(920, 348);
|
||||
this.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.MinimumSize = new System.Drawing.Size(1167, 417);
|
||||
this.Name = "frmDrvSettings";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "nSpector - Driver Profile Settings";
|
||||
this.Activated += new System.EventHandler(this.frmDrvSettings_Activated);
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmDrvSettings_FormClosed);
|
||||
this.Load += new System.EventHandler(this.frmDrvSettings_Load);
|
||||
this.Shown += new System.EventHandler(this.frmDrvSettings_Shown);
|
||||
this.tsMain.ResumeLayout(false);
|
||||
@@ -597,5 +608,6 @@
|
||||
private System.Windows.Forms.Label lblWidth330;
|
||||
private System.Windows.Forms.Label lblWidth16;
|
||||
private System.Windows.Forms.Label lblWidth30;
|
||||
private System.Windows.Forms.ToolStripMenuItem exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +1,37 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using nspector.Common;
|
||||
using nspector.Common.Helper;
|
||||
using nspector.Native.NVAPI2;
|
||||
using nspector.Native.WINAPI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using nspector.Common;
|
||||
using nspector.Common.Helper;
|
||||
using nspector.Native.NVAPI2;
|
||||
using nspector.Native.WINAPI;
|
||||
using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace nspector
|
||||
{
|
||||
|
||||
internal partial class frmDrvSettings : Form
|
||||
{
|
||||
readonly DrsSettingsMetaService _meta = DrsServiceLocator.MetaService;
|
||||
readonly DrsSettingsService _drs = DrsServiceLocator.SettingService;
|
||||
readonly DrsScannerService _scanner = DrsServiceLocator.ScannerService;
|
||||
readonly DrsImportService _import = DrsServiceLocator.ImportService;
|
||||
private readonly DrsSettingsMetaService _meta = DrsServiceLocator.MetaService;
|
||||
private readonly DrsSettingsService _drs = DrsServiceLocator.SettingService;
|
||||
private readonly DrsScannerService _scanner = DrsServiceLocator.ScannerService;
|
||||
private readonly DrsImportService _import = DrsServiceLocator.ImportService;
|
||||
|
||||
private List<SettingItem> _currentProfileSettingItems = new List<SettingItem>();
|
||||
private bool _alreadyScannedForPredefinedSettings = false;
|
||||
private IntPtr _taskbarParent = IntPtr.Zero;
|
||||
private bool _showCustomSettingsOnly = false;
|
||||
private bool _activated = false;
|
||||
private bool _isStartup = true;
|
||||
private bool _skipScan = false;
|
||||
|
||||
|
||||
private string _baseProfileName = "";
|
||||
private bool _isWin7TaskBar = false;
|
||||
private int _lastComboRowIndex = -1;
|
||||
@@ -51,6 +49,7 @@ namespace nspector
|
||||
copyDataStruct = (MessageHelper.COPYDATASTRUCT)m.GetLParam(copyDataType);
|
||||
if (copyDataStruct.lpData.Equals("ProfilesImported"))
|
||||
{
|
||||
DrsSessionScope.DestroyGlobalSession();
|
||||
RefreshAll();
|
||||
}
|
||||
break;
|
||||
@@ -109,15 +108,16 @@ namespace nspector
|
||||
return item;
|
||||
}
|
||||
|
||||
private void RefreshApplicationsCombosAndText(List<string> applications)
|
||||
private void RefreshApplicationsCombosAndText(Dictionary<string,string> applications)
|
||||
{
|
||||
lblApplications.Text = "";
|
||||
tssbRemoveApplication.DropDownItems.Clear();
|
||||
|
||||
lblApplications.Text = " " + string.Join(", ", applications);
|
||||
lblApplications.Text = " " + string.Join(", ", applications.Select(x=>x.Value));
|
||||
foreach (var app in applications)
|
||||
{
|
||||
tssbRemoveApplication.DropDownItems.Add(app, Properties.Resources.ieframe_1_18212);
|
||||
var item = tssbRemoveApplication.DropDownItems.Add(app.Value, Properties.Resources.ieframe_1_18212);
|
||||
item.Tag = app.Key;
|
||||
}
|
||||
tssbRemoveApplication.Enabled = (tssbRemoveApplication.DropDownItems.Count > 0);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ namespace nspector
|
||||
{
|
||||
lvSettings.Items.Clear();
|
||||
lvSettings.Groups.Clear();
|
||||
var applications = new List<string>();
|
||||
var applications = new Dictionary<string,string>();
|
||||
|
||||
_currentProfileSettingItems = _drs.GetSettingsForProfile(_CurrentProfile, GetSettingViewMode(), ref applications);
|
||||
RefreshApplicationsCombosAndText(applications);
|
||||
@@ -210,7 +210,7 @@ namespace nspector
|
||||
cbValues.Tag = lvSettings.SelectedItems[0].Tag;
|
||||
uint settingid = (uint)lvSettings.SelectedItems[0].Tag;
|
||||
|
||||
var settingMeta = _meta.GetSettingMeta(settingid);
|
||||
var settingMeta = _meta.GetSettingMeta(settingid, GetSettingViewMode());
|
||||
if (settingMeta != null)
|
||||
{
|
||||
if (settingMeta.SettingType == Native.NVAPI2.NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE && settingMeta.DwordValues != null)
|
||||
@@ -225,7 +225,7 @@ namespace nspector
|
||||
itm = v;
|
||||
|
||||
cbValues.Items.Add(itm);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,6 +236,13 @@ namespace nspector
|
||||
cbValues.Items.Add(v);
|
||||
}
|
||||
|
||||
if (settingMeta.SettingType == Native.NVAPI2.NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE && settingMeta.BinaryValues != null)
|
||||
{
|
||||
var valueNames = settingMeta.BinaryValues.Select(x => x.ValueName).ToList();
|
||||
foreach (string v in valueNames)
|
||||
cbValues.Items.Add(v);
|
||||
}
|
||||
|
||||
var scannedCount = settingMeta?.DwordValues?
|
||||
.Where(x => x.ValueSource == Common.Meta.SettingMetaSource.ScannedSettings)
|
||||
.Count();
|
||||
@@ -262,7 +269,7 @@ namespace nspector
|
||||
cbValues.Visible = true;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -304,13 +311,13 @@ namespace nspector
|
||||
{
|
||||
var settingId = (uint)cbValues.Tag;
|
||||
var activeImages = new[] { 0, 2 };
|
||||
|
||||
|
||||
int idx = GetListViewIndexOfSetting(settingId);
|
||||
if (idx != -1)
|
||||
{
|
||||
var lvItem = lvSettings.Items[idx];
|
||||
|
||||
var settingMeta = _meta.GetSettingMeta(settingId);
|
||||
var settingMeta = _meta.GetSettingMeta(settingId, GetSettingViewMode());
|
||||
|
||||
var currentProfileItem = _currentProfileSettingItems
|
||||
.First(x => x.SettingId.Equals(settingId));
|
||||
@@ -338,11 +345,16 @@ namespace nspector
|
||||
lvItem.SubItems[2].Text = DrsUtil.GetDwordString(DrsUtil.ParseDwordSettingValue(settingMeta, cbValueText));
|
||||
lvItem.SubItems[1].Text = cbValueText;
|
||||
}
|
||||
else
|
||||
else if (settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE)
|
||||
{
|
||||
lvItem.SubItems[2].Text = DrsUtil.ParseStringSettingValue(settingMeta, cbValueText); // DrsUtil.StringValueRaw;
|
||||
lvItem.SubItems[1].Text = cbValueText;
|
||||
}
|
||||
else if (settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE)
|
||||
{
|
||||
lvItem.SubItems[2].Text = DrsUtil.GetBinaryString(DrsUtil.ParseBinarySettingValue(settingMeta, cbValueText)); // DrsUtil.StringValueRaw;
|
||||
lvItem.SubItems[1].Text = cbValueText;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -443,16 +455,7 @@ namespace nspector
|
||||
var numberFormat = new NumberFormatInfo() { NumberDecimalSeparator = "." };
|
||||
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
var fileVersionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
|
||||
var titleText = string.Format("{8} {0}.{1}{5}{2}{5}{4} - {6} Profile Settings {3}- {7}",
|
||||
version.Major, version.Minor, version.Build, AdminHelper.IsAdmin ? "(Elevated) " : "",
|
||||
(version.Revision > 0 ? version.Revision.ToString() : ""),
|
||||
(version.Revision > 0 ? "." : ""),
|
||||
(_drs.DriverVersion > 0) ? "GeForce " + _drs.DriverVersion.ToString("#.00", numberFormat) + " -" : "Driver",
|
||||
fileVersionInfo.LegalCopyright,
|
||||
Application.ProductName
|
||||
);
|
||||
|
||||
Text = titleText;
|
||||
Text = $"{Application.ProductName} {version} - Geforce {_drs.DriverVersion.ToString("#.00", numberFormat)} - Profile Settings - {fileVersionInfo.LegalCopyright}";
|
||||
}
|
||||
|
||||
private static void InitMessageFilter(IntPtr handle)
|
||||
@@ -470,19 +473,18 @@ namespace nspector
|
||||
DragAcceptNativeHelper.ChangeWindowMessageFilter(DragAcceptNativeHelper.WM_COPYGLOBALDATA, DragAcceptNativeHelper.MSGFLT_ADD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal frmDrvSettings() : this(false, false) { }
|
||||
internal frmDrvSettings(bool showCsnOnly, bool skipScan)
|
||||
{
|
||||
_skipScan = skipScan;
|
||||
InitializeComponent();
|
||||
InitTaskbarList();
|
||||
InitScannerEvents();
|
||||
SetupDropFilesNative();
|
||||
SetupToolbar();
|
||||
SetupDpiAdjustments();
|
||||
|
||||
_showCustomSettingsOnly = showCsnOnly;
|
||||
tscbShowCustomSettingNamesOnly.Checked = showCsnOnly;
|
||||
Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||
}
|
||||
|
||||
@@ -513,14 +515,20 @@ namespace nspector
|
||||
Height = Screen.GetWorkingArea(this).Height - 20;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void RefreshModifiesProfilesDropDown()
|
||||
{
|
||||
tsbModifiedProfiles.DropDownItems.Clear();
|
||||
_scanner.ModifiedProfiles.Sort();
|
||||
foreach (string modProfile in _scanner.ModifiedProfiles)
|
||||
if (modProfile != _baseProfileName)
|
||||
tsbModifiedProfiles.DropDownItems.Add(modProfile);
|
||||
{
|
||||
var newItem = tsbModifiedProfiles.DropDownItems.Add(modProfile);
|
||||
if (!_scanner.UserProfiles.Contains(modProfile))
|
||||
{
|
||||
newItem.Image = tsbRestoreProfile.Image;
|
||||
}
|
||||
}
|
||||
|
||||
if (tsbModifiedProfiles.DropDownItems.Count > 0)
|
||||
tsbModifiedProfiles.Enabled = true;
|
||||
@@ -530,6 +538,7 @@ namespace nspector
|
||||
{
|
||||
SetupLayout();
|
||||
SetTitleVersion();
|
||||
LoadSettings();
|
||||
|
||||
RefreshProfilesCombo();
|
||||
cbProfiles.Text = GetBaseProfileName();
|
||||
@@ -615,9 +624,14 @@ namespace nspector
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
private void AddToModifiedProfiles(string profileName)
|
||||
|
||||
private void AddToModifiedProfiles(string profileName, bool userProfile = false)
|
||||
{
|
||||
if (!_scanner.UserProfiles.Contains(profileName) && profileName != _baseProfileName && userProfile)
|
||||
{
|
||||
_scanner.UserProfiles.Add(profileName);
|
||||
}
|
||||
|
||||
if (!_scanner.ModifiedProfiles.Contains(profileName) && profileName != _baseProfileName)
|
||||
{
|
||||
_scanner.ModifiedProfiles.Add(profileName);
|
||||
@@ -627,6 +641,11 @@ namespace nspector
|
||||
|
||||
private void RemoveFromModifiedProfiles(string profileName)
|
||||
{
|
||||
if (_scanner.UserProfiles.Contains(profileName))
|
||||
{
|
||||
_scanner.UserProfiles.Remove(profileName);
|
||||
}
|
||||
|
||||
if (_scanner.ModifiedProfiles.Contains(profileName))
|
||||
{
|
||||
_scanner.ModifiedProfiles.Remove(profileName);
|
||||
@@ -634,134 +653,75 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
|
||||
private void InvokeUi(Control invokeControl, Action action)
|
||||
private void ShowExportProfiles()
|
||||
{
|
||||
MethodInvoker mi = () => action();
|
||||
|
||||
if (invokeControl.InvokeRequired)
|
||||
invokeControl.BeginInvoke(mi);
|
||||
if (_scanner.ModifiedProfiles.Count > 0)
|
||||
{
|
||||
var frmExport = new frmExportProfiles();
|
||||
frmExport.ShowDialog(this);
|
||||
}
|
||||
else
|
||||
mi.Invoke();
|
||||
}
|
||||
|
||||
private void frmDrvSettings_OnModifiedScanDoneAndShowExport()
|
||||
{
|
||||
InvokeUi(this, () =>
|
||||
{
|
||||
|
||||
pbMain.Value = 0;
|
||||
pbMain.Enabled = false;
|
||||
SetTaskbarProgress(0);
|
||||
|
||||
if (_scanner.ModifiedProfiles.Count > 0)
|
||||
{
|
||||
var frmExport = new frmExportProfiles();
|
||||
frmExport.ShowDialog(this);
|
||||
}
|
||||
else
|
||||
MessageBox.Show("No user modified profiles found! Nothing to export.", "Userprofile Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
RefreshModifiesProfilesDropDown();
|
||||
tsbRefreshProfile.Enabled = true;
|
||||
});
|
||||
MessageBox.Show("No user modified profiles found! Nothing to export.", "Userprofile Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private void frmDrvSettings_OnPredefinedScanDoneAndStartModifiedProfileScan()
|
||||
{
|
||||
private CancellationTokenSource _scannerCancelationTokenSource;
|
||||
|
||||
InvokeUi(this, () =>
|
||||
{
|
||||
pbMain.Value = 0;
|
||||
pbMain.Enabled = false;
|
||||
SetTaskbarProgress(0);
|
||||
|
||||
tscbShowScannedUnknownSettings.Enabled = true;
|
||||
});
|
||||
|
||||
StartModifiedProfilesScan(false);
|
||||
}
|
||||
|
||||
private void frmDrvSettings_OnScanDoneDoNothing()
|
||||
{
|
||||
_meta.ResetMetaCache();
|
||||
|
||||
InvokeUi(this, () =>
|
||||
{
|
||||
pbMain.Value = 0;
|
||||
pbMain.Enabled = false;
|
||||
SetTaskbarProgress(0);
|
||||
RefreshCurrentProfile();
|
||||
RefreshModifiesProfilesDropDown();
|
||||
|
||||
tsbRefreshProfile.Enabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
private void frmDrvSettings_OnSettingScanProgress(int percent)
|
||||
{
|
||||
InvokeUi(this, () =>
|
||||
{
|
||||
pbMain.Value = percent;
|
||||
SetTaskbarProgress(percent);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void InitScannerEvents()
|
||||
{
|
||||
_scanner.OnSettingScanProgress += new Common.SettingScanProgressEvent(frmDrvSettings_OnSettingScanProgress);
|
||||
_scanner.OnPredefinedSettingsScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing);
|
||||
_scanner.OnModifiedProfilesScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing);
|
||||
}
|
||||
|
||||
private void StartModifiedProfilesScan(bool showProfilesDialog)
|
||||
{
|
||||
pbMain.Minimum = 0;
|
||||
pbMain.Maximum = 100;
|
||||
|
||||
_scanner.OnModifiedProfilesScanDone -= new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing);
|
||||
_scanner.OnModifiedProfilesScanDone -= new Common.SettingScanDoneEvent(frmDrvSettings_OnModifiedScanDoneAndShowExport);
|
||||
|
||||
if (showProfilesDialog)
|
||||
_scanner.OnModifiedProfilesScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnModifiedScanDoneAndShowExport);
|
||||
else
|
||||
_scanner.OnModifiedProfilesScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing);
|
||||
|
||||
_scanner.StartScanForModifiedProfilesAsync();
|
||||
}
|
||||
|
||||
private void StartPredefinedSettingsScan(bool startModifiedProfileScan)
|
||||
{
|
||||
pbMain.Minimum = 0;
|
||||
pbMain.Maximum = 100;
|
||||
|
||||
_scanner.OnPredefinedSettingsScanDone -= new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing);
|
||||
_scanner.OnPredefinedSettingsScanDone -= new Common.SettingScanDoneEvent(frmDrvSettings_OnPredefinedScanDoneAndStartModifiedProfileScan);
|
||||
|
||||
if (startModifiedProfileScan)
|
||||
_scanner.OnPredefinedSettingsScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnPredefinedScanDoneAndStartModifiedProfileScan);
|
||||
else
|
||||
_scanner.OnPredefinedSettingsScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing);
|
||||
|
||||
_alreadyScannedForPredefinedSettings = true;
|
||||
|
||||
_scanner.StartScanForPredefinedSettingsAsync();
|
||||
}
|
||||
|
||||
private void ScanProfilesSilent(bool scanPredefined, bool showProfileDialog)
|
||||
private async Task ScanProfilesSilentAsync(bool scanPredefined, bool showProfileDialog)
|
||||
{
|
||||
if (_skipScan)
|
||||
{
|
||||
|
||||
if (scanPredefined && !_alreadyScannedForPredefinedSettings)
|
||||
{
|
||||
_alreadyScannedForPredefinedSettings = true;
|
||||
_meta.ResetMetaCache();
|
||||
tsbModifiedProfiles.Enabled = true;
|
||||
exportUserdefinedProfilesToolStripMenuItem.Enabled = false;
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
tsbModifiedProfiles.Enabled = false;
|
||||
tsbRefreshProfile.Enabled = false;
|
||||
pbMain.Minimum = 0;
|
||||
pbMain.Maximum = 100;
|
||||
|
||||
_scannerCancelationTokenSource = new CancellationTokenSource();
|
||||
|
||||
var progressHandler = new Progress<int>(value =>
|
||||
{
|
||||
pbMain.Value = value;
|
||||
SetTaskbarProgress(value);
|
||||
});
|
||||
|
||||
if (scanPredefined && !_alreadyScannedForPredefinedSettings)
|
||||
StartPredefinedSettingsScan(true);
|
||||
{
|
||||
_alreadyScannedForPredefinedSettings = true;
|
||||
await _scanner.ScanProfileSettingsAsync(false, progressHandler, _scannerCancelationTokenSource.Token);
|
||||
_meta.ResetMetaCache();
|
||||
tscbShowScannedUnknownSettings.Enabled = true;
|
||||
}
|
||||
else
|
||||
StartModifiedProfilesScan(showProfileDialog);
|
||||
{
|
||||
await _scanner.ScanProfileSettingsAsync(true, progressHandler, _scannerCancelationTokenSource.Token);
|
||||
}
|
||||
|
||||
RefreshModifiesProfilesDropDown();
|
||||
tsbModifiedProfiles.Enabled = true;
|
||||
|
||||
pbMain.Value = 0;
|
||||
pbMain.Enabled = false;
|
||||
SetTaskbarProgress(0);
|
||||
|
||||
if (showProfileDialog)
|
||||
{
|
||||
ShowExportProfiles();
|
||||
}
|
||||
|
||||
RefreshCurrentProfile();
|
||||
tsbRefreshProfile.Enabled = true;
|
||||
}
|
||||
|
||||
private void cbCustomSettingsOnly_CheckedChanged(object sender, EventArgs e)
|
||||
@@ -778,7 +738,7 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
|
||||
private void tsbRestoreProfile_Click(object sender, EventArgs e)
|
||||
private async void tsbRestoreProfile_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Control.ModifierKeys == Keys.Control)
|
||||
{
|
||||
@@ -791,7 +751,7 @@ namespace nspector
|
||||
|
||||
RefreshProfilesCombo();
|
||||
RefreshCurrentProfile();
|
||||
ScanProfilesSilent(true, false);
|
||||
await ScanProfilesSilentAsync(true, false);
|
||||
cbProfiles.Text = GetBaseProfileName();
|
||||
}
|
||||
}
|
||||
@@ -863,14 +823,14 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
|
||||
private void frmDrvSettings_Shown(object sender, EventArgs e)
|
||||
private async void frmDrvSettings_Shown(object sender, EventArgs e)
|
||||
{
|
||||
if (_isStartup)
|
||||
{
|
||||
new Thread(SetTaskbarIcon).Start();
|
||||
ScanProfilesSilent(true, false);
|
||||
await ScanProfilesSilentAsync(true, false);
|
||||
|
||||
if (WindowState != FormWindowState.Maximized)
|
||||
if (_scannerCancelationTokenSource != null && !_scannerCancelationTokenSource.Token.IsCancellationRequested && WindowState != FormWindowState.Maximized)
|
||||
{
|
||||
new MessageHelper().bringAppToFront((int)this.Handle);
|
||||
}
|
||||
@@ -885,6 +845,9 @@ 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)
|
||||
@@ -920,7 +883,7 @@ namespace nspector
|
||||
}
|
||||
catch (NvapiException ex)
|
||||
{
|
||||
if (ex.Status == Native.NVAPI2.NvAPI_Status.NVAPI_EXECUTABLE_ALREADY_IN_USE)
|
||||
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!",
|
||||
@@ -929,7 +892,7 @@ namespace nspector
|
||||
{
|
||||
string profileNames = _scanner.FindProfilesUsingApplication(applicationName);
|
||||
if (profileNames == "")
|
||||
MessageBox.Show("This application executable is already assigned to another profile!",
|
||||
MessageBox.Show("This application executable might already be assigned to another profile!",
|
||||
"Error adding Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
else
|
||||
MessageBox.Show(
|
||||
@@ -957,7 +920,7 @@ namespace nspector
|
||||
//{
|
||||
// drs.DeleteApplication(currentProfile, e.ClickedItem.Text);
|
||||
//}
|
||||
_drs.DeleteApplication(_CurrentProfile, e.ClickedItem.Text);
|
||||
_drs.RemoveApplication(_CurrentProfile, e.ClickedItem.Tag.ToString());
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
|
||||
@@ -978,7 +941,7 @@ namespace nspector
|
||||
_drs.CreateProfile(result, applicationName);
|
||||
RefreshProfilesCombo();
|
||||
cbProfiles.SelectedIndex = cbProfiles.Items.IndexOf(result);
|
||||
AddToModifiedProfiles(result);
|
||||
AddToModifiedProfiles(result, true);
|
||||
}
|
||||
catch (NvapiException ex)
|
||||
{
|
||||
@@ -998,23 +961,34 @@ namespace nspector
|
||||
tsbImportProfiles.ShowDropDown();
|
||||
}
|
||||
|
||||
private void exportUserdefinedProfilesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private async void exportUserdefinedProfilesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ScanProfilesSilent(false, true);
|
||||
await ScanProfilesSilentAsync(false, true);
|
||||
}
|
||||
|
||||
private void exportCurrentProfileOnlyToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void ExportCurrentProfile(bool includePredefined)
|
||||
{
|
||||
var saveDialog = new SaveFileDialog();
|
||||
saveDialog.DefaultExt = "*.nip";
|
||||
saveDialog.Filter = Application.ProductName + " Profiles|*.nip";
|
||||
saveDialog.FileName = _CurrentProfile + ".nip";
|
||||
if (saveDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
var profiles = new[] { _CurrentProfile }.ToList();
|
||||
_import.ExportProfiles(profiles, saveDialog.FileName, false);
|
||||
_import.ExportProfiles(profiles, saveDialog.FileName, includePredefined);
|
||||
}
|
||||
}
|
||||
|
||||
private void exportCurrentProfileOnlyToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ExportCurrentProfile(false);
|
||||
}
|
||||
|
||||
private void exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ExportCurrentProfile(true);
|
||||
}
|
||||
|
||||
private void tssbRemoveApplication_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (tssbRemoveApplication.DropDown.Items.Count > 0)
|
||||
@@ -1053,10 +1027,10 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshAll()
|
||||
private async void RefreshAll()
|
||||
{
|
||||
RefreshProfilesCombo();
|
||||
ScanProfilesSilent(true, false);
|
||||
await ScanProfilesSilentAsync(true, false);
|
||||
|
||||
int idx = cbProfiles.Items.IndexOf(_CurrentProfile);
|
||||
if (idx == -1 || _CurrentProfile == _baseProfileName)
|
||||
@@ -1078,6 +1052,7 @@ namespace nspector
|
||||
{
|
||||
_import.ImportAllProfilesFromNvidiaTextFile(openDialog.FileName);
|
||||
MessageBox.Show("Profile(s) successfully imported!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DrsSessionScope.DestroyGlobalSession();
|
||||
RefreshAll();
|
||||
}
|
||||
catch (NvapiException)
|
||||
@@ -1094,9 +1069,7 @@ namespace nspector
|
||||
openDialog.Filter = Application.ProductName + " Profiles|*.nip";
|
||||
if (openDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
_import.ImportProfiles(openDialog.FileName);
|
||||
RefreshAll();
|
||||
MessageBox.Show("Profile(s) successfully imported!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
ImportProfiles(openDialog.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1111,31 +1084,24 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
|
||||
private string ResolveExecuteable(string filename, out string profileName)
|
||||
|
||||
public static void ShowImportDoneMessage(string importReport)
|
||||
{
|
||||
var fileInfo = new FileInfo(filename);
|
||||
profileName = fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length);
|
||||
if (fileInfo.Extension.ToLower().Equals(".lnk"))
|
||||
if (string.IsNullOrEmpty(importReport))
|
||||
{
|
||||
try
|
||||
{
|
||||
var shellLink = new ShellLink(filename);
|
||||
var targetInfo = new FileInfo(shellLink.Target);
|
||||
if (targetInfo.Extension.ToLower().Equals(".exe"))
|
||||
return targetInfo.Name;
|
||||
|
||||
return "";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
MessageBox.Show("Profile(s) successfully imported!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Some profile(s) could not imported!\r\n\r\n" + importReport, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
if (fileInfo.Extension.ToLower().Equals(".exe"))
|
||||
return fileInfo.Name;
|
||||
|
||||
return "";
|
||||
private void ImportProfiles(string nipFileName)
|
||||
{
|
||||
var importReport = _import.ImportProfiles(nipFileName);
|
||||
RefreshAll();
|
||||
ShowImportDoneMessage(importReport);
|
||||
}
|
||||
|
||||
private void lvSettings_OnDropFilesNative(string[] files)
|
||||
@@ -1145,15 +1111,13 @@ namespace nspector
|
||||
var fileInfo = new FileInfo(files[0]);
|
||||
if (fileInfo.Extension.ToLower().Equals(".nip"))
|
||||
{
|
||||
_import.ImportProfiles(fileInfo.FullName);
|
||||
RefreshAll();
|
||||
MessageBox.Show("Profile(s) successfully imported!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
ImportProfiles(fileInfo.FullName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var profileName = "";
|
||||
var exeFile = ResolveExecuteable(files[0], out profileName);
|
||||
var exeFile = ShortcutResolver.ResolveExecuteable(files[0], out profileName);
|
||||
if (exeFile != "")
|
||||
{
|
||||
var profiles = _scanner.FindProfilesUsingApplication(exeFile);
|
||||
@@ -1188,6 +1152,96 @@ namespace nspector
|
||||
Clipboard.SetText(string.Format($"0x{settingId:X8} {settingName}"));
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleScreenConstraints()
|
||||
{
|
||||
var workingArea = Screen.GetWorkingArea(this);
|
||||
|
||||
if (Left < workingArea.X)
|
||||
Left = workingArea.X;
|
||||
|
||||
if (Top < workingArea.Y)
|
||||
Top = workingArea.Y;
|
||||
|
||||
if ((Left + Width) > workingArea.X + workingArea.Width)
|
||||
Left = (workingArea.X + workingArea.Width) - Width;
|
||||
|
||||
if ((Top + Height) > workingArea.Y + workingArea.Height)
|
||||
Top = (workingArea.Y + workingArea.Height) - Height;
|
||||
}
|
||||
|
||||
private void SaveSettings()
|
||||
{
|
||||
var settings = UserSettings.LoadSettings();
|
||||
|
||||
if (WindowState == FormWindowState.Normal)
|
||||
{
|
||||
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.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;
|
||||
HandleScreenConstraints();
|
||||
tscbShowCustomSettingNamesOnly.Checked = settings.ShowCustomizedSettingNamesOnly;
|
||||
tscbShowScannedUnknownSettings.Checked = !_skipScan && settings.ShowScannedUnknownSettings;
|
||||
}
|
||||
|
||||
private void frmDrvSettings_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
_scannerCancelationTokenSource?.Cancel();
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
private void lvSettings_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Control && e.KeyCode == Keys.C)
|
||||
{
|
||||
CopyModifiedSettingsToClipBoard();
|
||||
}
|
||||
}
|
||||
|
||||
private void CopyModifiedSettingsToClipBoard()
|
||||
{
|
||||
var sbSettings = new StringBuilder();
|
||||
sbSettings.AppendFormat("{0,-40} {1}\r\n", "### NVIDIA Profile Inspector ###", _CurrentProfile);
|
||||
|
||||
foreach (ListViewGroup group in lvSettings.Groups)
|
||||
{
|
||||
bool groupTitleAdded = false;
|
||||
foreach (ListViewItem item in group.Items)
|
||||
{
|
||||
if (item.ImageIndex != 0) continue;
|
||||
|
||||
if(!groupTitleAdded)
|
||||
{
|
||||
sbSettings.AppendFormat("\r\n[{0}]\r\n", group.Header);
|
||||
groupTitleAdded = true;
|
||||
}
|
||||
sbSettings.AppendFormat("{0,-40} {1}\r\n", item.Text, item.SubItems[1].Text);
|
||||
}
|
||||
}
|
||||
|
||||
Clipboard.SetText(sbSettings.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADI
|
||||
DAAAAk1TRnQBSQFMAgEBBAEAAWgBBwFoAQcBEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA
|
||||
DAAAAk1TRnQBSQFMAgEBBAEAAagBBwGoAQcBEAEAARABAAT/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
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGgSURBVDhPrZPLSsNAFIb7BoKP4Upw5UoQBHfmMrG1olCa
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAGgSURBVDhPrZPLSsNAFIb7BoKP4Upw5UoQBHfmMrG1olCa
|
||||
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
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFcSURBVDhP3VFNK0RhFL4/wNbM3PdcCgsfsbHDgkJKWPgD
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAFcSURBVDhP3VFNK0RhFL4/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
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEgSURBVDhP3Y/PKwRhHIf3f5g/wMWUlIuDUk5y5MCB3Dk4
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAEgSURBVDhP3Y/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
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
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
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
||||
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
||||
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
||||
@@ -285,7 +285,4 @@
|
||||
<metadata name="lvSettings.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.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.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<TargetFrameworkProfile />
|
||||
@@ -129,13 +129,20 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Common\CustomSettings\CustomSetting.cs" />
|
||||
<Compile Include="Common\CustomSettings\CustomSettingValue.cs" />
|
||||
<Compile Include="Common\DrsDecrypterService.cs" />
|
||||
<Compile Include="Common\DrsScannerService.cs" />
|
||||
<Compile Include="Common\DrsServiceLocator.cs" />
|
||||
<Compile Include="Common\DrsSessionScope.cs" />
|
||||
<Compile Include="Common\DrsSettingsMetaService.cs" />
|
||||
<Compile Include="Common\DrsUtil.cs" />
|
||||
<Compile Include="Common\Helper\DropDownMenuScrollWheelHandler.cs" />
|
||||
<Compile Include="Common\Helper\ListViewGroupSorter.cs" />
|
||||
<Compile Include="Common\Meta\NvD3dUmxSettingMetaService.cs" />
|
||||
<Compile Include="Common\Helper\ShortcutResolver.cs" />
|
||||
<Compile Include="Common\Helper\SteamAppResolver.cs" />
|
||||
<Compile Include="Common\Helper\TempFile.cs" />
|
||||
<Compile Include="Common\Helper\UserSettings.cs" />
|
||||
<Compile Include="Common\Import\ImportExportUitl.cs" />
|
||||
<Compile Include="Common\Import\SettingValueType.cs" />
|
||||
<Compile Include="Common\Meta\MetaServiceItem.cs" />
|
||||
<Compile Include="Common\Meta\ConstantSettingMetaService.cs" />
|
||||
<Compile Include="Common\Meta\CustomSettingMetaService.cs" />
|
||||
@@ -219,9 +226,6 @@
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="app.manifest">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
@@ -235,6 +239,9 @@
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Native\NVAPI\NvApiDriverSettings.h" />
|
||||
<Content Include="Reference.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="Images\transparent16.png" />
|
||||
<None Include="Images\n1-016.png" />
|
||||
<None Include="Images\0_gear2.png" />
|
||||
|
||||
Reference in New Issue
Block a user