Fixed non-Steam Games in Steam Game list

Fixes #68. The reason DisplayMagician was crashing was that it was hitting a Uplay Game in the Steam Library. This was not a valid thing to see. The reason DisplayMagician was doing that was because of a bug in the way that the list of installed games was combined. This bug has been in all 2.x versions of DisplayMagician, and would have affected anyone with Steam and any one more GameLibrary (e.g. GOG, Epic, Uplay etc).

I also managed to find a potential issue with editing shortcuts that I've hopefully now averted.
Properly clear out the form and all it's storage variables when the form loads (done)
Add in some protection logic to avoid a crash even if this situation occurs again (partly done)

Additionally, I found a recursive logic flaw that meant that DisplayMagician used WAAAAAAAAAAAAAY more memory than it needed to. I'm talking 5GB of memory rather than the 129MB it was supposed to do. So I'm so thankful that you logged this issue so I could find that one :).
This commit is contained in:
Terry MacDonald 2021-12-23 18:45:04 +13:00
parent c87f55c4a9
commit de1f6654c3
8 changed files with 188 additions and 70 deletions

View File

@ -269,7 +269,8 @@ namespace DisplayMagician.GameLibraries
EpicLibrary.GetLibrary().AllInstalledGames.Clear();
GogLibrary.GetLibrary().AllInstalledGames.Clear();
// Produce a single array of Games we can reference later
GameLibrary.AllInstalledGamesInAllLibraries = SteamLibrary.GetLibrary().AllInstalledGames;
GameLibrary.AllInstalledGamesInAllLibraries = new List<Game>();
GameLibrary.AllInstalledGamesInAllLibraries.AddRange(SteamLibrary.GetLibrary().AllInstalledGames);
GameLibrary.AllInstalledGamesInAllLibraries.AddRange(UplayLibrary.GetLibrary().AllInstalledGames);
GameLibrary.AllInstalledGamesInAllLibraries.AddRange(OriginLibrary.GetLibrary().AllInstalledGames);
GameLibrary.AllInstalledGamesInAllLibraries.AddRange(EpicLibrary.GetLibrary().AllInstalledGames);

View File

