Compare commits

..

9 Commits

Author SHA1 Message Date
emoose
64f626e8a0 Use InputBox with browse button to add app, add yes/no prompt to reset profile 2025-02-19 00:25:19 +00:00
emoose
f62aa86ccc InputBox: add browse button 2025-02-18 23:33:12 +00:00
emoose
345444619c Add tooltip to app paths label 2025-02-18 23:33:12 +00:00
emoose
50006f114a Allow adding app path by string when double-clicking apps label
Can be used to add UWP IDs to the profile without needing to edit exported .nip
2025-02-18 23:33:12 +00:00
emoose
a3b524e7d9 InputBox: fix DPI scaling on later Windows versions 2025-02-18 23:33:12 +00:00
Orbmu2k
109fdd066a Merge pull request #273 from Orbmu2k/master-pull
MERGE PRs
2025-02-15 12:30:06 +01:00
Orbmu2k
9115ffa4cc Merge pull request #272 from emoose/listviewfix
Fix combobox requiring two clicks to open, add RTX digital vibrance
2025-02-15 12:27:10 +01:00
emoose
c0c37cbfbb Trim unneeded HDR settings, add RTX digital vibrance + DLSS preset L - O
nvapi returns presets L - O for future presets to use, add them to our list to make combobox items uniform
2025-02-14 08:24:06 +00:00
emoose
e548c384ec ListViewEx: skip repositioning opened combobox, fixes combobox requiring two clicks 2025-02-14 08:11:36 +00:00
5 changed files with 288 additions and 158 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows.Forms;
@@ -9,13 +10,14 @@ namespace nspector.Common.Helper
internal class InputBox
{
internal static DialogResult Show(string title, string promptText, ref string value, List<string> invalidInputs, string mandatoryFormatRegExPattern, int maxLength)
internal static DialogResult Show(string title, string promptText, ref string value, List<string> invalidInputs, string mandatoryFormatRegExPattern, int maxLength, bool allowExeBrowse = false)
{
var form = new Form();
var label = new Label();
var textBox = new TextBox();
var buttonOk = new Button();
var buttonCancel = new Button();
var buttonBrowse = new Button();
var imageBox = new PictureBox();
EventHandler textchanged = delegate (object sender, EventArgs e)
@@ -43,10 +45,23 @@ namespace nspector.Common.Helper
buttonOk.Enabled = true;
};
EventHandler buttonBrowse_Click = delegate (object sender, EventArgs e)
{
var openDialog = new OpenFileDialog();
openDialog.DefaultExt = "*.exe";
openDialog.Filter = "Application EXE Name|*.exe|Application Absolute Path|*.exe";
if (openDialog.ShowDialog() == DialogResult.OK)
{
string applicationName = new FileInfo(openDialog.FileName).Name;
if (openDialog.FilterIndex == 2)
applicationName = openDialog.FileName;
textBox.Text = applicationName;
}
};
textBox.TextChanged += textchanged;
form.Text = title;
label.Text = promptText;
textBox.Text = value;
@@ -55,28 +70,47 @@ namespace nspector.Common.Helper
buttonOk.Text = "OK";
buttonCancel.Text = "Cancel";
buttonBrowse.Text = "Browse...";
buttonOk.DialogResult = DialogResult.OK;
buttonCancel.DialogResult = DialogResult.Cancel;
buttonOk.Enabled = false;
label.SetBounds(Dpi(9), Dpi(20), Dpi(372), Dpi(13));
textBox.SetBounds(Dpi(12), Dpi(36), Dpi(352), Dpi(20));
buttonOk.SetBounds(Dpi(228), Dpi(72), Dpi(75), Dpi(23));
buttonCancel.SetBounds(Dpi(309), Dpi(72), Dpi(75), Dpi(23));
textBox.SetBounds(Dpi(12), Dpi(44), Dpi(352), Dpi(20));
buttonOk.SetBounds(Dpi(224), Dpi(72), Dpi(75), Dpi(23));
buttonCancel.SetBounds(Dpi(305), Dpi(72), Dpi(75), Dpi(23));
imageBox.SetBounds(Dpi(368), Dpi(36), Dpi(16), Dpi(16));
if (allowExeBrowse)
{
textBox.SetBounds(Dpi(12), Dpi(44), Dpi(286), Dpi(20));
buttonBrowse.SetBounds(Dpi(305), Dpi(39), Dpi(75), Dpi(23));
buttonBrowse.Click += buttonBrowse_Click;
}
imageBox.SetBounds(Dpi(368), Dpi(44), Dpi(16), Dpi(16));
label.AutoSize = true;
label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
imageBox.Anchor = AnchorStyles.Top | AnchorStyles.Right;
textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
textBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonBrowse.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
form.ClientSize = new Size(Dpi(396), Dpi(107));
form.ClientSize = new Size(Math.Max(Dpi(300), label.Right + Dpi(10)), form.ClientSize.Height);
form.Controls.AddRange(new Control[] { label, textBox, imageBox, buttonOk, buttonCancel });
form.FormBorderStyle = FormBorderStyle.FixedDialog;
form.MinimumSize = form.Size;
form.MaximumSize = new Size(form.MinimumSize.Width * 2, form.MinimumSize.Height);
form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel });
if (!allowExeBrowse)
form.Controls.Add(imageBox);
else
form.Controls.Add(buttonBrowse);
form.ShowIcon = false;
form.FormBorderStyle = FormBorderStyle.Sizable;
form.StartPosition = FormStartPosition.CenterParent;
form.MinimizeBox = false;
form.MaximizeBox = false;

