Compare commits

...

9 Commits

Author SHA1 Message Date
Orbmu2k
854cc3d0ee fix #13 remember window size, fix crash on closing app while scanning 2019-03-23 16:13:08 +01:00
Orbmu2k
f1ecca7985 improved tempfile handling 2019-03-23 14:20:39 +01:00
Orbmu2k
1af9d1c4fb fixed game starter waiting until setting is stored (bit value editor) 2019-03-23 13:47:59 +01:00
Orbmu2k
2383de09ce xml constructor works again 2019-03-23 13:27:05 +01:00
Orbmu2k
210d5ea25f .NET 4.5 + async/await for setting scanner 2019-03-23 13:06:10 +01:00
Orbmu2k
0104d929e9 simplified version string in window title 2019-03-10 19:55:37 +01:00
Orbmu2k
786423f2d2 updated settings constants to R418 2019-03-07 09:29:42 +01:00
Orbmu2k
1152aeeae9 updated CustomSettingNames 2019-03-07 09:28:02 +01:00
Orbmu2k
c1a75b9a2f Release 2.3.0.0 2019-02-23 15:38:05 +01:00
19 changed files with 585 additions and 470 deletions

View File

@@ -1,16 +1,16 @@
using System;
using nspector.Common.Helper;
using nspector.Native.NVAPI2;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using nspector.Native.NVAPI2;
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,
@@ -33,7 +33,7 @@ namespace nspector.Common
{
CreateInternalSettingMap();
}
private uint GetDwordFromKey(uint offset)
{
var bytes = new byte[4];
@@ -82,7 +82,7 @@ namespace nspector.Common
}
}
}
private string FormatInternalSettingKey(string profileName, uint settingId)
{
return profileName + settingId.ToString("X8").ToLower();
@@ -97,40 +97,46 @@ namespace nspector.Common
private void CreateInternalSettingMap()
{
string tmpfile = Path.GetTempFileName();
DrsSession((hSession) =>
string tmpfile = TempFile.GetTempFileName();
try
{
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++)
DrsSession((hSession) =>
{
foreach (Match ms in rxProfile.Matches(lines[i]))
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++)
{
currentProfileName = ms.Result("${profileName}");
}
foreach (Match ms in rxSetting.Matches(lines[i]))
{
_InternalSettings.Add(currentProfileName + ms.Result("${sid}"));
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}"));
}
}
}
File.Delete(tmpfile);
}
finally
{
if (File.Exists(tmpfile))
File.Delete(tmpfile);
}
}
}
}
}

View File

