Shortcuts class
Namespace: Velopack.Windows
Desktop and StartMenuRoot shortcuts are now created and removed automatically when your app is installed / uninstalled.
A helper class to create or delete windows shortcuts.
[Obsolete("Desktop and StartMenuRoot shortcuts are now created and removed automatically when your app is installed / uninstalled.")]
public class Shortcuts
Constructors
| Constructor | Summary |
|---|---|
Shortcuts | A helper class to create or delete windows shortcuts. |
Shortcuts(locator)
public Shortcuts(IVelopackLocator locator = null)
A helper class to create or delete windows shortcuts.
Parameters
| Name | Type | Description |
|---|---|---|
locator | IVelopackLocator |
Properties
| Property | Summary |
|---|---|
Log | Log for diagnostic messages. |
Locator | Locator to use for finding important application paths. |
Log
protected IVelopackLogger Log { get; }
Log for diagnostic messages.
Locator
protected IVelopackLocator Locator { get; }
Locator to use for finding important application paths.
Methods
| Method | Summary |
|---|---|
CreateShortcutForThisExe | Create a shortcut to the currently running executable at the specified locations. |
RemoveShortcutForThisExe | Removes a shortcut for the currently running executable at the specified locations |
FindShortcuts | Searches for existing shortcuts to an executable inside the current package. |
CreateShortcut | Creates new shortcuts to the specified executable at the specified locations. |
DeleteShortcuts | Delete all the shortcuts for the specified executable in the specified locations. |
LinkPathForVersionInfo | Given an ZipPackage and FileVersionInfo return the target shortcut path. |
GetLinkPath | Given the application info, return the shortcut target path. |
CreateShortcutForThisExe(location)
public void CreateShortcutForThisExe(ShortcutLocation location = ShortcutLocation.Desktop | ShortcutLocation.StartMenuRoot)
Create a shortcut to the currently running executable at the specified locations.
See CreateShortcut to create a shortcut to a different program
Parameters
| Name | Type | Description |
|---|---|---|
location | ShortcutLocation |
RemoveShortcutForThisExe(location)
public void RemoveShortcutForThisExe(ShortcutLocation location = ShortcutLocation.StartMenu | ShortcutLocation.Desktop | ShortcutLocation.StartMenuRoot)
Removes a shortcut for the currently running executable at the specified locations
Parameters
| Name | Type | Description |
|---|---|---|
location | ShortcutLocation |
FindShortcuts(relativeExeName, locations)
public Dictionary<ShortcutLocation, ShellLink> FindShortcuts(string relativeExeName, ShortcutLocation locations)
Searches for existing shortcuts to an executable inside the current package.
Parameters
| Name | Type | Description |
|---|---|---|
relativeExeName | string | The relative path or filename of the executable (from the current app dir). |
locations | ShortcutLocation | The locations to search. |
Returns Dictionary<ShortcutLocation, ShellLink>
CreateShortcut(relativeExeName, locations, updateOnly, programArguments, icon)
public void CreateShortcut(string relativeExeName, ShortcutLocation locations, bool updateOnly, string programArguments, string icon = null)
Creates new shortcuts to the specified executable at the specified locations.
Parameters
| Name | Type | Description |
|---|---|---|
relativeExeName | string | The relative path or filename of the executable (from the current app dir). |
locations | ShortcutLocation | The locations to create shortcuts. |
updateOnly | bool | If true, shortcuts will be updated instead of created. |
programArguments | string | The arguments the application should be launched with |
icon | string | Path to a specific icon to use instead of the exe icon. |
DeleteShortcuts(relativeExeName, locations)
public void DeleteShortcuts(string relativeExeName, ShortcutLocation locations)
Delete all the shortcuts for the specified executable in the specified locations.
Parameters
| Name | Type | Description |
|---|---|---|
relativeExeName | string | The relative path or filename of the executable (from the current app dir). |
locations | ShortcutLocation | The locations to create shortcuts. |
LinkPathForVersionInfo(location, package, versionInfo, rootdir)
protected virtual string LinkPathForVersionInfo(ShortcutLocation location, ZipPackage package, FileVersionInfo versionInfo, string rootdir)
Given an ZipPackage and FileVersionInfo return the target shortcut path.
Parameters
| Name | Type | Description |
|---|---|---|
location | ShortcutLocation | |
package | ZipPackage | |
versionInfo | FileVersionInfo | |
rootdir | string |
Returns string
GetLinkPath(location, title, applicationName, rootdir, createDirectoryIfNecessary)
protected virtual string GetLinkPath(ShortcutLocation location, string title, string applicationName, string rootdir, bool createDirectoryIfNecessary = true)
Given the application info, return the shortcut target path.
Parameters
| Name | Type | Description |
|---|---|---|
location | ShortcutLocation | |
title | string | |
applicationName | string | |
rootdir | string | |
createDirectoryIfNecessary | bool |
Returns string
Generated from Velopack 1.1.1