View File

@@ -106,6 +106,22 @@
<UserfriendlyName>Preset K</UserfriendlyName>
<HexValue>0x0000000B</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset L (unused)</UserfriendlyName>
<HexValue>0x0000000C</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset M (unused)</UserfriendlyName>
<HexValue>0x0000000D</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset N (unused)</UserfriendlyName>
<HexValue>0x0000000E</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset O (unused)</UserfriendlyName>
<HexValue>0x0000000F</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Always use latest</UserfriendlyName>
<HexValue>0x00FFFFFF</HexValue>
@@ -147,6 +163,42 @@
<UserfriendlyName>Preset F (unused)</UserfriendlyName>
<HexValue>0x00000006</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset G (unused)</UserfriendlyName>
<HexValue>0x00000007</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset H (unused)</UserfriendlyName>
<HexValue>0x00000008</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset I (unused)</UserfriendlyName>
<HexValue>0x00000009</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset J (unused)</UserfriendlyName>
<HexValue>0x0000000A</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset K (unused)</UserfriendlyName>
<HexValue>0x0000000B</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset L (unused)</UserfriendlyName>
<HexValue>0x0000000C</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset M (unused)</UserfriendlyName>
<HexValue>0x0000000D</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset N (unused)</UserfriendlyName>
<HexValue>0x0000000E</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Preset O (unused)</UserfriendlyName>
<HexValue>0x0000000F</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Always use latest</UserfriendlyName>
<HexValue>0x00FFFFFF</HexValue>
@@ -308,7 +360,7 @@
<HexValue>0x42C60000</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Render at 1.00x native</UserfriendlyName>
<UserfriendlyName>Render at 1.00x native (DLAA)</UserfriendlyName>
<HexValue>0x42C80000</HexValue>
</CustomSettingValue>
</SettingValues>
@@ -377,7 +429,7 @@
<HexValue>0x42C60000</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Render at 1.00x native</UserfriendlyName>
<UserfriendlyName>Render at 1.00x native (DLAA)</UserfriendlyName>
<HexValue>0x42C80000</HexValue>
</CustomSettingValue>
</SettingValues>
@@ -420,7 +472,7 @@
<HexValue>0x00000000</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>On (RTX 5000 series and above)</UserfriendlyName>
<UserfriendlyName>On (RTX 50 series and above)</UserfriendlyName>
<HexValue>0x00000001</HexValue>
</CustomSettingValue>
</SettingValues>
@@ -433,69 +485,36 @@
<MinRequiredDriverVersion>571.86</MinRequiredDriverVersion>
</CustomSetting>
<CustomSetting>
<UserfriendlyName>RTX HDR - Feature Flags</UserfriendlyName>
<UserfriendlyName>RTX HDR - Driver Flags</UserfriendlyName>
<Description>Allows reducing deband strength to preserve details &amp; enable indicator.&#xD;&#xA;When any driver flags are set HDR will be applied via driver instead of through NVOverlay (driver doesn't support customizing brightness/contrast/saturation)</Description>
<HexSettingID>0x00432F84</HexSettingID>
<GroupName>5 - Common</GroupName>
<MinRequiredDriverVersion>0</MinRequiredDriverVersion>
<SettingValues>
<CustomSettingValue>
<UserfriendlyName>Off (0x00)</UserfriendlyName>
<HexValue>0x00000000</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Enabled (No Debanding) (0x06)</UserfriendlyName>
<HexValue>0x00000006</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Enabled (Medium Debanding) (0x0A)</UserfriendlyName>
<HexValue>0x0000000A</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Enabled (VeryHigh Debanding) (0x02)</UserfriendlyName>
<HexValue>0x00000002</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Enabled + Indicator (VeryHigh) (0x03)</UserfriendlyName>
<HexValue>0x00000003</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Enabled + Indicator + Debug (VeryHigh) (0x23)</UserfriendlyName>
<HexValue>0x00000023</HexValue>
</CustomSettingValue>
</SettingValues>
<SettingMasks />
</CustomSetting>
<CustomSetting>
<UserfriendlyName>RTX HDR - Driver-Level RTX HDR Enable</UserfriendlyName>
<HexSettingID>0x1077A11A</HexSettingID>
<GroupName>5 - Common</GroupName>
<MinRequiredDriverVersion>0</MinRequiredDriverVersion>
<SettingValues>
<CustomSettingValue>
<UserfriendlyName>Off</UserfriendlyName>
<HexValue>0x00000000</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>On - Enable through driver, w/o NV Overlay (requires other Enable flags)</UserfriendlyName>
<HexValue>0x00000001</HexValue>
</CustomSettingValue>
</SettingValues>
<SettingMasks />
</CustomSetting>
<CustomSetting>
<UserfriendlyName>RTX HDR - Game Filters Enable</UserfriendlyName>
<HexSettingID>0x00980896</HexSettingID>
<GroupName>5 - Common</GroupName>
<MinRequiredDriverVersion>0</MinRequiredDriverVersion>
<SettingValues>
<CustomSettingValue>
<UserfriendlyName>Off</UserfriendlyName>
<HexValue>0x00000000</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>On</UserfriendlyName>
<HexValue>0x00000001</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Off (0x00)</UserfriendlyName>
<HexValue>0x00000000</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Enabled via driver (No Debanding) (0x06)</UserfriendlyName>
<HexValue>0x00000006</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Enabled via driver (Medium Debanding) (0x0A)</UserfriendlyName>
<HexValue>0x0000000A</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Enabled via driver (VeryHigh Debanding) (0x02)</UserfriendlyName>
<HexValue>0x00000002</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Enabled + Indicator (VeryHigh) (0x03)</UserfriendlyName>
<HexValue>0x00000003</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Enabled + Indicator + Debug (VeryHigh) (0x23)</UserfriendlyName>
<HexValue>0x00000023</HexValue>
</CustomSettingValue>
</SettingValues>
<SettingMasks />
</CustomSetting>
@@ -505,14 +524,14 @@
<GroupName>5 - Common</GroupName>
<MinRequiredDriverVersion>0</MinRequiredDriverVersion>
<SettingValues>
<CustomSettingValue>
<UserfriendlyName>Off</UserfriendlyName>
<HexValue>0x00000000</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>On</UserfriendlyName>
<HexValue>0x00000001</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>Off</UserfriendlyName>
<HexValue>0x00000000</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>On</UserfriendlyName>
<HexValue>0x00000001</HexValue>
</CustomSettingValue>
</SettingValues>
<SettingMasks />
</CustomSetting>
@@ -544,6 +563,37 @@
<MinRequiredDriverVersion>0</MinRequiredDriverVersion>
<SettingMasks />
</CustomSetting>
<CustomSetting>
<UserfriendlyName>RTX Digital Vibrance - Enable</UserfriendlyName>
<HexSettingID>0x00980880</HexSettingID>
<GroupName>5 - Common</GroupName>
<MinRequiredDriverVersion>0</MinRequiredDriverVersion>
<SettingValues>
<CustomSettingValue>
<UserfriendlyName>Off</UserfriendlyName>
<HexValue>0x00000000</HexValue>
</CustomSettingValue>
<CustomSettingValue>
<UserfriendlyName>On</UserfriendlyName>
<HexValue>0x00000001</HexValue>
</CustomSettingValue>
</SettingValues>
<SettingMasks />
</CustomSetting>
<CustomSetting>
<UserfriendlyName>RTX Digital Vibrance - Saturation Boost</UserfriendlyName>
<HexSettingID>0x00ABAB13</HexSettingID>
<GroupName>5 - Common</GroupName>
<MinRequiredDriverVersion>0</MinRequiredDriverVersion>
<SettingMasks />
</CustomSetting>
<CustomSetting>
<UserfriendlyName>RTX Digital Vibrance - Intensity</UserfriendlyName>
<HexSettingID>0x00ABAB22</HexSettingID>
<GroupName>5 - Common</GroupName>
<MinRequiredDriverVersion>0</MinRequiredDriverVersion>
<SettingMasks />
</CustomSetting>
<CustomSetting>
<UserfriendlyName>Frame Rate Limiter - Background Application</UserfriendlyName>
<HexSettingID>0x10835005</HexSettingID>