@@ -1,21 +1,17 @@
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
{
@@ -24,9 +20,6 @@ namespace nspector.Common
: 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>();
@@ -80,59 +73,62 @@ namespace nspector.Common
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 ScanForModifiedProfilesAsync(IProgress<int> progress, CancellationToken token = default(CancellationToken))
{
ModifiedProfiles = new List<string>();
UserProfiles = new HashSet<string>();
var knownPredefines = new List<uint>(_commonSettingIds);
DrsSession((hSession) =>
await Task.Run(() =>
{
IntPtr hBaseProfile = GetProfileHandle(hSession, "");
var profileHandles = EnumProfileHandles(hSession);
var maxProfileCount = profileHandles.Count;
int curProfilePos = 0;
ModifiedProfiles = new List<string>();
UserProfiles = new HashSet<string>();
var knownPredefines = new List<uint>(_commonSettingIds);
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);
UserProfiles.Add(profile.profileName);
continue;
}
if (token.IsCancellationRequested) break;
if ((hBaseProfile == hProfile || profile.numOfApps > 0) && profile.numOfSettings > 0)
{
var alreadyChecked = new List<uint>();
progress?.Report(CalcPercent(curProfilePos++, maxProfileCount));
foreach (uint settingId in knownPredefines)
var profile = GetProfileInfo(hSession, hProfile);
int checkedSettingsCount = 0;
bool foundModifiedProfile = false;
if (profile.isPredefined == 0)
{
if (CheckCommonSetting(hSession, hProfile, profile,
ref checkedSettingsCount, settingId, false, ref alreadyChecked))
{
foundModifiedProfile = true;
ModifiedProfiles.Add(profile.profileName);
break;
}
ModifiedProfiles.Add(profile.profileName);
UserProfiles.Add(profile.profileName);
continue;
}
if ((hBaseProfile == hProfile || profile.numOfApps > 0) && profile.numOfSettings > 0)
{
var alreadyChecked = new List<uint>();
foreach (uint settingId in knownPredefines)
{
if (CheckCommonSetting(hSession, hProfile, profile,
ref checkedSettingsCount, settingId, false, ref alreadyChecked))
{
foundModifiedProfile = true;
ModifiedProfiles.Add(profile.profileName);
break;
}
}
// the detection if only applications has changed in a profile makes the scan process very slow, we leave it out!
//if (!foundModifiedProfile && profile.numOfApps > 0)
//{
@@ -149,6 +145,60 @@ namespace nspector.Common
//}
if (foundModifiedProfile || checkedSettingsCount >= profile.numOfSettings)
continue;
var settings = GetProfileSettings(hSession, hProfile);
foreach (var setting in settings)
{
if (knownPredefines.IndexOf(setting.settingId) < 0)
knownPredefines.Add(setting.settingId);
if (setting.isCurrentPredefined != 1)
{
ModifiedProfiles.Add(profile.profileName);
break;
}
}
}
}
});
});
}
public async Task ScanForPredefinedProfileSettingsAsync(IProgress<int> progress, CancellationToken token = default(CancellationToken))
{
await Task.Run(() =>
{
var knownPredefines = new List<uint>(_commonSettingIds);
DrsSession((hSession) =>
{
var profileHandles = EnumProfileHandles(hSession);
var maxProfileCount = profileHandles.Count;
int curProfilePos = 0;
foreach (IntPtr hProfile in profileHandles)
{
if (token.IsCancellationRequested) break;
progress?.Report(CalcPercent(curProfilePos++, maxProfileCount));
var profile = GetProfileInfo(hSession, hProfile);
int checkedSettingsCount = 0;
var alreadyChecked = new List<uint>();
foreach (uint kpd in knownPredefines)
{
CheckCommonSetting(hSession, hProfile, profile,
ref checkedSettingsCount, kpd, true, ref alreadyChecked);
}
if (checkedSettingsCount >= profile.numOfSettings)
continue;
var settings = GetProfileSettings(hSession, hProfile);
@@ -157,77 +207,16 @@ namespace nspector.Common
if (knownPredefines.IndexOf(setting.settingId) < 0)
knownPredefines.Add(setting.settingId);
if (setting.isCurrentPredefined != 1)
{
ModifiedProfiles.Add(profile.profileName);
break;
}
if (alreadyChecked.IndexOf(setting.settingId) < 0)
AddScannedSettingToCache(profile, setting);
}
}
}
});
});
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)
{
// Skip 3D Vision string values here for improved scan performance
@@ -262,39 +251,45 @@ namespace nspector.Common
}
}
public string FindProfilesUsingApplication(string applicationName)
{
string lowerApplicationName = applicationName.ToLower();
string tmpfile = Path.GetTempFileName();
var matchingProfiles = new List<string>();
string tmpfile = TempFile.GetTempFileName();
DrsSession((hSession) =>
try
{
SaveSettingsFileEx(hSession, tmpfile);
});
var matchingProfiles = new List<string>();
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))
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))
{
matchingProfiles.Add(m.Result("${profile}"));
if (ms.Result("${app}").ToLower() == lowerApplicationName)
{
matchingProfiles.Add(m.Result("${profile}"));
}
}
}
}
return string.Join(";", matchingProfiles);
}
finally
{
if (File.Exists(tmpfile))
File.Delete(tmpfile);
}
if (File.Exists(tmpfile))
File.Delete(tmpfile);
return string.Join(";", matchingProfiles);
}
}

View File

@@ -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)
{
lock (_Sync)
{
if (HoldSession && (GlobalSession == IntPtr.Zero))
if (!HoldSession || forceNonGlobalSession)
return NonGlobalDrsSession<T>(action);
if (GlobalSession == IntPtr.Zero)
{
#pragma warning disable CS0420
@@ -38,12 +38,12 @@ namespace nspector.Common
}
}
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()
@@ -82,6 +82,6 @@ namespace nspector.Common
}
}
}

View File

@@ -59,45 +59,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\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);
});
}
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)
@@ -248,7 +259,7 @@ 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) =>
{

View File

@@ -50,9 +50,9 @@ namespace nspector.Common
});
}
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)

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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("-", ""));
}
}
}

View File

@@ -0,0 +1,40 @@
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; }
private static string GetSettingsFilename()
{
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());
}
}
}

View File

@@ -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)

View File

