/// <summary> /// Iterates over all existing Steam shortcuts and returns all SteamLauncher shortcuts (shortcuts with tag <see cref="DefaultShortcut.TAG"/>). /// </summary> /// <returns></returns> private static IEnumerable <UInt32> GetSteamLauncherShortcuts() { UInt32 shortcutCount = ClientShortcuts.GetShortcutCount(); Logger.Info($"Searching {shortcutCount} shortcuts to find all SteamLauncher shortcuts."); for (UInt32 sc = 0; sc < shortcutCount; sc++) { UInt32 appId = ClientShortcuts.GetShortcutAppIdByIndex(sc); if (appId == 0) { continue; } // TODO: The Steam update on 2018-10-13 broke SteamLauncher 0.9.0.4. The call to GetShortcutUserTagCountByAppId is returning a very large invalid number (in most cases it should be 0). I suspect something has changed in the vftable offsets again. // Check if the shortcut has the unique SteamLauncher user category tag for (UInt32 tc = 0; tc < ClientShortcuts.GetShortcutUserTagCountByAppId(appId); tc++) { if (!string.Equals(ClientShortcuts.GetShortcutUserTagByAppId(appId, tc), DefaultShortcut.TAG, StringComparison.OrdinalIgnoreCase)) { continue; } Logger.Info($"SteamLauncher shortcut found: [{appId}] {ClientShortcuts.GetShortcutAppNameByAppId(appId)}"); yield return(appId); break; } } }
/// <summary> /// Iterates over all existing Steam shortcuts and returns all SteamLauncher shortcuts (shortcuts with tag <see cref="DefaultShortcut.TAG"/>). /// </summary> /// <returns></returns> private static IEnumerable <UInt32> GetSteamLauncherShortcuts() { UInt32 shortcutCount = ClientShortcuts.GetShortcutCount(); Logger.Info($"Searching {shortcutCount} shortcuts to find all SteamLauncher shortcuts."); for (UInt32 sc = 0; sc < shortcutCount; sc++) { UInt32 appId = ClientShortcuts.GetShortcutAppIdByIndex(sc); if (appId == 0) { continue; } // Check if the shortcut has the unique SteamLauncher user category tag for (UInt32 tc = 0; tc < ClientShortcuts.GetShortcutUserTagCountByAppId(appId); tc++) { if (!string.Equals(ClientShortcuts.GetShortcutUserTagByAppId(appId, tc), DefaultShortcut.TAG, StringComparison.OrdinalIgnoreCase)) { continue; } Logger.Info($"SteamLauncher shortcut found: [{appId}] {ClientShortcuts.GetShortcutAppNameByAppId(appId)}"); yield return(appId); break; } } }