Only search by exe name if entered profile name doesn't exist

This was meant to be happening automatically, but seems WinForms also decides
to send a KeyUp event with e.KeyCode == Keys.Enter when the user clicks an existing item (?)
This commit is contained in:
emoose
2026-01-19 01:25:31 +00:00
parent f6d879f737
commit ceddf3d4ef

View File

@@ -766,18 +766,20 @@ namespace nspector
if (e.KeyCode == Keys.Enter)
{
// KeyUp event is only fired when combobox item doesn't exist with the entered text
// Try searching for text as an exe/application name
try
// Search by exe name if the text isn't already a valid profile name
if (!_profileNames.Contains(cbProfiles.Text))
{
var profile = _drs.GetProfileNameByExeName(cbProfiles.Text);
if (!string.IsNullOrEmpty(profile))
try
{
cbProfiles.Text = profile;
ChangeCurrentProfile(profile);
var profile = _drs.GetProfileNameByExeName(cbProfiles.Text);
if (!string.IsNullOrEmpty(profile))
{
cbProfiles.Text = profile;
ChangeCurrentProfile(profile);
}
}
catch { }
}
catch { }
}
}