@@ -3,17 +3,23 @@
<ShowCustomizedSettingNamesOnly>false</ShowCustomizedSettingNamesOnly>
<Settings>
<CustomSetting>
<UserfriendlyName>Anisotropic filtering HQ Fix</UserfriendlyName>
<HexSettingID>0X00CE2692</HexSettingID>
<UserfriendlyName>NVLINK SLI Mode</UserfriendlyName>
<HexSettingID>0x00A06948</HexSettingID>
<GroupName>6 - SLI</GroupName>
<MinRequiredDriverVersion>410.00</MinRequiredDriverVersion>
</CustomSetting>
<CustomSetting>
<UserfriendlyName>Texture filtering - Quality substitution</UserfriendlyName>
<HexSettingID>0x00CE2692</HexSettingID>
<GroupName>4 - Texture Filtering</GroupName>
<MinRequiredDriverVersion>418.00</MinRequiredDriverVersion>
<SettingValues>
<CustomSettingValue>
<UserfriendlyName>Off</UserfriendlyName>
<UserfriendlyName>No Substitution</UserfriendlyName>
<HexValue>0x00000000</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>On</UserfriendlyName>
<UserfriendlyName>High quality becomes quality</UserfriendlyName>
<HexValue>0x00000001</HexValue>
</CustomSettingValue>
</SettingValues>

View File