View File

@@ -9,46 +9,49 @@ using System.Windows.Forms;
namespace nspector
{
internal delegate void DropFilesNativeHandler(string[] files);
internal delegate void DropFilesNativeHandler(string[] files);
internal class ListViewEx : ListView
internal class ListViewEx : ListView
{
public event DropFilesNativeHandler OnDropFilesNative;
public event DropFilesNativeHandler OnDropFilesNative;
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wPar, IntPtr lPar);
private const int LVM_FIRST = 0x1000;
private const int LVM_GETCOLUMNORDERARRAY = (LVM_FIRST + 59);
private const int WM_PAINT = 0x000F;
private const int WM_VSCROLL = 0x0115;
private const int WM_HSCROLL = 0x0114;
private const int WM_MOUSEWHEEL = 0x020A;
private struct EmbeddedControl
{
internal Control Control;
internal int Column;
internal int Row;
internal DockStyle Dock;
internal ListViewItem Item;
internal Control Control;
internal int Column;
internal int Row;
internal DockStyle Dock;
internal ListViewItem Item;
}
private ArrayList _embeddedControls = new ArrayList();
public ListViewEx()
{
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.EnableNotifyMessage, true);
}
public ListViewEx()
{
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.EnableNotifyMessage, true);
}
protected override void OnNotifyMessage(Message m)
{
if (m.Msg != 0x14)
{
base.OnNotifyMessage(m);
}
}
protected override void OnNotifyMessage(Message m)
{
if (m.Msg != 0x14)
{
base.OnNotifyMessage(m);
}
}
protected int[] GetColumnOrder()
{
IntPtr lPar = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * Columns.Count);
@@ -94,18 +97,18 @@ namespace nspector
break;
subItemX += col.Width;
}
subItemRect = new Rectangle(subItemX, lviBounds.Top-1, this.Columns[order[i]].Width, lviBounds.Height);
return subItemRect;
}
internal void AddEmbeddedControl(Control c, int col, int row)
internal void AddEmbeddedControl(Control c, int col, int row)
{
AddEmbeddedControl(c,col,row,DockStyle.Fill);
}
internal void AddEmbeddedControl(Control c, int col, int row, DockStyle dock)
internal void AddEmbeddedControl(Control c, int col, int row, DockStyle dock)
{
if (c==null)
throw new ArgumentNullException();
@@ -122,11 +125,11 @@ namespace nspector
_embeddedControls.Add(ec);
c.Click += new EventHandler(_embeddedControl_Click);
this.Controls.Add(c);
}
internal void RemoveEmbeddedControl(Control c)
internal void RemoveEmbeddedControl(Control c)
{
if (c == null)
throw new ArgumentNullException();
@@ -143,8 +146,8 @@ namespace nspector
}
}
}
internal Control GetEmbeddedControl(int col, int row)
internal Control GetEmbeddedControl(int col, int row)
{
foreach (EmbeddedControl ec in _embeddedControls)
if (ec.Row == row && ec.Column == col)
@@ -154,9 +157,9 @@ namespace nspector
}
[DefaultValue(View.LargeIcon)]
internal new View View
internal new View View
{
get
get
{
return base.View;
}
@@ -169,9 +172,9 @@ namespace nspector
}
}
[DllImport("shell32.dll", CharSet = CharSet.Auto)]
public static extern int DragQueryFile(IntPtr hDrop, uint iFile, [Out] StringBuilder lpszFile, int cch);
private const int WM_DROPFILES = 0x233;
[DllImport("shell32.dll", CharSet = CharSet.Auto)]
public static extern int DragQueryFile(IntPtr hDrop, uint iFile, [Out] StringBuilder lpszFile, int cch);
private const int WM_DROPFILES = 0x233;
protected override void WndProc(ref Message m)
{
@@ -183,6 +186,10 @@ namespace nspector
foreach (EmbeddedControl ec in _embeddedControls)
{
// Skip repositioning if the control is a dropped-down ComboBox, prevents it from immediately closing on first click
if (ec.Control is ComboBox comboBox && comboBox.DroppedDown)
continue;
Rectangle rc = this.GetSubItemBounds(ec.Item, ec.Column);
if ((this.HeaderStyle != ColumnHeaderStyle.None) &&
@@ -220,44 +227,57 @@ namespace nspector
}
rc.X = rc.X + ec.Control.Margin.Left;
rc.Y = rc.Y + ec.Control.Margin.Top;
rc.Width = rc.Width - ec.Control.Margin.Right;
rc.Height = rc.Height - ec.Control.Margin.Bottom;
rc.X = rc.X + ec.Control.Margin.Left;
rc.Y = rc.Y + ec.Control.Margin.Top;
rc.Width = rc.Width - ec.Control.Margin.Right;
rc.Height = rc.Height - ec.Control.Margin.Bottom;
ec.Control.Bounds = rc;
ec.Control.Bounds = rc;
}
break;
case WM_DROPFILES:
if (OnDropFilesNative != null)
{
var dropped = DragQueryFile(m.WParam, 0xFFFFFFFF, null, 0);
if (dropped > 0)
{
var files = new List<string>();
for (uint i = 0; i < dropped; i++)
{
var size = DragQueryFile(m.WParam, i, null, 0);
if (size > 0)
{
var sb = new StringBuilder(size + 1);
var result = DragQueryFile(m.WParam, i, sb, size + 1);
files.Add(sb.ToString());
}
}
case WM_VSCROLL:
case WM_HSCROLL:
case WM_MOUSEWHEEL:
// Close any opened comboboxes if listview is being scrolled
foreach (EmbeddedControl ec in _embeddedControls)
{
if (ec.Control is ComboBox comboBox && comboBox.DroppedDown)
{
comboBox.DroppedDown = false;
}
}
break;
OnDropFilesNative(files.ToArray());
}
}
case WM_DROPFILES:
base.WndProc(ref m);
break;
if (OnDropFilesNative != null)
{
var dropped = DragQueryFile(m.WParam, 0xFFFFFFFF, null, 0);
if (dropped > 0)
{
var files = new List<string>();
for (uint i = 0; i < dropped; i++)
{
var size = DragQueryFile(m.WParam, i, null, 0);
if (size > 0)
{
var sb = new StringBuilder(size + 1);
var result = DragQueryFile(m.WParam, i, sb, size + 1);
files.Add(sb.ToString());
}
}
OnDropFilesNative(files.ToArray());
}
}
base.WndProc(ref m);
break;
}
base.WndProc (ref m);
base.WndProc(ref m);
}
private void _embeddedControl_Click(object sender, EventArgs e)

