mirror of
https://github.com/Orbmu2k/nvidiaProfileInspector.git
synced 2026-01-19 04:08:12 -05:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22d66d0aeb | ||
|
|
ceddf3d4ef | ||
|
|
f6d879f737 | ||
|
|
3ac3447ecd |
@@ -178,8 +178,6 @@ namespace nspector.Common
|
||||
var baseProfile = GetProfileInfo(hSession, hBase);
|
||||
tmpBaseProfileName = baseProfile.profileName;
|
||||
|
||||
lstResult.Add("_GLOBAL_DRIVER_PROFILE (" + tmpBaseProfileName + ")");
|
||||
|
||||
var profileHandles = EnumProfileHandles(hSession);
|
||||
foreach (IntPtr hProfile in profileHandles)
|
||||
{
|
||||
@@ -192,6 +190,11 @@ namespace nspector.Common
|
||||
}
|
||||
});
|
||||
|
||||
lstResult.Sort(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
// Insert the global profile at the start
|
||||
lstResult.Insert(0, "_GLOBAL_DRIVER_PROFILE (" + tmpBaseProfileName + ")");
|
||||
|
||||
baseProfileName = tmpBaseProfileName;
|
||||
return lstResult;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ namespace nspector
|
||||
|
||||
private bool _isDevMode = false;
|
||||
|
||||
private string[] _profileNames = new string[0];
|
||||
private bool _comboBoxUpdating = false;
|
||||
|
||||
private UserSettings _settings = null;
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
@@ -230,12 +233,20 @@ namespace nspector
|
||||
|
||||
private void RefreshProfilesCombo()
|
||||
{
|
||||
cbProfiles.Items.Clear();
|
||||
var combo = (ComboBox)cbProfiles.ComboBox;
|
||||
|
||||
var profileNames = _drs.GetProfileNames(ref _baseProfileName);
|
||||
cbProfiles.Items.AddRange(profileNames.Cast<object>().ToArray());
|
||||
_comboBoxUpdating = true;
|
||||
try
|
||||
{
|
||||
_profileNames = _drs.GetProfileNames(ref _baseProfileName).ToArray();
|
||||
|
||||
cbProfiles.Sorted = true;
|
||||
combo.DataSource = null;
|
||||
combo.DataSource = _profileNames;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_comboBoxUpdating = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveComboToItemAndFill()
|
||||
@@ -632,6 +643,7 @@ namespace nspector
|
||||
LoadSettings();
|
||||
|
||||
RefreshProfilesCombo();
|
||||
RefreshCurrentProfile();
|
||||
cbProfiles.Text = GetBaseProfileName();
|
||||
|
||||
tsbBitValueEditor.Enabled = false;
|
||||
@@ -733,6 +745,11 @@ namespace nspector
|
||||
|
||||
private void cbProfiles_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(_comboBoxUpdating)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (cbProfiles.SelectedIndex > -1)
|
||||
{
|
||||
ChangeCurrentProfile(cbProfiles.Text);
|
||||
@@ -742,20 +759,27 @@ namespace nspector
|
||||
|
||||
private void cbProfiles_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if(e.KeyCode == Keys.Enter)
|
||||
if (_comboBoxUpdating)
|
||||
{
|
||||
// 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
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
// 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 { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1101,7 +1125,7 @@ namespace nspector
|
||||
|
||||
private void ShowCreateProfileDialog(string nameProposal, string applicationName = null)
|
||||
{
|
||||
var ignoreList = cbProfiles.Items.Cast<string>().ToList();
|
||||
var ignoreList = _profileNames.ToList();
|
||||
string result = nameProposal;
|
||||
|
||||
if (InputBox.Show("Create Profile", "Please enter profile name:", ref result, ignoreList, "", 2048) == System.Windows.Forms.DialogResult.OK)
|
||||
@@ -1110,7 +1134,7 @@ namespace nspector
|
||||
{
|
||||
_drs.CreateProfile(result, applicationName);
|
||||
RefreshProfilesCombo();
|
||||
cbProfiles.SelectedIndex = cbProfiles.Items.IndexOf(result);
|
||||
cbProfiles.SelectedIndex = Array.IndexOf(_profileNames, result);
|
||||
AddToModifiedProfiles(result, true);
|
||||
}
|
||||
catch (NvapiException ex)
|
||||
@@ -1204,7 +1228,7 @@ namespace nspector
|
||||
RefreshProfilesCombo();
|
||||
await ScanProfilesSilentAsync(true, false);
|
||||
|
||||
int idx = cbProfiles.Items.IndexOf(_CurrentProfile);
|
||||
int idx = Array.IndexOf(_profileNames, _CurrentProfile);
|
||||
if (idx == -1 || _CurrentProfile == _baseProfileName)
|
||||
cbProfiles.Text = GetBaseProfileName();
|
||||
else
|
||||
@@ -1247,6 +1271,11 @@ namespace nspector
|
||||
|
||||
private void cbProfiles_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_comboBoxUpdating)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (cbProfiles.DroppedDown)
|
||||
{
|
||||
string txt = cbProfiles.Text;
|
||||
@@ -1295,7 +1324,7 @@ namespace nspector
|
||||
if (profiles != "")
|
||||
{
|
||||
var profile = profiles.Split(';')[0];
|
||||
var idx = cbProfiles.Items.IndexOf(profile);
|
||||
var idx = Array.IndexOf(_profileNames, profile);
|
||||
if (idx > -1)
|
||||
{
|
||||
cbProfiles.SelectedIndex = idx;
|
||||
|
||||
Reference in New Issue
Block a user