internal static void UpdateStartMenuShortcuts(IEnumerable <string> longAppNames) { var appNames = longAppNames?.ToArray(); if (appNames?.Any() != true) { return; } try { var startMenuDir = PathEx.Combine(Environment.SpecialFolder.StartMenu, "Programs"); #if x86 var shortcutPath = Path.Combine(startMenuDir, "Apps Launcher.lnk"); #else var shortcutPath = Path.Combine(startMenuDir, "Apps Launcher (64-bit).lnk"); #endif if (Directory.Exists(startMenuDir)) { var shortcuts = Directory.GetFiles(startMenuDir, "Apps Launcher*.lnk", SearchOption.TopDirectoryOnly); if (shortcuts.Length > 0) { foreach (var shortcut in shortcuts) { File.Delete(shortcut); } } } if (!Directory.Exists(startMenuDir)) { Directory.CreateDirectory(startMenuDir); } FileEx.CreateShellLink(EnvironmentEx.GetVariablePathFull(PathEx.LocalPath, false), shortcutPath); startMenuDir = Path.Combine(startMenuDir, "Portable Apps"); if (Directory.Exists(startMenuDir)) { var shortcuts = Directory.GetFiles(startMenuDir, "*.lnk", SearchOption.TopDirectoryOnly); if (shortcuts.Length > 0) { foreach (var shortcut in shortcuts) { File.Delete(shortcut); } } } if (!Directory.Exists(startMenuDir)) { Directory.CreateDirectory(startMenuDir); } Parallel.ForEach(appNames, x => FileEx.CreateShellLink(EnvironmentEx.GetVariablePathFull(CacheData.FindAppData(x)?.FilePath, false, false), Path.Combine(startMenuDir, x))); } catch (Exception ex) { Log.Write(ex); } }
internal static void Restore(string appName, Form owner) => Restore(CacheData.FindAppData(appName), false, owner);
internal static void Associate(string appName, Form owner) => Associate(CacheData.FindAppData(appName), false, owner);
internal static void Restore(string appName, bool quiet = false, Form owner = default) => Restore(CacheData.FindAppData(appName), quiet, owner);
internal static void Associate(string appName, bool quiet = false, Form owner = default(Form)) => Associate(CacheData.FindAppData(appName), quiet, owner);