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
This commit is contained in:
emoose
2025-02-16 16:30:40 +00:00
committed by emoose
parent a3b524e7d9
commit 50006f114a
2 changed files with 33 additions and 0 deletions

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.lblApplications_DoubleClick);
//
// toolStripButton5
//

View File

@@ -1405,6 +1405,38 @@ namespace nspector
Clipboard.SetText(sbSettings.ToString());
}
private void lblApplications_DoubleClick(object sender, EventArgs e)
{
if (_CurrentProfile == GetBaseProfileName() || _CurrentProfile == _baseProfileName)
return;
if (_CurrentProfile.StartsWith("0x"))
return; // monitor/device profile
var applications = new Dictionary<string, string>();
_currentProfileSettingItems = _drs.GetSettingsForProfile(_CurrentProfile, GetSettingViewMode(), ref applications);
var existingPaths = new HashSet<string>(applications.Values, StringComparer.OrdinalIgnoreCase);
var appPath = "";
if (InputBox.Show("Add App Path", "Enter application path/filename/UWP ID to add to the profile", ref appPath, new List<string>(), "", 2048) == DialogResult.OK)
{
// Add new application path
if (!existingPaths.Contains(appPath))
{
try
{
_drs.AddApplication(_CurrentProfile, appPath);
}
catch (NvapiException ex) // NVAPI_EXECUTABLE_ALREADY_IN_USE etc
{
MessageBox.Show(ex.Message, "NvAPI Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
RefreshCurrentProfile();
}
}
}
}
}