View File

@@ -408,6 +408,7 @@
this.lblApplications.Size = new System.Drawing.Size(840, 17);
this.lblApplications.TabIndex = 25;
this.lblApplications.Text = "fsagame.exe, bond.exe, herozero.exe";
this.lblApplications.DoubleClick += new System.EventHandler(this.tsbAddApplication_Click);
//
// toolStripButton5
//

View File

@@ -537,6 +537,10 @@ namespace nspector
{
ScaleFactor = lblWidth330.Width / 330;
// Later Windows versions changed DPI scaling method, check with Graphics and use it if larger
using (Graphics g = CreateGraphics())
ScaleFactor = Math.Max(ScaleFactor, Math.Max(g.DpiX / 96f, g.DpiY / 96f));
chSettingID.Width = lblWidth330.Width;
chSettingValueHex.Width = lblWidth96.Width;
}
@@ -627,6 +631,8 @@ namespace nspector
ResetSelectedValue();
}
ToolTip appPathsTooltip = new ToolTip() { InitialDelay = 250 };
private void ChangeCurrentProfile(string profileName)
{
if (profileName == GetBaseProfileName() || profileName == _baseProfileName)
@@ -636,6 +642,7 @@ namespace nspector
tsbDeleteProfile.Enabled = false;
tsbAddApplication.Enabled = false;
tssbRemoveApplication.Enabled = false;
appPathsTooltip.SetToolTip(lblApplications, "");
}
else
{
@@ -643,9 +650,9 @@ namespace nspector
tsbDeleteProfile.Enabled = true;
tsbAddApplication.Enabled = true;
tssbRemoveApplication.Enabled = true;
appPathsTooltip.SetToolTip(lblApplications, "Double-click to add application");
}
RefreshCurrentProfile();
}
@@ -806,7 +813,15 @@ namespace nspector
}
}
else
ResetCurrentProfile();
{
if (MessageBox.Show(this,
"Restore profile to NVIDIA driver defaults?",
"Restore profile",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
ResetCurrentProfile();
}
}
}
private void tsbRefreshProfile_Click(object sender, EventArgs e)
@@ -917,15 +932,24 @@ namespace nspector
private void tsbAddApplication_Click(object sender, EventArgs e)
{
var openDialog = new OpenFileDialog();
openDialog.DefaultExt = "*.exe";
openDialog.Filter = "Application EXE Name|*.exe|Application Absolute Path|*.exe";
if (_CurrentProfile == GetBaseProfileName() || _CurrentProfile == _baseProfileName)
return;
if (openDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
var applications = new Dictionary<string, string>();
_currentProfileSettingItems = _drs.GetSettingsForProfile(_CurrentProfile, GetSettingViewMode(), ref applications);
var existingPaths = new HashSet<string>(applications.Values, StringComparer.OrdinalIgnoreCase);
var applicationName = "";
if (InputBox.Show("Add Application", "Enter an application path/filename/UWP ID to add to the profile:", ref applicationName, new List<string>(), "", 2048, true) == DialogResult.OK)
{
string applicationName = new FileInfo(openDialog.FileName).Name;
if (openDialog.FilterIndex == 2)
applicationName = openDialog.FileName;
// Add new application path
if (existingPaths.Contains(applicationName))
{
MessageBox.Show("This application is already assigned to this profile!",
"Error adding Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
try
{
@@ -936,25 +960,26 @@ namespace nspector
if (ex.Status == Native.NVAPI2.NvAPI_Status.NVAPI_EXECUTABLE_ALREADY_IN_USE || ex.Status == Native.NVAPI2.NvAPI_Status.NVAPI_ERROR)
{
if (lblApplications.Text.ToUpper().IndexOf(" " + applicationName.ToUpper() + ",") != -1)
MessageBox.Show("This application executable is already assigned to this profile!",
MessageBox.Show("This application is already assigned to this profile!",
"Error adding Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
else
{
string profileNames = _scanner.FindProfilesUsingApplication(applicationName);
if (profileNames == "")
MessageBox.Show("This application executable might already be assigned to another profile!",
MessageBox.Show("This application might already be assigned to another profile!",
"Error adding Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
else
MessageBox.Show(
"This application executable is already assigned to the following profiles: " +
"This application is already assigned to the following profiles: " +
profileNames, "Error adding Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
throw;
}
RefreshCurrentProfile();
}
RefreshCurrentProfile();
}
private void tssbRemoveApplication_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)