@@ -16,6 +16,7 @@
OGL_OVERLAY_SUPPORT_ID = 0x206C28C4,
OGL_QUALITY_ENHANCEMENTS_ID = 0x20797D6C,
OGL_SINGLE_BACKDEPTH_BUFFER_ID = 0x20A29055,
OGL_SLI_CFR_MODE_ID = 0x20343843,
OGL_SLI_MULTICAST_ID = 0x2092D3BE,
OGL_THREAD_CONTROL_ID = 0x20C1221E,
OGL_TMON_LEVEL_ID = 0x202888C1,
@@ -35,6 +36,7 @@
APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ID = 0x104554B6,
APPLICATION_STEAM_ID_ID = 0x107CDDBC,
BATTERY_BOOST_ID = 0x10115C89,
BATTERY_BOOST_APP_FPS_ID = 0x10115C8C,
CPL_HIDDEN_PROFILE_ID = 0x106D5CFF,
CUDA_EXCLUDED_GPUS_ID = 0x10354FF8,
D3DOGL_GPU_MAX_POWER_ID = 0x10D1EF29,
@@ -92,14 +94,15 @@
PS_TEXFILTER_DISABLE_TRILIN_SLOPE_ID = 0x002ECAF2,
PS_TEXFILTER_NO_NEG_LODBIAS_ID = 0x0019BB68,
QUALITY_ENHANCEMENTS_ID = 0x00CE2691,
QUALITY_ENHANCEMENT_SUBSTITUTION_ID = 0x00CE2692,
REFRESH_RATE_OVERRIDE_ID = 0x0064B541,
SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_ID = 0x00AE785C,
SET_VAB_DATA_ID = 0x00AB8687,
VSYNCMODE_ID = 0x00A879CF,
VSYNCTEARCONTROL_ID = 0x005A375C,
TOTAL_DWORD_SETTING_NUM = 92,
TOTAL_DWORD_SETTING_NUM = 95,
TOTAL_WSTRING_SETTING_NUM = 4,
TOTAL_SETTING_NUM = 96,
TOTAL_SETTING_NUM = 99,
INVALID_SETTING_ID = 0xFFFFFFFF
}
@@ -205,6 +208,14 @@
OGL_SINGLE_BACKDEPTH_BUFFER_DEFAULT = OGL_SINGLE_BACKDEPTH_BUFFER_DISABLE
}
public enum EValues_OGL_SLI_CFR_MODE : uint {
OGL_SLI_CFR_MODE_CFR = 0x00,
OGL_SLI_CFR_MODE_CLASSIC_SFR = 0x01,
OGL_SLI_CFR_MODE_DISABLE = 0x02,
OGL_SLI_CFR_MODE_NUM_VALUES = 3,
OGL_SLI_CFR_MODE_DEFAULT = OGL_SLI_CFR_MODE_CFR
}
public enum EValues_OGL_SLI_MULTICAST : uint {
OGL_SLI_MULTICAST_DISABLE = 0x00,
OGL_SLI_MULTICAST_ENABLE = 0x01,
@@ -439,6 +450,14 @@
BATTERY_BOOST_DEFAULT = BATTERY_BOOST_DISABLED
}
public enum EValues_BATTERY_BOOST_APP_FPS : uint {
BATTERY_BOOST_APP_FPS_MIN = 0x00000001,
BATTERY_BOOST_APP_FPS_MAX = 0x000000ff,
BATTERY_BOOST_APP_FPS_NO_OVERRIDE = 0x00000000,
BATTERY_BOOST_APP_FPS_NUM_VALUES = 3,
BATTERY_BOOST_APP_FPS_DEFAULT = BATTERY_BOOST_APP_FPS_NO_OVERRIDE
}
public enum EValues_CPL_HIDDEN_PROFILE : uint {
CPL_HIDDEN_PROFILE_DISABLED = 0,
CPL_HIDDEN_PROFILE_ENABLED = 1,
@@ -585,14 +604,18 @@
PS_FRAMERATE_MONITOR_CTRL_ENABLE_ON_VSYNC = 0x00800000,
PS_FRAMERATE_MONITOR_CTRL_VSYNC_OFFSET_MASK = 0x0000F000,
PS_FRAMERATE_MONITOR_CTRL_VSYNC_OFFSET_SHIFT = 12,
PS_FRAMERATE_MONITOR_CTRL_FRL_OFFSET_MASK = 0x000F0000,
PS_FRAMERATE_MONITOR_CTRL_FRL_OFFSET_SHIFT = 16,
PS_FRAMERATE_MONITOR_CTRL_FPS_USE_FRL = 0x00000000,
PS_FRAMERATE_MONITOR_CTRL_FPS_30 = 0x1E000000,
PS_FRAMERATE_MONITOR_CTRL_FPS_60 = 0x3C000000,
PS_FRAMERATE_MONITOR_CTRL_FPS_MASK = 0xFF000000,
PS_FRAMERATE_MONITOR_CTRL_FPS_SHIFT = 24,
PS_FRAMERATE_MONITOR_CTRL_OPTIMAL_SETTING = 0x00000364,
PS_FRAMERATE_MONITOR_CTRL_OPTIMAL_SETTING_V2 = 0x00080364,
PS_FRAMERATE_MONITOR_CTRL_VSYNC_OPTIMAL_SETTING = 0x0080f364,
PS_FRAMERATE_MONITOR_CTRL_NUM_VALUES = 15,
PS_FRAMERATE_MONITOR_CTRL_VSYNC_OPTIMAL_SETTING_V2 = 0x0088f364,
PS_FRAMERATE_MONITOR_CTRL_NUM_VALUES = 19,
PS_FRAMERATE_MONITOR_CTRL_DEFAULT = PS_FRAMERATE_MONITOR_CTRL_DISABLED
}
@@ -960,6 +983,13 @@
QUALITY_ENHANCEMENTS_DEFAULT = QUALITY_ENHANCEMENTS_QUALITY
}
public enum EValues_QUALITY_ENHANCEMENT_SUBSTITUTION : uint {
QUALITY_ENHANCEMENT_SUBSTITUTION_NO_SUBSTITUTION = 0x00000000,
QUALITY_ENHANCEMENT_SUBSTITUTION_HIGHQUALITY_BECOMES_QUALITY = 0x00000001,
QUALITY_ENHANCEMENT_SUBSTITUTION_NUM_VALUES = 2,
QUALITY_ENHANCEMENT_SUBSTITUTION_DEFAULT = QUALITY_ENHANCEMENT_SUBSTITUTION_NO_SUBSTITUTION
}
public enum EValues_REFRESH_RATE_OVERRIDE : uint {
REFRESH_RATE_OVERRIDE_APPLICATION_CONTROLLED = 0x00000000,
REFRESH_RATE_OVERRIDE_HIGHEST_AVAILABLE = 0x00000001,

View File

@@ -55,6 +55,7 @@
#define OGL_OVERLAY_SUPPORT_STRING L"Enable overlay"
#define OGL_QUALITY_ENHANCEMENTS_STRING L"High level control of the rendering quality on OpenGL"
#define OGL_SINGLE_BACKDEPTH_BUFFER_STRING L"Unified back/depth buffer"
#define OGL_SLI_CFR_MODE_STRING L"Set CFR mode"
#define OGL_SLI_MULTICAST_STRING L"Enable NV_gpu_multicast extension"
#define OGL_THREAD_CONTROL_STRING L"Threaded optimization"
#define OGL_TMON_LEVEL_STRING L"Event Log Tmon Severity Threshold"
@@ -74,6 +75,7 @@
#define APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_STRING L"Application Profile Notification Popup Timeout"
#define APPLICATION_STEAM_ID_STRING L"Steam Application ID"
#define BATTERY_BOOST_STRING L"Battery Boost"
#define BATTERY_BOOST_APP_FPS_STRING L"Battery Boost Application FPS"
#define CPL_HIDDEN_PROFILE_STRING L"Do not display this profile in the Control Panel"
#define CUDA_EXCLUDED_GPUS_STRING L"List of Universal GPU ids"
#define D3DOGL_GPU_MAX_POWER_STRING L"Maximum GPU Power"
@@ -116,7 +118,7 @@
#define WKS_MEMORY_ALLOCATION_POLICY_STRING L"Memory Allocation Policy"
#define WKS_STEREO_DONGLE_SUPPORT_STRING L"Stereo - Dongle Support"
#define WKS_STEREO_SUPPORT_STRING L"Stereo - Enable"
#define WKS_STEREO_SWAP_MODE_STRING L"Stereo <EFBFBD> swap mode"
#define WKS_STEREO_SWAP_MODE_STRING L"Stereo - swap mode"
#define AO_MODE_STRING L"Ambient Occlusion"
#define AO_MODE_ACTIVE_STRING L"NVIDIA Predefined Ambient Occlusion Usage"
#define AUTO_LODBIASADJUST_STRING L"Texture filtering - Driver Controlled LOD Bias"
@@ -131,6 +133,7 @@
#define PS_TEXFILTER_DISABLE_TRILIN_SLOPE_STRING L"Texture filtering - Trilinear optimization"
#define PS_TEXFILTER_NO_NEG_LODBIAS_STRING L"Texture filtering - Negative LOD bias"
#define QUALITY_ENHANCEMENTS_STRING L"Texture filtering - Quality"
#define QUALITY_ENHANCEMENT_SUBSTITUTION_STRING L"Texture filtering - Quality Substitution"
#define REFRESH_RATE_OVERRIDE_STRING L"Preferred refresh rate"
#define SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_STRING L"PowerThrottle"
#define SET_VAB_DATA_STRING L"VAB Default Data"
@@ -153,6 +156,7 @@ enum ESetting {
OGL_OVERLAY_SUPPORT_ID = 0x206C28C4,
OGL_QUALITY_ENHANCEMENTS_ID = 0x20797D6C,
OGL_SINGLE_BACKDEPTH_BUFFER_ID = 0x20A29055,
OGL_SLI_CFR_MODE_ID = 0x20343843,
OGL_SLI_MULTICAST_ID = 0x2092D3BE,
OGL_THREAD_CONTROL_ID = 0x20C1221E,
OGL_TMON_LEVEL_ID = 0x202888C1,
@@ -172,6 +176,7 @@ enum ESetting {
APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ID = 0x104554B6,
APPLICATION_STEAM_ID_ID = 0x107CDDBC,
BATTERY_BOOST_ID = 0x10115C89,
BATTERY_BOOST_APP_FPS_ID = 0x10115C8C,
CPL_HIDDEN_PROFILE_ID = 0x106D5CFF,
CUDA_EXCLUDED_GPUS_ID = 0x10354FF8,
D3DOGL_GPU_MAX_POWER_ID = 0x10D1EF29,
@@ -229,14 +234,15 @@ enum ESetting {
PS_TEXFILTER_DISABLE_TRILIN_SLOPE_ID = 0x002ECAF2,
PS_TEXFILTER_NO_NEG_LODBIAS_ID = 0x0019BB68,
QUALITY_ENHANCEMENTS_ID = 0x00CE2691,
QUALITY_ENHANCEMENT_SUBSTITUTION_ID = 0x00CE2692,
REFRESH_RATE_OVERRIDE_ID = 0x0064B541,
SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_ID = 0x00AE785C,
SET_VAB_DATA_ID = 0x00AB8687,
VSYNCMODE_ID = 0x00A879CF,
VSYNCTEARCONTROL_ID = 0x005A375C,
TOTAL_DWORD_SETTING_NUM = 92,
TOTAL_DWORD_SETTING_NUM = 95,
TOTAL_WSTRING_SETTING_NUM = 4,
TOTAL_SETTING_NUM = 96,
TOTAL_SETTING_NUM = 99,
INVALID_SETTING_ID = 0xFFFFFFFF
};
@@ -347,6 +353,14 @@ enum EValues_OGL_SINGLE_BACKDEPTH_BUFFER {
OGL_SINGLE_BACKDEPTH_BUFFER_DEFAULT = OGL_SINGLE_BACKDEPTH_BUFFER_DISABLE
};
enum EValues_OGL_SLI_CFR_MODE {
OGL_SLI_CFR_MODE_CFR = 0x00,
OGL_SLI_CFR_MODE_CLASSIC_SFR = 0x01,
OGL_SLI_CFR_MODE_DISABLE = 0x02,
OGL_SLI_CFR_MODE_NUM_VALUES = 3,
OGL_SLI_CFR_MODE_DEFAULT = OGL_SLI_CFR_MODE_CFR
};
enum EValues_OGL_SLI_MULTICAST {
OGL_SLI_MULTICAST_DISABLE = 0x00,
OGL_SLI_MULTICAST_ENABLE = 0x01,
@@ -581,6 +595,14 @@ enum EValues_BATTERY_BOOST {
BATTERY_BOOST_DEFAULT = BATTERY_BOOST_DISABLED
};
enum EValues_BATTERY_BOOST_APP_FPS {
BATTERY_BOOST_APP_FPS_MIN = 0x00000001,
BATTERY_BOOST_APP_FPS_MAX = 0x000000ff,
BATTERY_BOOST_APP_FPS_NO_OVERRIDE = 0x00000000,
BATTERY_BOOST_APP_FPS_NUM_VALUES = 3,
BATTERY_BOOST_APP_FPS_DEFAULT = BATTERY_BOOST_APP_FPS_NO_OVERRIDE
};
enum EValues_CPL_HIDDEN_PROFILE {
CPL_HIDDEN_PROFILE_DISABLED = 0,
CPL_HIDDEN_PROFILE_ENABLED = 1,
@@ -735,14 +757,18 @@ enum EValues_PS_FRAMERATE_MONITOR_CTRL {
PS_FRAMERATE_MONITOR_CTRL_ENABLE_ON_VSYNC = 0x00800000,
PS_FRAMERATE_MONITOR_CTRL_VSYNC_OFFSET_MASK = 0x0000F000,
PS_FRAMERATE_MONITOR_CTRL_VSYNC_OFFSET_SHIFT = 12,
PS_FRAMERATE_MONITOR_CTRL_FRL_OFFSET_MASK = 0x000F0000,
PS_FRAMERATE_MONITOR_CTRL_FRL_OFFSET_SHIFT = 16,
PS_FRAMERATE_MONITOR_CTRL_FPS_USE_FRL = 0x00000000,
PS_FRAMERATE_MONITOR_CTRL_FPS_30 = 0x1E000000,
PS_FRAMERATE_MONITOR_CTRL_FPS_60 = 0x3C000000,
PS_FRAMERATE_MONITOR_CTRL_FPS_MASK = 0xFF000000,
PS_FRAMERATE_MONITOR_CTRL_FPS_SHIFT = 24,
PS_FRAMERATE_MONITOR_CTRL_OPTIMAL_SETTING = 0x00000364,
PS_FRAMERATE_MONITOR_CTRL_OPTIMAL_SETTING_V2 = 0x00080364,
PS_FRAMERATE_MONITOR_CTRL_VSYNC_OPTIMAL_SETTING = 0x0080f364,
PS_FRAMERATE_MONITOR_CTRL_NUM_VALUES = 15,
PS_FRAMERATE_MONITOR_CTRL_VSYNC_OPTIMAL_SETTING_V2 = 0x0088f364,
PS_FRAMERATE_MONITOR_CTRL_NUM_VALUES = 19,
PS_FRAMERATE_MONITOR_CTRL_DEFAULT = PS_FRAMERATE_MONITOR_CTRL_DISABLED
};
@@ -1111,6 +1137,13 @@ enum EValues_QUALITY_ENHANCEMENTS {
QUALITY_ENHANCEMENTS_DEFAULT = QUALITY_ENHANCEMENTS_QUALITY
};
enum EValues_QUALITY_ENHANCEMENT_SUBSTITUTION {
QUALITY_ENHANCEMENT_SUBSTITUTION_NO_SUBSTITUTION = 0x00000000,
QUALITY_ENHANCEMENT_SUBSTITUTION_HIGHQUALITY_BECOMES_QUALITY = 0x00000001,
QUALITY_ENHANCEMENT_SUBSTITUTION_NUM_VALUES = 2,
QUALITY_ENHANCEMENT_SUBSTITUTION_DEFAULT = QUALITY_ENHANCEMENT_SUBSTITUTION_NO_SUBSTITUTION
};
enum EValues_REFRESH_RATE_OVERRIDE {
REFRESH_RATE_OVERRIDE_APPLICATION_CONTROLLED = 0x00000000,
REFRESH_RATE_OVERRIDE_HIGHEST_AVAILABLE = 0x00000001,

View File

@@ -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.2.0.0")]
[assembly: AssemblyFileVersion("2.2.0.0")]
[assembly: AssemblyVersion("2.3.0.0")]
[assembly: AssemblyFileVersion("2.3.0.0")]

View File

@@ -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 {
/// &lt;ShowCustomizedSettingNamesOnly&gt;false&lt;/ShowCustomizedSettingNamesOnly&gt;
/// &lt;Settings&gt;
/// &lt;CustomSetting&gt;
/// &lt;UserfriendlyName&gt;Enable Maxwell sample interleaving (MFAA)&lt;/UserfriendlyName&gt;
/// &lt;HexSettingID&gt;0x0098C1AC&lt;/HexSettingID&gt;
/// &lt;GroupName&gt;3 - Antialiasing&lt;/GroupName&gt;
/// &lt;MinRequiredDriverVersion&gt;344.11&lt;/MinRequiredDriverVersion&gt;
/// &lt;SettingValues&gt;
/// &lt;CustomSettingValue&gt;
/// &lt;UserfriendlyName&gt;Off&lt;/Userfrie [Rest der Zeichenfolge wurde abgeschnitten]&quot;; ähnelt.
/// &lt;UserfriendlyName&gt;NVLINK SLI Mode&lt;/UserfriendlyName&gt;
/// &lt;HexSettingID&gt;0x00A06948&lt;/HexSettingID&gt;
/// &lt;GroupName&gt;6 - SLI&lt;/GroupName&gt;
/// &lt;MinRequiredDriverVersion&gt;410.00&lt;/MinRequiredDriverVersion&gt;
/// &lt;/CustomSetting&gt;
/// &lt;CustomSetting&gt;
/// &lt;UserfriendlyName&gt;Texture filtering - Quality substitution&lt;/UserfriendlyName&gt;
/// [Rest der Zeichenfolge wurde abgeschnitten]&quot;; ähnelt.
/// </summary>
public static string CustomSettingNames {
get {

View File

@@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

View File

@@ -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();

View File

@@ -91,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, 475);
this.pbMain.Margin = new System.Windows.Forms.Padding(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(840, 9);
this.pbMain.Size = new System.Drawing.Size(1120, 11);
this.pbMain.TabIndex = 19;
//
// tsMain
@@ -132,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(840, 25);
this.tsMain.Size = new System.Drawing.Size(1120, 31);
this.tsMain.TabIndex = 24;
this.tsMain.Text = "toolStrip1";
//
@@ -144,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
@@ -156,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);
//
@@ -167,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);
@@ -176,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
//
@@ -184,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);
//
@@ -194,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);
//
@@ -204,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);
//
@@ -214,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
//
@@ -229,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);
//
@@ -239,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);
@@ -247,7 +247,7 @@
// tsSep3
//
this.tsSep3.Name = "tsSep3";
this.tsSep3.Size = new System.Drawing.Size(6, 25);
this.tsSep3.Size = new System.Drawing.Size(6, 31);
//
// tsbExportProfiles
//
@@ -260,35 +260,35 @@
this.tsbExportProfiles.Image = global::nspector.Properties.Resources.export1;
this.tsbExportProfiles.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbExportProfiles.Name = "tsbExportProfiles";
this.tsbExportProfiles.Size = new System.Drawing.Size(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);
//
// exportCurrentProfileOnlyToolStripMenuItem
//
this.exportCurrentProfileOnlyToolStripMenuItem.Name = "exportCurrentProfileOnlyToolStripMenuItem";
this.exportCurrentProfileOnlyToolStripMenuItem.Size = new System.Drawing.Size(342, 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(342, 22);
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(342, 22);
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(342, 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);
//
@@ -301,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
//
@@ -331,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
//
@@ -348,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);
//
@@ -358,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
//
@@ -374,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);
@@ -384,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(732, 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);
@@ -399,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(840, 17);
this.lblApplications.Size = new System.Drawing.Size(1120, 21);
this.lblApplications.TabIndex = 25;
this.lblApplications.Text = "fsagame.exe, bond.exe, herozero.exe";
//
@@ -440,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);
@@ -451,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;
@@ -501,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(840, 418);
this.lvSettings.Size = new System.Drawing.Size(1119, 514);
this.lvSettings.SmallImageList = this.ilListView;
this.lvSettings.TabIndex = 2;
this.lvSettings.UseCompatibleStateImageBehavior = false;
@@ -514,7 +514,6 @@
this.lvSettings.ColumnWidthChanging += new System.Windows.Forms.ColumnWidthChangingEventHandler(this.lvSettings_ColumnWidthChanging);
this.lvSettings.SelectedIndexChanged += new System.EventHandler(this.lvSettings_SelectedIndexChanged);
this.lvSettings.DoubleClick += new System.EventHandler(this.lvSettings_DoubleClick);
this.lvSettings.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lvSettings_KeyDown);
this.lvSettings.Resize += new System.EventHandler(this.lvSettings_Resize);
//
// chSettingID
@@ -534,9 +533,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(864, 492);
this.ClientSize = new System.Drawing.Size(1152, 606);
this.Controls.Add(this.lblWidth30);
this.Controls.Add(this.lblWidth16);
this.Controls.Add(this.lblWidth330);
@@ -547,12 +546,13 @@
this.Controls.Add(this.pbMain);
this.Controls.Add(this.btnResetValue);
this.Controls.Add(this.cbValues);
this.Margin = new System.Windows.Forms.Padding(4);
this.MinimumSize = new System.Drawing.Size(880, 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);

