public static void CreateShortcut( string shortcutPath, string shortcutIconPath, string targetApplication, string paramsString, string description, string package = "") { try { package = package ?? string.Empty; shortcutPath = ShortcutHelper.FixFileName(shortcutPath, package); ShortcutHelper.DeleteFileIfExists(shortcutPath); ShortcutHelper.IShellLink shellLink = (ShortcutHelper.IShellLink) new ShortcutHelper.ShellLink(); shellLink.SetDescription(description); shellLink.SetPath(targetApplication); shellLink.SetIconLocation(shortcutIconPath, 0); shellLink.SetArguments(paramsString); ((IPersistFile)shellLink).Save(shortcutPath, false); } catch (Exception ex) { Logger.Warning("Could not create shortcut for " + shortcutPath + " . " + ex.ToString()); } }
public static void CreateStartMenuShortcut( string shortcutName, string shortcutIconPath, string targetApplication, string paramsString, string description) { ShortcutHelper.CreateShortcut(Path.Combine(ShortcutHelper.CommonStartMenuPath, shortcutName), shortcutIconPath, targetApplication, paramsString, description, ""); }
public static void CreateDesktopShortcut( string shortcutName, string shortcutIconPath, string targetApplication, string paramsString, string description, string package = "") { ShortcutHelper.CreateShortcut(Path.Combine(ShortcutHelper.sDesktopPath, shortcutName), shortcutIconPath, targetApplication, paramsString, description, package); }
private static void DeleteFileIfExists(string filePath) { string path1 = ShortcutHelper.FixFileName(filePath, ""); if (File.Exists(path1)) { Logger.Info("Deleting: " + path1); File.Delete(path1); } string path2 = ShortcutHelper.FixFileName(filePath, "ncsoft"); if (!File.Exists(path2)) { return; } Logger.Info("Deleting: " + path2); File.Delete(path2); }
public static void DeleteStartMenuShortcut(string shortcutName) { ShortcutHelper.DeleteFileIfExists(Path.Combine(ShortcutHelper.CommonStartMenuPath, shortcutName)); }
public static void DeleteDesktopShortcut(string shortcutName) { ShortcutHelper.DeleteFileIfExists(Path.Combine(ShortcutHelper.sDesktopPath, shortcutName)); }