mirror of
https://github.com/Orbmu2k/nvidiaProfileInspector.git
synced 2026-01-10 07:48:10 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de9f86e878 | ||
|
|
8e0360149c | ||
|
|
bf8aa6c124 |
@@ -549,7 +549,7 @@ namespace nspector.Common
|
||||
});
|
||||
}
|
||||
|
||||
private string GetApplicationFingerprint(NVDRS_APPLICATION_V3 application)
|
||||
private string GetApplicationFingerprint(NVDRS_APPLICATION_V4 application)
|
||||
{
|
||||
return $"{application.appName}|{application.fileInFolder}|{application.userFriendlyName}|{application.launcher}";
|
||||
}
|
||||
|
||||
@@ -215,9 +215,9 @@ namespace nspector.Common
|
||||
|
||||
protected void AddApplication(IntPtr hSession, IntPtr hProfile, string applicationName)
|
||||
{
|
||||
var newApp = new NVDRS_APPLICATION_V3()
|
||||
var newApp = new NVDRS_APPLICATION_V4()
|
||||
{
|
||||
version = nvw.NVDRS_APPLICATION_VER_V3,
|
||||
version = nvw.NVDRS_APPLICATION_VER_V4,
|
||||
appName = applicationName,
|
||||
};
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace nspector.Common
|
||||
|
||||
}
|
||||
|
||||
protected void DeleteApplication(IntPtr hSession, IntPtr hProfile, NVDRS_APPLICATION_V3 application)
|
||||
protected void DeleteApplication(IntPtr hSession, IntPtr hProfile, NVDRS_APPLICATION_V4 application)
|
||||
{
|
||||
var caRes = nvw.DRS_DeleteApplicationEx(hSession, hProfile, ref application);
|
||||
if (caRes != NvAPI_Status.NVAPI_OK)
|
||||
@@ -285,16 +285,16 @@ namespace nspector.Common
|
||||
return settings.ToList();
|
||||
}
|
||||
|
||||
protected List<NVDRS_APPLICATION_V3> GetProfileApplications(IntPtr hSession, IntPtr hProfile)
|
||||
protected List<NVDRS_APPLICATION_V4> GetProfileApplications(IntPtr hSession, IntPtr hProfile)
|
||||
{
|
||||
uint appCount = 512;
|
||||
var apps = new NVDRS_APPLICATION_V3[512];
|
||||
apps[0].version = NvapiDrsWrapper.NVDRS_APPLICATION_VER_V3;
|
||||
var apps = new NVDRS_APPLICATION_V4[512];
|
||||
apps[0].version = NvapiDrsWrapper.NVDRS_APPLICATION_VER_V4;
|
||||
|
||||
var esRes = NvapiDrsWrapper.DRS_EnumApplications(hSession, hProfile, 0, ref appCount, ref apps);
|
||||
|
||||
if (esRes == NvAPI_Status.NVAPI_END_ENUMERATION)
|
||||
return new List<NVDRS_APPLICATION_V3>();
|
||||
return new List<NVDRS_APPLICATION_V4>();
|
||||
|
||||
if (esRes != NvAPI_Status.NVAPI_OK)
|
||||
throw new NvapiException("DRS_EnumApplications", esRes);
|
||||
|
||||
@@ -344,7 +344,8 @@ namespace nspector.Native.NVAPI2
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode)]
|
||||
internal struct NVDRS_APPLICATION_V3
|
||||
{
|
||||
public uint isMetro { get { return ((uint)((bitvector1 & 1))); } set { bitvector1 = ((uint)((value | bitvector1))); } }
|
||||
public bool isMetro { get { return (bitvector1 & 1) != 0; } set { if (value) bitvector1 |= 1; else bitvector1 &= ~1u; } }
|
||||
public bool isCommandLine { get { return (bitvector1 & 2) != 0; } set { if (value) bitvector1 |= 2; else bitvector1 &= ~2u; } }
|
||||
|
||||
public uint version;
|
||||
public uint isPredefined;
|
||||
@@ -359,6 +360,27 @@ namespace nspector.Native.NVAPI2
|
||||
private uint bitvector1;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode)]
|
||||
internal struct NVDRS_APPLICATION_V4
|
||||
{
|
||||
public bool isMetro { get { return (bitvector1 & 1) != 0; } set { if (value) bitvector1 |= 1; else bitvector1 &= ~1u; } }
|
||||
public bool isCommandLine { get { return (bitvector1 & 2) != 0; } set { if (value) bitvector1 |= 2; else bitvector1 &= ~2u; } }
|
||||
|
||||
public uint version;
|
||||
public uint isPredefined;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
public string appName;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
public string userFriendlyName;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
public string launcher;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
public string fileInFolder;
|
||||
private uint bitvector1;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]
|
||||
public string commandLine;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode)]
|
||||
internal struct NVDRS_PROFILE
|
||||
{
|
||||
@@ -388,7 +410,8 @@ namespace nspector.Native.NVAPI2
|
||||
public static uint NVDRS_APPLICATION_VER_V1 = MAKE_NVAPI_VERSION<NVDRS_APPLICATION_V1>(1);
|
||||
public static uint NVDRS_APPLICATION_VER_V2 = MAKE_NVAPI_VERSION<NVDRS_APPLICATION_V2>(2);
|
||||
public static uint NVDRS_APPLICATION_VER_V3 = MAKE_NVAPI_VERSION<NVDRS_APPLICATION_V3>(3);
|
||||
public static uint NVDRS_APPLICATION_VER = NVDRS_APPLICATION_VER_V3;
|
||||
public static uint NVDRS_APPLICATION_VER_V4 = MAKE_NVAPI_VERSION<NVDRS_APPLICATION_V4>(4);
|
||||
public static uint NVDRS_APPLICATION_VER = NVDRS_APPLICATION_VER_V4;
|
||||
public static uint NVDRS_PROFILE_VER = MAKE_NVAPI_VERSION<NVDRS_PROFILE>(1);
|
||||
|
||||
public const uint OGL_IMPLICIT_GPU_AFFINITY_NUM_VALUES = 1;
|
||||
@@ -549,11 +572,11 @@ namespace nspector.Native.NVAPI2
|
||||
public static readonly DRS_GetNumProfilesDelegate DRS_GetNumProfiles;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate NvAPI_Status DRS_CreateApplicationDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_APPLICATION_V3 pApplication);
|
||||
public delegate NvAPI_Status DRS_CreateApplicationDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_APPLICATION_V4 pApplication);
|
||||
public static readonly DRS_CreateApplicationDelegate DRS_CreateApplication;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate NvAPI_Status DRS_DeleteApplicationExDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_APPLICATION_V3 pApp);
|
||||
public delegate NvAPI_Status DRS_DeleteApplicationExDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_APPLICATION_V4 pApp);
|
||||
public static readonly DRS_DeleteApplicationExDelegate DRS_DeleteApplicationEx;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
@@ -561,7 +584,7 @@ namespace nspector.Native.NVAPI2
|
||||
public static readonly DRS_DeleteApplicationDelegate DRS_DeleteApplication;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate NvAPI_Status DRS_GetApplicationInfoDelegate(IntPtr hSession, IntPtr hProfile, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName, ref NVDRS_APPLICATION_V3 pApplication);
|
||||
public delegate NvAPI_Status DRS_GetApplicationInfoDelegate(IntPtr hSession, IntPtr hProfile, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName, ref NVDRS_APPLICATION_V4 pApplication);
|
||||
public static readonly DRS_GetApplicationInfoDelegate DRS_GetApplicationInfo;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
@@ -587,7 +610,7 @@ namespace nspector.Native.NVAPI2
|
||||
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate NvAPI_Status DRS_FindApplicationByNameDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName, ref IntPtr phProfile, ref NVDRS_APPLICATION_V3 pApplication);
|
||||
public delegate NvAPI_Status DRS_FindApplicationByNameDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName, ref IntPtr phProfile, ref NVDRS_APPLICATION_V4 pApplication);
|
||||
public static readonly DRS_FindApplicationByNameDelegate DRS_FindApplicationByName;
|
||||
|
||||
public static NvAPI_Status DRS_SetSetting(IntPtr hSession, IntPtr hProfile, ref NVDRS_SETTING pSetting)
|
||||
|
||||
146
nspector/frmDrvSettings.Designer.cs
generated
146
nspector/frmDrvSettings.Designer.cs
generated
@@ -93,18 +93,18 @@
|
||||
//
|
||||
// pbMain
|
||||
//
|
||||
this.pbMain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.pbMain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pbMain.Location = new System.Drawing.Point(22, 877);
|
||||
this.pbMain.Margin = new System.Windows.Forms.Padding(7);
|
||||
this.pbMain.Location = new System.Drawing.Point(12, 475);
|
||||
this.pbMain.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.pbMain.Name = "pbMain";
|
||||
this.pbMain.Size = new System.Drawing.Size(1540, 17);
|
||||
this.pbMain.Size = new System.Drawing.Size(840, 9);
|
||||
this.pbMain.TabIndex = 19;
|
||||
//
|
||||
// tsMain
|
||||
//
|
||||
this.tsMain.AllowMerge = false;
|
||||
this.tsMain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.tsMain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tsMain.AutoSize = false;
|
||||
this.tsMain.BackgroundImage = global::nspector.Properties.Resources.transparent16;
|
||||
@@ -136,11 +136,10 @@
|
||||
this.tsSep6,
|
||||
this.tsbApplyProfile});
|
||||
this.tsMain.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
|
||||
this.tsMain.Location = new System.Drawing.Point(22, 7);
|
||||
this.tsMain.Location = new System.Drawing.Point(12, 4);
|
||||
this.tsMain.Name = "tsMain";
|
||||
this.tsMain.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0);
|
||||
this.tsMain.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
|
||||
this.tsMain.Size = new System.Drawing.Size(1540, 46);
|
||||
this.tsMain.Size = new System.Drawing.Size(840, 25);
|
||||
this.tsMain.TabIndex = 24;
|
||||
this.tsMain.Text = "toolStrip1";
|
||||
//
|
||||
@@ -149,7 +148,7 @@
|
||||
this.tslProfiles.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
this.tslProfiles.Margin = new System.Windows.Forms.Padding(0, 5, 10, 2);
|
||||
this.tslProfiles.Name = "tslProfiles";
|
||||
this.tslProfiles.Size = new System.Drawing.Size(86, 39);
|
||||
this.tslProfiles.Size = new System.Drawing.Size(49, 18);
|
||||
this.tslProfiles.Text = "Profiles:";
|
||||
//
|
||||
// cbProfiles
|
||||
@@ -161,7 +160,7 @@
|
||||
this.cbProfiles.Margin = new System.Windows.Forms.Padding(1);
|
||||
this.cbProfiles.MaxDropDownItems = 50;
|
||||
this.cbProfiles.Name = "cbProfiles";
|
||||
this.cbProfiles.Size = new System.Drawing.Size(528, 38);
|
||||
this.cbProfiles.Size = new System.Drawing.Size(290, 23);
|
||||
this.cbProfiles.SelectedIndexChanged += new System.EventHandler(this.cbProfiles_SelectedIndexChanged);
|
||||
this.cbProfiles.TextChanged += new System.EventHandler(this.cbProfiles_TextChanged);
|
||||
//
|
||||
@@ -172,7 +171,7 @@
|
||||
this.tsbModifiedProfiles.Image = global::nspector.Properties.Resources.home_sm;
|
||||
this.tsbModifiedProfiles.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbModifiedProfiles.Name = "tsbModifiedProfiles";
|
||||
this.tsbModifiedProfiles.Size = new System.Drawing.Size(44, 40);
|
||||
this.tsbModifiedProfiles.Size = new System.Drawing.Size(36, 22);
|
||||
this.tsbModifiedProfiles.TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay;
|
||||
this.tsbModifiedProfiles.ToolTipText = "Back to global profile (Home) / User modified profiles";
|
||||
this.tsbModifiedProfiles.ButtonClick += new System.EventHandler(this.tsbModifiedProfiles_ButtonClick);
|
||||
@@ -181,7 +180,7 @@
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 46);
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// tsbRefreshProfile
|
||||
//
|
||||
@@ -189,7 +188,7 @@
|
||||
this.tsbRefreshProfile.Image = ((System.Drawing.Image)(resources.GetObject("tsbRefreshProfile.Image")));
|
||||
this.tsbRefreshProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbRefreshProfile.Name = "tsbRefreshProfile";
|
||||
this.tsbRefreshProfile.Size = new System.Drawing.Size(40, 40);
|
||||
this.tsbRefreshProfile.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbRefreshProfile.Text = "Refresh current profile.";
|
||||
this.tsbRefreshProfile.Click += new System.EventHandler(this.tsbRefreshProfile_Click);
|
||||
//
|
||||
@@ -199,7 +198,7 @@
|
||||
this.tsbRestoreProfile.Image = ((System.Drawing.Image)(resources.GetObject("tsbRestoreProfile.Image")));
|
||||
this.tsbRestoreProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbRestoreProfile.Name = "tsbRestoreProfile";
|
||||
this.tsbRestoreProfile.Size = new System.Drawing.Size(40, 40);
|
||||
this.tsbRestoreProfile.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbRestoreProfile.Text = "Restore current profile to NVIDIA defaults.";
|
||||
this.tsbRestoreProfile.Click += new System.EventHandler(this.tsbRestoreProfile_Click);
|
||||
//
|
||||
@@ -209,7 +208,7 @@
|
||||
this.tsbCreateProfile.Image = ((System.Drawing.Image)(resources.GetObject("tsbCreateProfile.Image")));
|
||||
this.tsbCreateProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbCreateProfile.Name = "tsbCreateProfile";
|
||||
this.tsbCreateProfile.Size = new System.Drawing.Size(40, 40);
|
||||
this.tsbCreateProfile.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbCreateProfile.Text = "Create new profile";
|
||||
this.tsbCreateProfile.Click += new System.EventHandler(this.tsbCreateProfile_Click);
|
||||
//
|
||||
@@ -219,14 +218,14 @@
|
||||
this.tsbDeleteProfile.Image = global::nspector.Properties.Resources.ieframe_1_18212;
|
||||
this.tsbDeleteProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbDeleteProfile.Name = "tsbDeleteProfile";
|
||||
this.tsbDeleteProfile.Size = new System.Drawing.Size(40, 40);
|
||||
this.tsbDeleteProfile.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbDeleteProfile.Text = "Delete current Profile";
|
||||
this.tsbDeleteProfile.Click += new System.EventHandler(this.tsbDeleteProfile_Click);
|
||||
//
|
||||
// tsSep2
|
||||
//
|
||||
this.tsSep2.Name = "tsSep2";
|
||||
this.tsSep2.Size = new System.Drawing.Size(6, 46);
|
||||
this.tsSep2.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// tsbAddApplication
|
||||
//
|
||||
@@ -234,7 +233,7 @@
|
||||
this.tsbAddApplication.Image = global::nspector.Properties.Resources.window_application_add;
|
||||
this.tsbAddApplication.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbAddApplication.Name = "tsbAddApplication";
|
||||
this.tsbAddApplication.Size = new System.Drawing.Size(40, 40);
|
||||
this.tsbAddApplication.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbAddApplication.Text = "Add application to current profile.";
|
||||
this.tsbAddApplication.Click += new System.EventHandler(this.tsbAddApplication_Click);
|
||||
//
|
||||
@@ -244,7 +243,7 @@
|
||||
this.tssbRemoveApplication.Image = global::nspector.Properties.Resources.window_application_delete;
|
||||
this.tssbRemoveApplication.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tssbRemoveApplication.Name = "tssbRemoveApplication";
|
||||
this.tssbRemoveApplication.Size = new System.Drawing.Size(44, 40);
|
||||
this.tssbRemoveApplication.Size = new System.Drawing.Size(36, 22);
|
||||
this.tssbRemoveApplication.Text = "Remove application from current profile";
|
||||
this.tssbRemoveApplication.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.tssbRemoveApplication_DropDownItemClicked);
|
||||
this.tssbRemoveApplication.Click += new System.EventHandler(this.tssbRemoveApplication_Click);
|
||||
@@ -252,7 +251,7 @@
|
||||
// tsSep3
|
||||
//
|
||||
this.tsSep3.Name = "tsSep3";
|
||||
this.tsSep3.Size = new System.Drawing.Size(6, 46);
|
||||
this.tsSep3.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// tsbExportProfiles
|
||||
//
|
||||
@@ -265,35 +264,35 @@
|
||||
this.tsbExportProfiles.Image = global::nspector.Properties.Resources.export1;
|
||||
this.tsbExportProfiles.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbExportProfiles.Name = "tsbExportProfiles";
|
||||
this.tsbExportProfiles.Size = new System.Drawing.Size(44, 40);
|
||||
this.tsbExportProfiles.Size = new System.Drawing.Size(36, 22);
|
||||
this.tsbExportProfiles.Text = "Export user defined profiles";
|
||||
this.tsbExportProfiles.Click += new System.EventHandler(this.tsbExportProfiles_Click);
|
||||
//
|
||||
// exportCurrentProfileOnlyToolStripMenuItem
|
||||
//
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Name = "exportCurrentProfileOnlyToolStripMenuItem";
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Size = new System.Drawing.Size(602, 40);
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Text = "Export current profile only";
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Click += new System.EventHandler(this.exportCurrentProfileOnlyToolStripMenuItem_Click);
|
||||
//
|
||||
// exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem
|
||||
//
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Name = "exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem";
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Size = new System.Drawing.Size(602, 40);
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Text = "Export current profile including predefined settings";
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Click += new System.EventHandler(this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem_Click);
|
||||
//
|
||||
// exportUserdefinedProfilesToolStripMenuItem
|
||||
//
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Name = "exportUserdefinedProfilesToolStripMenuItem";
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Size = new System.Drawing.Size(602, 40);
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Text = "Export all customized profiles";
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Click += new System.EventHandler(this.exportUserdefinedProfilesToolStripMenuItem_Click);
|
||||
//
|
||||
// exportAllProfilesNVIDIATextFormatToolStripMenuItem
|
||||
//
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Name = "exportAllProfilesNVIDIATextFormatToolStripMenuItem";
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(602, 40);
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Export all driver profiles (NVIDIA Text Format)";
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.exportAllProfilesNVIDIATextFormatToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -306,28 +305,28 @@
|
||||
this.tsbImportProfiles.Image = global::nspector.Properties.Resources.import1;
|
||||
this.tsbImportProfiles.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbImportProfiles.Name = "tsbImportProfiles";
|
||||
this.tsbImportProfiles.Size = new System.Drawing.Size(44, 40);
|
||||
this.tsbImportProfiles.Size = new System.Drawing.Size(36, 22);
|
||||
this.tsbImportProfiles.Text = "Import user defined profiles";
|
||||
this.tsbImportProfiles.Click += new System.EventHandler(this.tsbImportProfiles_Click);
|
||||
//
|
||||
// importProfilesToolStripMenuItem
|
||||
//
|
||||
this.importProfilesToolStripMenuItem.Name = "importProfilesToolStripMenuItem";
|
||||
this.importProfilesToolStripMenuItem.Size = new System.Drawing.Size(639, 40);
|
||||
this.importProfilesToolStripMenuItem.Size = new System.Drawing.Size(363, 22);
|
||||
this.importProfilesToolStripMenuItem.Text = "Import profile(s)";
|
||||
this.importProfilesToolStripMenuItem.Click += new System.EventHandler(this.importProfilesToolStripMenuItem_Click);
|
||||
//
|
||||
// importAllProfilesNVIDIATextFormatToolStripMenuItem
|
||||
//
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Name = "importAllProfilesNVIDIATextFormatToolStripMenuItem";
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(639, 40);
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(363, 22);
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Import (replace) all driver profiles (NVIDIA Text Format)";
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.importAllProfilesNVIDIATextFormatToolStripMenuItem_Click);
|
||||
//
|
||||
// tsSep4
|
||||
//
|
||||
this.tsSep4.Name = "tsSep4";
|
||||
this.tsSep4.Size = new System.Drawing.Size(6, 46);
|
||||
this.tsSep4.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// tscbShowCustomSettingNamesOnly
|
||||
//
|
||||
@@ -336,14 +335,14 @@
|
||||
this.tscbShowCustomSettingNamesOnly.Image = global::nspector.Properties.Resources.filter_user;
|
||||
this.tscbShowCustomSettingNamesOnly.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tscbShowCustomSettingNamesOnly.Name = "tscbShowCustomSettingNamesOnly";
|
||||
this.tscbShowCustomSettingNamesOnly.Size = new System.Drawing.Size(40, 40);
|
||||
this.tscbShowCustomSettingNamesOnly.Size = new System.Drawing.Size(24, 22);
|
||||
this.tscbShowCustomSettingNamesOnly.Text = "Show the settings and values from CustomSettingNames file only.";
|
||||
this.tscbShowCustomSettingNamesOnly.CheckedChanged += new System.EventHandler(this.cbCustomSettingsOnly_CheckedChanged);
|
||||
//
|
||||
// tsSep5
|
||||
//
|
||||
this.tsSep5.Name = "tsSep5";
|
||||
this.tsSep5.Size = new System.Drawing.Size(6, 46);
|
||||
this.tsSep5.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// tscbShowScannedUnknownSettings
|
||||
//
|
||||
@@ -353,7 +352,7 @@
|
||||
this.tscbShowScannedUnknownSettings.Image = global::nspector.Properties.Resources.find_set2;
|
||||
this.tscbShowScannedUnknownSettings.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tscbShowScannedUnknownSettings.Name = "tscbShowScannedUnknownSettings";
|
||||
this.tscbShowScannedUnknownSettings.Size = new System.Drawing.Size(40, 40);
|
||||
this.tscbShowScannedUnknownSettings.Size = new System.Drawing.Size(24, 22);
|
||||
this.tscbShowScannedUnknownSettings.Text = "Show unknown settings from NVIDIA predefined profiles";
|
||||
this.tscbShowScannedUnknownSettings.Click += new System.EventHandler(this.tscbShowScannedUnknownSettings_Click);
|
||||
//
|
||||
@@ -363,14 +362,14 @@
|
||||
this.tsbBitValueEditor.Image = global::nspector.Properties.Resources.text_binary;
|
||||
this.tsbBitValueEditor.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbBitValueEditor.Name = "tsbBitValueEditor";
|
||||
this.tsbBitValueEditor.Size = new System.Drawing.Size(40, 40);
|
||||
this.tsbBitValueEditor.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbBitValueEditor.Text = "Show bit value editor.";
|
||||
this.tsbBitValueEditor.Click += new System.EventHandler(this.tsbBitValueEditor_Click);
|
||||
//
|
||||
// tsSep6
|
||||
//
|
||||
this.tsSep6.Name = "tsSep6";
|
||||
this.tsSep6.Size = new System.Drawing.Size(6, 46);
|
||||
this.tsSep6.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// tsbApplyProfile
|
||||
//
|
||||
@@ -379,7 +378,7 @@
|
||||
this.tsbApplyProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbApplyProfile.Name = "tsbApplyProfile";
|
||||
this.tsbApplyProfile.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
|
||||
this.tsbApplyProfile.Size = new System.Drawing.Size(173, 40);
|
||||
this.tsbApplyProfile.Size = new System.Drawing.Size(109, 22);
|
||||
this.tsbApplyProfile.Text = "Apply changes";
|
||||
this.tsbApplyProfile.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.tsbApplyProfile.Click += new System.EventHandler(this.tsbApplyProfile_Click);
|
||||
@@ -389,25 +388,25 @@
|
||||
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(1342, 323);
|
||||
this.btnResetValue.Margin = new System.Windows.Forms.Padding(0, 2, 0, 0);
|
||||
this.btnResetValue.Location = new System.Drawing.Point(732, 175);
|
||||
this.btnResetValue.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
|
||||
this.btnResetValue.Name = "btnResetValue";
|
||||
this.btnResetValue.Size = new System.Drawing.Size(46, 35);
|
||||
this.btnResetValue.Size = new System.Drawing.Size(25, 19);
|
||||
this.btnResetValue.TabIndex = 7;
|
||||
this.btnResetValue.UseVisualStyleBackColor = true;
|
||||
this.btnResetValue.Click += new System.EventHandler(this.btnResetValue_Click);
|
||||
//
|
||||
// lblApplications
|
||||
//
|
||||
this.lblApplications.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.lblApplications.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblApplications.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(118)))), ((int)(((byte)(185)))), ((int)(((byte)(0)))));
|
||||
this.lblApplications.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.lblApplications.ForeColor = System.Drawing.Color.White;
|
||||
this.lblApplications.Location = new System.Drawing.Point(22, 59);
|
||||
this.lblApplications.Margin = new System.Windows.Forms.Padding(7, 0, 7, 0);
|
||||
this.lblApplications.Location = new System.Drawing.Point(12, 32);
|
||||
this.lblApplications.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblApplications.Name = "lblApplications";
|
||||
this.lblApplications.Size = new System.Drawing.Size(1540, 31);
|
||||
this.lblApplications.Size = new System.Drawing.Size(840, 17);
|
||||
this.lblApplications.TabIndex = 25;
|
||||
this.lblApplications.Text = "fsagame.exe, bond.exe, herozero.exe";
|
||||
this.lblApplications.DoubleClick += new System.EventHandler(this.tsbAddApplication_Click);
|
||||
@@ -446,10 +445,10 @@
|
||||
//
|
||||
this.cbValues.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.cbValues.FormattingEnabled = true;
|
||||
this.cbValues.Location = new System.Drawing.Point(961, 323);
|
||||
this.cbValues.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.cbValues.Location = new System.Drawing.Point(524, 175);
|
||||
this.cbValues.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.cbValues.Name = "cbValues";
|
||||
this.cbValues.Size = new System.Drawing.Size(129, 32);
|
||||
this.cbValues.Size = new System.Drawing.Size(72, 21);
|
||||
this.cbValues.TabIndex = 5;
|
||||
this.cbValues.Visible = false;
|
||||
this.cbValues.SelectedValueChanged += new System.EventHandler(this.cbValues_SelectedValueChanged);
|
||||
@@ -457,40 +456,40 @@
|
||||
//
|
||||
// lblWidth96
|
||||
//
|
||||
this.lblWidth96.Location = new System.Drawing.Point(141, 430);
|
||||
this.lblWidth96.Margin = new System.Windows.Forms.Padding(7, 0, 7, 0);
|
||||
this.lblWidth96.Location = new System.Drawing.Point(77, 233);
|
||||
this.lblWidth96.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth96.Name = "lblWidth96";
|
||||
this.lblWidth96.Size = new System.Drawing.Size(176, 33);
|
||||
this.lblWidth96.Size = new System.Drawing.Size(96, 18);
|
||||
this.lblWidth96.TabIndex = 77;
|
||||
this.lblWidth96.Text = "96";
|
||||
this.lblWidth96.Visible = false;
|
||||
//
|
||||
// lblWidth330
|
||||
//
|
||||
this.lblWidth330.Location = new System.Drawing.Point(141, 388);
|
||||
this.lblWidth330.Margin = new System.Windows.Forms.Padding(7, 0, 7, 0);
|
||||
this.lblWidth330.Location = new System.Drawing.Point(77, 210);
|
||||
this.lblWidth330.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth330.Name = "lblWidth330";
|
||||
this.lblWidth330.Size = new System.Drawing.Size(605, 41);
|
||||
this.lblWidth330.Size = new System.Drawing.Size(330, 22);
|
||||
this.lblWidth330.TabIndex = 78;
|
||||
this.lblWidth330.Text = "330 (Helper Labels for DPI Scaling)";
|
||||
this.lblWidth330.Visible = false;
|
||||
//
|
||||
// lblWidth16
|
||||
//
|
||||
this.lblWidth16.Location = new System.Drawing.Point(141, 497);
|
||||
this.lblWidth16.Margin = new System.Windows.Forms.Padding(7, 0, 7, 0);
|
||||
this.lblWidth16.Location = new System.Drawing.Point(77, 269);
|
||||
this.lblWidth16.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth16.Name = "lblWidth16";
|
||||
this.lblWidth16.Size = new System.Drawing.Size(29, 33);
|
||||
this.lblWidth16.Size = new System.Drawing.Size(16, 18);
|
||||
this.lblWidth16.TabIndex = 79;
|
||||
this.lblWidth16.Text = "16";
|
||||
this.lblWidth16.Visible = false;
|
||||
//
|
||||
// lblWidth30
|
||||
//
|
||||
this.lblWidth30.Location = new System.Drawing.Point(141, 463);
|
||||
this.lblWidth30.Margin = new System.Windows.Forms.Padding(7, 0, 7, 0);
|
||||
this.lblWidth30.Location = new System.Drawing.Point(77, 251);
|
||||
this.lblWidth30.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth30.Name = "lblWidth30";
|
||||
this.lblWidth30.Size = new System.Drawing.Size(55, 33);
|
||||
this.lblWidth30.Size = new System.Drawing.Size(30, 18);
|
||||
this.lblWidth30.TabIndex = 80;
|
||||
this.lblWidth30.Text = "30";
|
||||
this.lblWidth30.Visible = false;
|
||||
@@ -506,12 +505,12 @@
|
||||
this.lvSettings.GridLines = true;
|
||||
this.lvSettings.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||
this.lvSettings.HideSelection = false;
|
||||
this.lvSettings.Location = new System.Drawing.Point(0, 29);
|
||||
this.lvSettings.Margin = new System.Windows.Forms.Padding(7);
|
||||
this.lvSettings.Location = new System.Drawing.Point(0, 0);
|
||||
this.lvSettings.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.lvSettings.MultiSelect = false;
|
||||
this.lvSettings.Name = "lvSettings";
|
||||
this.lvSettings.ShowItemToolTips = true;
|
||||
this.lvSettings.Size = new System.Drawing.Size(1540, 661);
|
||||
this.lvSettings.Size = new System.Drawing.Size(840, 372);
|
||||
this.lvSettings.SmallImageList = this.ilListView;
|
||||
this.lvSettings.TabIndex = 2;
|
||||
this.lvSettings.UseCompatibleStateImageBehavior = false;
|
||||
@@ -540,47 +539,46 @@
|
||||
// tbSettingDescription
|
||||
//
|
||||
this.tbSettingDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.tbSettingDescription.Location = new System.Drawing.Point(0, 690);
|
||||
this.tbSettingDescription.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.tbSettingDescription.Location = new System.Drawing.Point(0, 372);
|
||||
this.tbSettingDescription.Multiline = true;
|
||||
this.tbSettingDescription.Name = "tbSettingDescription";
|
||||
this.tbSettingDescription.ReadOnly = true;
|
||||
this.tbSettingDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.tbSettingDescription.Size = new System.Drawing.Size(1540, 78);
|
||||
this.tbSettingDescription.Size = new System.Drawing.Size(840, 44);
|
||||
this.tbSettingDescription.TabIndex = 81;
|
||||
this.tbSettingDescription.Visible = false;
|
||||
//
|
||||
// pnlListview
|
||||
//
|
||||
this.pnlListview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
this.pnlListview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pnlListview.Controls.Add(this.lvSettings);
|
||||
this.pnlListview.Controls.Add(this.txtFilter);
|
||||
this.pnlListview.Controls.Add(this.tbSettingDescription);
|
||||
this.pnlListview.Location = new System.Drawing.Point(22, 96);
|
||||
this.pnlListview.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.pnlListview.Location = new System.Drawing.Point(12, 52);
|
||||
this.pnlListview.Name = "pnlListview";
|
||||
this.pnlListview.Size = new System.Drawing.Size(1540, 768);
|
||||
this.pnlListview.Size = new System.Drawing.Size(840, 416);
|
||||
this.pnlListview.TabIndex = 82;
|
||||
//
|
||||
// txtFilter
|
||||
//
|
||||
//
|
||||
this.txtFilter.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txtFilter.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.txtFilter.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.txtFilter.Location = new System.Drawing.Point(0, 0);
|
||||
this.txtFilter.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
this.txtFilter.Name = "txtFilter";
|
||||
this.txtFilter.Size = new System.Drawing.Size(1540, 29);
|
||||
this.txtFilter.Size = new System.Drawing.Size(2118, 35);
|
||||
this.txtFilter.TabIndex = 82;
|
||||
this.txtFilter.WatermarkText = "Search for setting...";
|
||||
this.txtFilter.TextChanged += new System.EventHandler(this.txtFilter_TextChanged);
|
||||
//
|
||||
// frmDrvSettings
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 22F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1584, 908);
|
||||
this.ClientSize = new System.Drawing.Size(864, 492);
|
||||
this.Controls.Add(this.pnlListview);
|
||||
this.Controls.Add(this.lblWidth30);
|
||||
this.Controls.Add(this.lblWidth16);
|
||||
@@ -591,8 +589,8 @@
|
||||
this.Controls.Add(this.pbMain);
|
||||
this.Controls.Add(this.btnResetValue);
|
||||
this.Controls.Add(this.cbValues);
|
||||
this.Margin = new System.Windows.Forms.Padding(7);
|
||||
this.MinimumSize = new System.Drawing.Size(1592, 585);
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.MinimumSize = new System.Drawing.Size(879, 346);
|
||||
this.Name = "frmDrvSettings";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "nSpector - Driver Profile Settings";
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace nspector
|
||||
|
||||
private bool isDevMode = false;
|
||||
|
||||
private Dictionary<string, bool> _groupCollapsedStates = new();
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
switch (m.Msg)
|
||||
@@ -190,6 +192,8 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
|
||||
ApplySearchFilter();
|
||||
|
||||
lvSettings.EndUpdate();
|
||||
|
||||
GC.Collect();
|
||||
@@ -209,7 +213,6 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RefreshProfilesCombo()
|
||||
@@ -550,8 +553,6 @@ namespace nspector
|
||||
LoadGroupStates(Path.Combine(AppContext.BaseDirectory, "HiddenGroups.ini"));
|
||||
}
|
||||
|
||||
private Dictionary<string, bool> _groupCollapsedStates = new();
|
||||
|
||||
private void lvSettings_GroupStateChanged(object sender, GroupStateChangedEventArgs e)
|
||||
{
|
||||
_groupCollapsedStates[e.Group.Header] = e.IsCollapsed;
|
||||
@@ -580,11 +581,11 @@ namespace nspector
|
||||
|
||||
private bool LoadGroupStates(string filePath)
|
||||
{
|
||||
_groupCollapsedStates.Clear();
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
return false;
|
||||
|
||||
_groupCollapsedStates.Clear();
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var line in File.ReadAllLines(filePath))
|
||||
@@ -707,8 +708,6 @@ namespace nspector
|
||||
DeleteSelectedValue();
|
||||
else
|
||||
ResetSelectedValue();
|
||||
|
||||
ApplySearchFilter();
|
||||
}
|
||||
|
||||
ToolTip appPathsTooltip = new ToolTip() { InitialDelay = 250 };
|
||||
@@ -921,8 +920,6 @@ namespace nspector
|
||||
catch { }
|
||||
|
||||
StoreChangesOfProfileToDriver();
|
||||
|
||||
ApplySearchFilter();
|
||||
}
|
||||
|
||||
private void tsbBitValueEditor_Click(object sender, EventArgs e)
|
||||
@@ -1402,81 +1399,36 @@ namespace nspector
|
||||
else if (!e.Control && (e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z ||
|
||||
e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9 ||
|
||||
e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9 ||
|
||||
e.KeyCode == Keys.Space || e.KeyCode == Keys.OemPeriod))
|
||||
e.KeyCode == Keys.Space || e.KeyCode == Keys.OemPeriod ||
|
||||
e.KeyCode == Keys.Back))
|
||||
{
|
||||
txtFilter.Visible = true;
|
||||
txtFilter.Focus();
|
||||
txtFilter.Text += e.Shift ? e.KeyCode.ToString() : e.KeyCode.ToString().ToLower();
|
||||
if (e.KeyCode == Keys.Back)
|
||||
{
|
||||
if (txtFilter.Text.Length > 0)
|
||||
{
|
||||
txtFilter.Text = txtFilter.Text.Substring(0, txtFilter.Text.Length - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
txtFilter.Text += e.Shift ? e.KeyCode.ToString() : e.KeyCode.ToString().ToLower();
|
||||
}
|
||||
txtFilter.SelectionStart = txtFilter.Text.Length;
|
||||
e.SuppressKeyPress = true;
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private CancellationTokenSource cts;
|
||||
|
||||
private void ApplySearchFilter(CancellationTokenSource cts = null)
|
||||
private void ApplySearchFilter()
|
||||
{
|
||||
var lowerInput = txtFilter.Text.Trim().ToLowerInvariant();
|
||||
|
||||
if (cts != null && cts.Token.IsCancellationRequested) return;
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
RefreshCurrentProfile();
|
||||
|
||||
if (string.IsNullOrEmpty(lowerInput))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lvSettings.BeginUpdate();
|
||||
foreach (ListViewItem itm in lvSettings.Items)
|
||||
{
|
||||
if (!itm.Text.ToLowerInvariant().Contains(lowerInput))
|
||||
{
|
||||
itm.Remove();
|
||||
}
|
||||
}
|
||||
lvSettings.EndUpdate();
|
||||
|
||||
txtFilter.Focus(); // Setting listbox sometimes steals focus away
|
||||
}));
|
||||
}
|
||||
|
||||
private async void txtFilter_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
cts?.Cancel();
|
||||
cts = new CancellationTokenSource();
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Delay(250, cts.Token); // search filter can be slow, wait for user to stop typing for ~250ms before we start refresh
|
||||
|
||||
if (cts.Token.IsCancellationRequested) return;
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
ApplySearchFilter(cts);
|
||||
});
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
// Ignore cancellation
|
||||
}
|
||||
}
|
||||
|
||||
private void txtFilter_TextChangedD(object sender, EventArgs e)
|
||||
{
|
||||
RefreshCurrentProfile();
|
||||
|
||||
if (string.IsNullOrEmpty(txtFilter.Text.Trim()))
|
||||
if (string.IsNullOrEmpty(lowerInput))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var lowerInput = txtFilter.Text.Trim().ToLowerInvariant();
|
||||
lvSettings.BeginUpdate();
|
||||
foreach (ListViewItem itm in lvSettings.Items)
|
||||
{
|
||||
@@ -1486,6 +1438,11 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
lvSettings.EndUpdate();
|
||||
}
|
||||
|
||||
private async void txtFilter_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshCurrentProfile();
|
||||
|
||||
txtFilter.Focus(); // Setting listbox sometimes steals focus away
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user