View File

@@ -1,30 +1,28 @@
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.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;
@@ -32,7 +30,7 @@ namespace nspector
private bool _activated = false;
private bool _isStartup = true;
private bool _skipScan = false;
private string _baseProfileName = "";
private bool _isWin7TaskBar = false;
private int _lastComboRowIndex = -1;
@@ -50,6 +48,7 @@ namespace nspector
copyDataStruct = (MessageHelper.COPYDATASTRUCT)m.GetLParam(copyDataType);
if (copyDataStruct.lpData.Equals("ProfilesImported"))
{
DrsSessionScope.DestroyGlobalSession();
RefreshAll();
}
break;
@@ -224,7 +223,7 @@ namespace nspector
itm = v;
cbValues.Items.Add(itm);
}
}
@@ -268,7 +267,7 @@ namespace nspector
cbValues.Visible = true;
}
}
else
@@ -310,7 +309,7 @@ namespace nspector
{
var settingId = (uint)cbValues.Tag;
var activeImages = new[] { 0, 2 };
int idx = GetListViewIndexOfSetting(settingId);
if (idx != -1)
{
@@ -454,16 +453,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)
@@ -481,14 +471,13 @@ 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();
@@ -524,7 +513,7 @@ namespace nspector
Height = Screen.GetWorkingArea(this).Height - 20;
}
}
private void RefreshModifiesProfilesDropDown()
{
tsbModifiedProfiles.DropDownItems.Clear();
@@ -547,6 +536,7 @@ namespace nspector
{
SetupLayout();
SetTitleVersion();
LoadSettings();
RefreshProfilesCombo();
cbProfiles.Text = GetBaseProfileName();
@@ -632,7 +622,7 @@ namespace nspector
catch { }
}
}
private void AddToModifiedProfiles(string profileName, bool userProfile = false)
{
if (!_scanner.UserProfiles.Contains(profileName) && profileName != _baseProfileName && userProfile)
@@ -661,121 +651,20 @@ 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)
return;
@@ -785,10 +674,37 @@ namespace nspector
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);
else
StartModifiedProfilesScan(showProfileDialog);
{
_alreadyScannedForPredefinedSettings = true;
await _scanner.ScanForPredefinedProfileSettingsAsync(progressHandler, _scannerCancelationTokenSource.Token);
_meta.ResetMetaCache();
tscbShowScannedUnknownSettings.Enabled = true;
}
await _scanner.ScanForModifiedProfilesAsync(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)
@@ -805,7 +721,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)
{
@@ -818,7 +734,7 @@ namespace nspector
RefreshProfilesCombo();
RefreshCurrentProfile();
ScanProfilesSilent(true, false);
await ScanProfilesSilentAsync(true, false);
cbProfiles.Text = GetBaseProfileName();
}
}
@@ -890,14 +806,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.Token.IsCancellationRequested && WindowState != FormWindowState.Maximized)
{
new MessageHelper().bringAppToFront((int)this.Handle);
}
@@ -1025,9 +941,9 @@ 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 ExportCurrentProfile(bool includePredefined)
@@ -1091,10 +1007,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)
@@ -1146,7 +1062,7 @@ namespace nspector
cbProfiles.Select(cbProfiles.Text.Length, 0);
}
}
public static void ShowImportDoneMessage(string importReport)
{
@@ -1216,9 +1132,57 @@ namespace nspector
}
}
private void lvSettings_KeyDown(object sender, KeyEventArgs e)
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.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();
}
private void frmDrvSettings_FormClosed(object sender, FormClosedEventArgs e)
{
_scannerCancelationTokenSource?.Cancel();
SaveSettings();
}
}
}

View File

@@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADI
DAAAAk1TRnQBSQFMAgEBBAEAAZABBwGQAQcBEAEAARABAAT/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

View File

@@ -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 />
@@ -138,6 +138,8 @@
<Compile Include="Common\Helper\ListViewGroupSorter.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\NvD3dUmxSettingMetaService.cs" />
@@ -224,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>