@ -482,7 +482,7 @@ namespace DisplayMagician.GameLibraries
if (uplayInstallKey != null)
{
int uplayGamesInstalledCount = 0;
// Loop through the subKeys as they are the Steam Game IDs
// Loop through the subKeys as they are the Uplay Game IDs
foreach (string uplayGameKeyName in uplayInstallKey.GetSubKeyNames())
{
logger.Trace($"UplayLibrary/LoadInstalledGames: Found uplayGameKeyName = {uplayGameKeyName}");
@ -497,7 +497,7 @@ namespace DisplayMagician.GameLibraries
if (!uplayGameKey.GetValue(@"InstallDir", "").ToString().Equals(""))
{
logger.Trace($"UplayLibrary/LoadInstalledGames: {uplayGameKey} contains an 'InstallDir' value so is an installed Uplay Game.");
// Add this Steam App ID to the list we're keeping for later
// Add this Uplay App ID to the list we're keeping for later
uplayGamesInstalledCount++;
}
else

View File

@ -26,8 +26,8 @@ using System.Resources;
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
// Version information
[assembly: AssemblyVersion("2.1.3.1")]
[assembly: AssemblyFileVersion("2.1.3.1")]
[assembly: AssemblyVersion("2.1.3.10")]
[assembly: AssemblyFileVersion("2.1.3.10")]
[assembly: NeutralResourcesLanguageAttribute( "en" )]
[assembly: CLSCompliant(true)]

View File

@ -1159,6 +1159,7 @@ namespace DisplayMagician
// Is the main application still installed?
if (Category.Equals(ShortcutCategory.Application))
{
logger.Trace($"ShortcutItem/RefreshValidity: This shortcut is an Application");
// We need to check if the Application still exists
if (!System.IO.File.Exists(ExecutableNameAndPath))
{
@ -1180,41 +1181,76 @@ namespace DisplayMagician
else if (Category.Equals(ShortcutCategory.Game))
{
GameLibrary gameLibraryToUse = null;
logger.Trace($"ShortcutItem/RefreshValidity: This shortcut is a Game");
// If the game is a Steam Game we check for that
if (GameLibrary.Equals(SupportedGameLibraryType.Steam))
{
logger.Trace($"ShortcutItem/RefreshValidity: The game library is Steam");
// We now need to get the SteamGame info
gameLibraryToUse = SteamLibrary.GetLibrary();
try
{
gameLibraryToUse = SteamLibrary.GetLibrary();
}
catch(Exception ex)
{
logger.Error(ex,$"ShortcutItem/RefreshValidity: Exception while trying to get a handle to the Steam library");
}
}
// If the game is a Uplay Uplay Game we check for that
else if (GameLibrary.Equals(SupportedGameLibraryType.Uplay))
{
logger.Trace($"ShortcutItem/RefreshValidity: The game library is Uplay");
// We now need to get the Uplay Game info
gameLibraryToUse = UplayLibrary.GetLibrary();
try
{
gameLibraryToUse = UplayLibrary.GetLibrary();
}
catch (Exception ex)
{
logger.Error(ex, $"ShortcutItem/RefreshValidity: Exception while trying to get a handle to the Uplay library");
}
}
// If the game is an Origin Game we check for that
else if (GameLibrary.Equals(SupportedGameLibraryType.Origin))
{
logger.Trace($"ShortcutItem/RefreshValidity: The game library is Origin");
// We now need to get the Uplay Game info
gameLibraryToUse = OriginLibrary.GetLibrary();
try
{
gameLibraryToUse = OriginLibrary.GetLibrary();
}
catch (Exception ex)
{
logger.Error(ex, $"ShortcutItem/RefreshValidity: Exception while trying to get a handle to the Origin library");
}
}
// If the game is an Epic Game we check for that
else if (GameLibrary.Equals(SupportedGameLibraryType.Epic))
{
logger.Trace($"ShortcutItem/RefreshValidity: The game library is Epic");
// We now need to get the Epic Game info
gameLibraryToUse = EpicLibrary.GetLibrary();
try
{
gameLibraryToUse = EpicLibrary.GetLibrary();
}
catch (Exception ex)
{
logger.Error(ex, $"ShortcutItem/RefreshValidity: Exception while trying to get a handle to the Epic library");
}
}
// If the game is an GOG Game we check for that
else if (GameLibrary.Equals(SupportedGameLibraryType.GOG))
{
logger.Trace($"ShortcutItem/RefreshValidity: The game library is GOG");
// We now need to get the GOG Game info
gameLibraryToUse = GogLibrary.GetLibrary();
// We now need to get the GOG Game info
try
{
gameLibraryToUse = GogLibrary.GetLibrary();
}
catch (Exception ex)
{
logger.Error(ex, $"ShortcutItem/RefreshValidity: Exception while trying to get a handle to the GOG library");
}
}
else
{
@ -1256,7 +1292,18 @@ namespace DisplayMagician
if (worstError != ShortcutValidity.Error)
worstError = ShortcutValidity.Error;
}
}
}
else
{
logger.Trace($"ShortcutItem/RefreshValidity: The GameLibrary was not created properly during the validity check!");
ShortcutError error = new ShortcutError();
error.Name = "GameLibraryToUseNotCreated";
error.Validity = ShortcutValidity.Error;
error.Message = $"The GameLibrary was not created properly during the validity check.";
_shortcutErrors.Add(error);
if (worstError != ShortcutValidity.Error)
worstError = ShortcutValidity.Error;
}
}
// Check the Audio Device is still valid (if one is specified)
CoreAudioController audioController = ShortcutRepository.AudioController;
@ -1268,22 +1315,26 @@ namespace DisplayMagician
try
{
audioDevices = audioController.GetPlaybackDevices();
logger.Trace($"ShortcutItem/RefreshValidity: Audio Controller successfully detected");
}
catch (Exception ex)
{
logger.Warn(ex, $"ShortcutRepository/RefreshValidity: Exception trying to get all playback devices!");
logger.Warn(ex, $"ShortcutItem/RefreshValidity: Exception trying to get all playback devices!");
}
if (audioDevices != null)
{
bool audioFound = false;
logger.Trace($"ShortcutItem/RefreshValidity: Audio Controller successfully returned a list of audio playback devices");
foreach (CoreAudioDevice audioDevice in audioDevices)
{
logger.Trace($"ShortcutItem/RefreshValidity: Detected audio playback device {audioDevice.FullName}");
if (audioDevice.FullName.Equals(AudioDevice))
{
audioFound = true;
logger.Trace($"ShortcutItem/RefreshValidity: Detected audio playback device {audioDevice.FullName} is the one we want!");
if (audioDevice.State == DeviceState.Disabled)
{
logger.Warn($"ShortcutRepository/RefreshValidity: Detected audio playback device {audioDevice.FullName} is the one we want, but it is disabled!");
logger.Warn($"ShortcutItem/RefreshValidity: Detected audio playback device {audioDevice.FullName} is the one we want, but it is disabled!");
ShortcutError error = new ShortcutError();
error.Name = "AudioDeviceDisabled";
error.Validity = ShortcutValidity.Warning;
@ -1294,36 +1345,39 @@ namespace DisplayMagician
}
if (audioDevice.State == DeviceState.NotPresent)
{
logger.Warn($"ShortcutRepository/RefreshValidity: Detected audio playback device {audioDevice.FullName} is the one we want, but it is not present!");
logger.Warn($"ShortcutItem/RefreshValidity: Detected audio playback device {audioDevice.FullName} is the one we want, but it is not present!");
ShortcutError error = new ShortcutError();
error.Name = "AudioDeviceNotPresent";
error.Validity = ShortcutValidity.Error;
error.Validity = ShortcutValidity.Warning;
error.Message = $"The Audio Device {AudioDevice} is not present, so the shortcut '{Name}' cannot be used.";
_shortcutErrors.Add(error);
if (worstError != ShortcutValidity.Error)
worstError = ShortcutValidity.Error;
}
// As per Issue #39, this causes issues on HDMI audio devices and others that *could* work if the screen was enabled.
// Disabling this code as it is too much error checking for audio devices. The user can plug these in after the chagne and they will work.
/*if (audioDevice.State == DeviceState.Unplugged)
{
logger.Warn($"ShortcutRepository/RefreshValidity: Detected audio playback device {audioDevice.FullName} is the one we want, but it is unplugged!");
ShortcutError error = new ShortcutError();
error.Name = "AudioDeviceUnplugged";
error.Validity = ShortcutValidity.Warning;
error.Message = $"The Audio Device {AudioDevice} is unplugged, so the shortcut '{Name}' cannot be used. You need to plug in the audio device to use this shortcut, or edit the shortcut to change the audio device.";
_shortcutErrors.Add(error);
if (worstError != ShortcutValidity.Error)
worstError = ShortcutValidity.Warning;
}*/
}
break;
}
}
if (!audioFound)
{
logger.Warn($"ShortcutItem/RefreshValidity: The audio device {AudioDevice} was not found in the list of audio devices currently available!");
ShortcutError error = new ShortcutError();
error.Name = "AudioDeviceNotFound";
error.Validity = ShortcutValidity.Warning;
error.Message = $"The audio device {AudioDevice} was not found in the list of audio devices currently available!";
_shortcutErrors.Add(error);
if (worstError != ShortcutValidity.Error)
worstError = ShortcutValidity.Warning;
}
}
else
{
logger.Warn($"ShortcutItem/RefreshValidity: No audio devices detected by Capture Audio. That's fine though, so not logging as an error.");
}
}
else
{
logger.Error($"ShortcutRepository/RefreshValidity: The audio device chipset is not supported by DisplayMagician!");
logger.Error($"ShortcutItem/RefreshValidity: The audio device chipset is not supported by DisplayMagician!");
ShortcutError error = new ShortcutError();
error.Name = "AudioChipsetNotSupported";
error.Validity = ShortcutValidity.Warning;
@ -1345,20 +1399,22 @@ namespace DisplayMagician
}
catch(Exception ex)
{
logger.Warn(ex, $"ShortcutRepository/RefreshValidity: Exception trying to get all capture devices!");
logger.Warn(ex, $"ShortcutItem/RefreshValidity: Exception trying to get all capture devices!");
}
if (captureDevices != null)
{
bool captureFound = false;
foreach (CoreAudioDevice captureDevice in captureDevices)
{
logger.Trace($"ShortcutItem/RefreshValidity: Detected capture device {captureDevice.FullName}");
if (captureDevice.FullName.Equals(CaptureDevice))
{
captureFound = true;
logger.Trace($"ShortcutItem/RefreshValidity: Detected capture device {captureDevice.FullName} is the one we want!");
if (captureDevice.State == DeviceState.Disabled)
{
logger.Warn($"ShortcutRepository/RefreshValidity: Detected capture device {captureDevice.FullName} is the one we want, but it is disabled!");
logger.Warn($"ShortcutItem/RefreshValidity: Detected capture device {captureDevice.FullName} is the one we want, but it is disabled!");
ShortcutError error = new ShortcutError();
error.Name = "CaptureDeviceDisabled";
error.Validity = ShortcutValidity.Warning;
@ -1369,40 +1425,43 @@ namespace DisplayMagician
}
if (captureDevice.State == DeviceState.NotPresent)
{
logger.Warn($"ShortcutRepository/RefreshValidity: Detected capture device {captureDevice.FullName} is the one we want, but it is not present!");
logger.Warn($"ShortcutItem/RefreshValidity: Detected capture device {captureDevice.FullName} is the one we want, but it is not present!");
ShortcutError error = new ShortcutError();
error.Name = "CaptureDeviceNotPresent";
error.Validity = ShortcutValidity.Error;
error.Validity = ShortcutValidity.Warning;
error.Message = $"The Capture Device {CaptureDevice} is not present, so the shortcut '{Name}' cannot be used.";
_shortcutErrors.Add(error);
if (worstError != ShortcutValidity.Error)
worstError = ShortcutValidity.Error;
}
// As per Issue #39, this causes issues on HDMI audiodevices and others that *could* work if the screen was enabled.
// Disabling this code as it is too much error checking for capture devices. The user can plug these in after the chagne and they will work.
/*if (captureDevice.State == DeviceState.Unplugged)
{
logger.Warn($"ShortcutRepository/RefreshValidity: Detected capture device {captureDevice.FullName} is the one we want, but it is unplugged!");
ShortcutError error = new ShortcutError();
error.Name = "CaptureDeviceUnplugged";
error.Validity = ShortcutValidity.Warning;
error.Message = $"The Capture Device {CaptureDevice} is unplugged, so the shortcut '{Name}' cannot be used. You need to plug in the capture device to use this shortcut, or edit the shortcut to change the capture device.";
_shortcutErrors.Add(error);
if (worstError != ShortcutValidity.Error)
worstError = ShortcutValidity.Warning;
}*/
}
break;
}
}
}
if (!captureFound)
{
logger.Warn($"ShortcutItem/RefreshValidity: The capture device {CaptureDevice} was not found in the list of capture devices currently available!");
ShortcutError error = new ShortcutError();
error.Name = "CaptureDeviceNotFound";
error.Validity = ShortcutValidity.Warning;
error.Message = $"The capture device {CaptureDevice} was not found in the list of capture devices currently available!";
_shortcutErrors.Add(error);
if (worstError != ShortcutValidity.Error)
worstError = ShortcutValidity.Warning;
}
}
else
{
logger.Warn($"ShortcutItem/RefreshValidity: No capture devices detected by Capture Audio. That's fine though, so not logging as an error.");
}
}
else
{
logger.Error($"ShortcutRepository/RefreshValidity: The capture device chipset is not supported by DisplayMagician!");
logger.Error($"ShortcutItem/RefreshValidity: The capture device chipset is not supported by DisplayMagician!");
ShortcutError error = new ShortcutError();
error.Name = "AudioChipsetNotSupported";
error.Name = "CaptureChipsetNotSupported";
error.Validity = ShortcutValidity.Warning;
error.Message = $"The Audio chipset isn't supported by DisplayMagician. You need to edit the shortcut to not change the microphone input settings.";
error.Message = $"The Capture chipset isn't supported by DisplayMagician. You need to edit the shortcut to not change the microphone input settings.";
_shortcutErrors.Add(error);
if (worstError != ShortcutValidity.Error)
worstError = ShortcutValidity.Warning;

View File

@ -482,11 +482,13 @@ namespace DisplayMagician
{
foreach (string jsonError in jsonErrors)
{
logger.Error($"ShortcutRepository/LoadShortcuts: {jsonErrors}");
logger.Error($"ShortcutRepository/LoadShortcuts: JSON.Net Error found while loading {_shortcutStorageJsonFileName}: {jsonErrors}");
}
}
logger.Trace($"ShortcutRepository/LoadShortcuts: Loaded {_allShortcuts.Count} shortcuts from {_shortcutStorageJsonFileName} Shortcut JSON file");
// Lookup all the Profile Names in the Saved Profiles
// and link the profiles to the Shortcuts as we only
// store the profile names to allow users to uodate profiles
@ -494,7 +496,7 @@ namespace DisplayMagician
logger.Debug($"ShortcutRepository/LoadShortcuts: Connecting Shortcut profile names to the real profile objects");
foreach (ShortcutItem updatedShortcut in _allShortcuts)
{
if (!String.IsNullOrWhiteSpace(updatedShortcut.ProfileUUID))
if (String.IsNullOrWhiteSpace(updatedShortcut.ProfileUUID))
{
logger.Error($"ShortcutRepository/LoadShortcuts: Shortcut '{updatedShortcut.Name}' profile UUID is null or whitespace! Skipping this processing this entry, and setting ProfileToUse to null.");
updatedShortcut.ProfileToUse = null;
@ -528,10 +530,10 @@ namespace DisplayMagician
updatedShortcut.ProfileToUse = null;
}
}
// Sort the shortcuts alphabetically
logger.Trace($"ShortcutRepository/LoadShortcuts: Sorting the Shortcuts alphabetically.");
_allShortcuts.Sort();
}
else
@ -543,10 +545,17 @@ namespace DisplayMagician
{
logger.Debug($"ShortcutRepository/LoadShortcuts: Couldn't find the {_shortcutStorageJsonFileName} shortcut JSON file that contains the Shortcuts");
}
_shortcutsLoaded = true;
IsValidRefresh();
return true;
logger.Trace($"ShortcutRepository/LoadShortcuts: Checking validity of the loaded shortcuts to make sure they're ok to use now");
try
{
_shortcutsLoaded = true;
return true;
}
catch (Exception ex)
{
logger.Error(ex, $"ShortcutRepository/LoadShortcuts: Exception while checking the validity of the loaded shortcuts to make sure they're ok to use");
return false;
}
}
public static bool SaveShortcuts()
@ -632,11 +641,13 @@ namespace DisplayMagician
{
// We need to refresh the cached answer
// Get the list of connected devices
logger.Trace($"ShortcutRepository/IsValidRefresh: IsValidRefresh starting.");
foreach (ShortcutItem loadedShortcut in AllShortcuts)
{
logger.Trace($"ShortcutRepository/IsValidRefresh: Running RefreshValidity on Shortcut {loadedShortcut.Name}");
loadedShortcut.RefreshValidity();
}
logger.Trace($"ShortcutRepository/IsValidRefresh: IsValidRefresh completed.");
}
private static ProcessPriorityClass TranslatePriorityClassToClass(ProcessPriority processPriority)

