コード例 #1
0
        /// <summary>
        /// Creates a shortcut file for the given executable
        /// </summary>
        /// <param name="LinkName">The file name to be used for the shortcut.  If it does not end with .lnk, then .lnk will be appended.</param>
        /// <param name="LinkFolder">The folder the shortcut will be created in.</param>
        /// <param name="LinkDescription">The description for the shortcut.</param>
        /// <param name="DestPath">The full path to the file the shortcut will open.</param>
        /// <param name="DestArguments">Any arguments that will be used when launching the file.</param>
        /// <param name="IconSource">The icon that will be used.  If not provided, the icon will be the default icon for the DestPath.</param>
        /// <param name="IconSourceIndex">The icon index that will be used.  If not provided, the default icon index will be used.</param>
        /// <returns>The created shortcut file</returns>
        public static ShellLink Create(string LinkName, System.Environment.SpecialFolder LinkFolder, string LinkDescription, string DestPath, string DestArguments = DEST_ARGUMENTS_NONE, string IconSource = ICON_FROM_DESTINATION, int IconSourceIndex = ICON_INDEX_DEFAULT)
        {
            var FolderPath = LinkFolder.Path();

            return(Create(LinkName, FolderPath, LinkDescription, DestPath, DestArguments, IconSource, IconSourceIndex));
        }
コード例 #2
0
        /// <summary>
        /// Deletes a shortcut from the specified folder if it exists.
        /// </summary>
        /// <param name="LinkName">The name of the shortcut file.  If it does not end with .lnk then .lnk will be appended.</param>
        /// <param name="LinkFolder">The folder the shortcut file may exist in.</param>
        public static void Delete(string LinkName, System.Environment.SpecialFolder LinkFolder)
        {
            var FolderPath = LinkFolder.Path();

            Delete(LinkName, FolderPath);
        }