View File

@ -272,6 +272,7 @@ namespace DisplayMagician.UIForms
private void btn_setup_display_profiles_Click(object sender, EventArgs e)
{
logger.Trace($"MainForm/btn_setup_display_profiles_Click: User pressed the Display Profiles button (or selected the menu item)");
DisplayProfileForm displayProfileForm = null;
if (Application.OpenForms.OfType<DisplayProfileForm>().Any())
{
@ -295,6 +296,7 @@ namespace DisplayMagician.UIForms
private void btn_setup_game_shortcuts_Click(object sender, EventArgs e)
{
logger.Trace($"MainForm/btn_setup_game_shortcuts_Click: User pressed the Game Shortcuts button (or selected the menu item)");
ShortcutLibraryForm shortcutLibraryForm = null;
if (Application.OpenForms.OfType<ShortcutLibraryForm>().Any())
{

View File

@ -919,6 +919,39 @@ namespace DisplayMagician.UIForms
private void ClearForm()
{
// Reset all the tracking variables back to default
_editingExistingShortcut = false;
//_loadedProfiles = new List<ProfileItem>();
_profileToUse = null;
_gameLauncher = "";
//_gameToUse;
// _executableToUse;
_displayPermanence = ShortcutPermanence.Temporary;
_audioPermanence = ShortcutPermanence.Temporary;
_capturePermanence = ShortcutPermanence.Temporary;
_startPrograms = new List<StartProgram>();
_stopPrograms = new List<StopProgram>();
_audioDevice = "";
_changeAudioDevice = false;
_setAudioVolume = false;
_audioVolume = -1;
_captureDevice = "";
_changeCaptureDevice = false;
_setCaptureVolume = false;
_captureVolume = -1;
_shortcutToEdit = null;
_selectedGame = null;
_isUnsaved = true;
_loadedShortcut = false;
_autoName = true;
_gameId = "0";
_uuid = "";
audioDevices = null;
selectedAudioDevice = null;
captureDevices = null;
selectedCaptureDevice = null;
_hotkey = Keys.None;
// Clear the textboxes
txt_alternative_executable.Text = "";
txt_alternative_game.Text = "";
@ -1376,10 +1409,10 @@ namespace DisplayMagician.UIForms
cb_wait_alternative_game.Checked = false;
}
// Set the launcher items if we have them
// Show an error message if there isn't a game launcher selected
if (_shortcutToEdit.GameLibrary.Equals(SupportedGameLibraryType.Unknown))
{
if (DisplayMagician.GameLibraries.GameLibrary.AllInstalledGamesInAllLibraries.Count <= 0)
if (GameLibraries.GameLibrary.AllInstalledGamesInAllLibraries.Count <= 0)
{
// Fill in the game library information to highlight there isn't one detected.
_gameLauncher = "None detected";
@ -1398,6 +1431,7 @@ namespace DisplayMagician.UIForms
}
else
{
// Set the launcher items if we have them
_gameLauncher = _shortcutToEdit.GameLibrary.ToString("G");
txt_game_name.Text = _shortcutToEdit.GameName;
_gameId = _shortcutToEdit.GameAppId;

View File

@ -43,13 +43,14 @@ namespace DisplayMagician.UIForms
// Refresh the profiles and the shortcut validity to start
// The rest of the refreshing happens as the shortcuts are added
// and deleted.
logger.Trace($"ShortcutLibraryForm/ShortcutLibraryForm_Load: Refreshing Possibilty.");
ProfileRepository.IsPossibleRefresh();
logger.Trace($"ShortcutLibraryForm/ShortcutLibraryForm_Load: Refreshing Validity.");
ShortcutRepository.IsValidRefresh();
logger.Trace($"ShortcutLibraryForm/ShortcutLibraryForm_Load: Refreshing SHortutLibraryUI.");
// Refresh the Shortcut Library UI
RefreshShortcutLibraryUI();
logger.Trace($"ShortcutLibraryForm/ShortcutLibraryForm_Load: Remove the UI warning if we do have some shortcuts to show the user.");
RemoveWarningIfShortcuts();
}
@ -61,13 +62,18 @@ namespace DisplayMagician.UIForms
return;
// Temporarily stop updating the saved_profiles listview
logger.Trace($"ShortcutLibraryForm/RefreshShortcutLibraryUI: Suspending the imagelistview layout");
ilv_saved_shortcuts.SuspendLayout();
ImageListViewItem newItem = null;
ImageListViewItem newItem = null;
logger.Trace($"ShortcutLibraryForm/RefreshShortcutLibraryUI: Emptying shortcut list");
ilv_saved_shortcuts.Items.Clear();
foreach (ShortcutItem loadedShortcut in ShortcutRepository.AllShortcuts.OrderBy(s => s.Name))
{
logger.Trace($"ShortcutLibraryForm/RefreshShortcutLibraryUI: Adding shortcut {loadedShortcut.Name} into the list of shortcuts shown to the user ");
// Ignore any shortcuts with incompatible game libraries
if (loadedShortcut.Category == ShortcutCategory.Game && (!Enum.IsDefined(typeof(SupportedGameLibraryType), loadedShortcut.GameLibrary) || loadedShortcut.GameLibrary == SupportedGameLibraryType.Unknown))
{
@ -81,26 +87,31 @@ namespace DisplayMagician.UIForms
// Select it if its the selectedProfile
if (_selectedShortcut is ShortcutItem && _selectedShortcut.Equals(loadedShortcut))
{
logger.Trace($"ShortcutLibraryForm/RefreshShortcutLibraryUI: This shortcut {loadedShortcut.Name} is the selected one so selecting it in the UI");
newItem.Selected = true;
// Hide the run button if the shortcut isn't valid
if (_selectedShortcut.IsValid == ShortcutValidity.Warning || _selectedShortcut.IsValid == ShortcutValidity.Error)
{
logger.Trace($"ShortcutLibraryForm/RefreshShortcutLibraryUI: This shortcut {loadedShortcut.Name} is the selected one and is invalid ({_selectedShortcut.IsValid.ToString("G")}), so highlighting that in the UI");
btn_run.Visible = false;
cms_shortcuts.Items[1].Enabled = false;
}
else
{
logger.Trace($"ShortcutLibraryForm/RefreshShortcutLibraryUI: This shortcut {loadedShortcut.Name} is the selected one and is valid, so highlighting that in the UI");
btn_run.Visible = true;
cms_shortcuts.Items[1].Enabled = true;
}
}
//ilv_saved_profiles.Items.Add(newItem);
logger.Trace($"ShortcutLibraryForm/RefreshShortcutLibraryUI: Adding this shortcut {loadedShortcut.Name} to the imagelistview");
ilv_saved_shortcuts.Items.Add(newItem, _shortcutAdaptor);
}
logger.Trace($"ShortcutLibraryForm/RefreshShortcutLibraryUI: Resuming the imagelistview layout");
// Restart updating the saved_profiles listview
ilv_saved_shortcuts.ResumeLayout();