コード例 #1
0
        public static ShellLink CreateShortcut(string shortcutPath, string actualFilePath, string description = null, string workingDirectory = null, string arguments = null)
        {
            shortcutPath   = shortcutPath.GetFullPath();
            actualFilePath = actualFilePath.GetFullPath();
            if (!System.IO.Path.HasExtension(shortcutPath))
            {
                shortcutPath += ".LNK";
            }

            var link = new ShellLink(shortcutPath);

            link.Path = actualFilePath;

            link.WorkingDirectory = workingDirectory ?? System.IO.Path.GetDirectoryName(actualFilePath);

            if (description != null)
            {
                link.Description = description;
            }

            if (arguments != null)
            {
                link.Arguments = arguments;
            }

            link.Save(shortcutPath);
            return(link);
        }
コード例 #2
0
        /// <summary>
        ///   Load a shortcut from a file.
        /// </summary>
        /// <param name="linkPath"> A path to the file. </param>
        public static ShellLink Load(string linkPath)
        {
            var result = new ShellLink();

            ((IPersistFile)result.shellLink).Load(linkPath, (int)STGM_FLAGS.STGM_READ);
            result.ReadConsoleProperties();
            return(result);
        }
コード例 #3
0
ファイル: ConsoleProperties.cs プロジェクト: jonnybest/coapp
 /// <summary>
 ///   This should be only called by a ShellLink constructor
 /// </summary>
 /// <param name = "owner"></param>
 internal ConsoleProperties(ShellLink owner)
     : this()
 {
     this.owner = owner;
 }
コード例 #4
0
ファイル: ShellLink.cs プロジェクト: segilbert/coapp
 /// <summary>
 ///   Load a shortcut from a file.
 /// </summary>
 /// <param name = "linkPath">A path to the file.</param>
 public static ShellLink Load(string linkPath)
 {
     var result = new ShellLink();
     ((IPersistFile)result.shellLink).Load(linkPath, (int)STGM_FLAGS.STGM_READ);
     result.ReadConsoleProperties();
     return result;
 }
コード例 #5
0
ファイル: ShellLink.cs プロジェクト: segilbert/coapp
        public static ShellLink CreateShortcut(string shortcutPath, string actualFilePath, string description = null, string workingDirectory = null, string arguments = null)
        {
            shortcutPath = shortcutPath.GetFullPath();
            actualFilePath = actualFilePath.GetFullPath();
            if (!System.IO.Path.HasExtension(shortcutPath))
                shortcutPath += ".LNK";

            var link = new ShellLink(shortcutPath);
            link.Path = actualFilePath;

            link.WorkingDirectory = workingDirectory ?? System.IO.Path.GetDirectoryName(actualFilePath);

            if (description != null)
                link.Description = description;

            if (arguments != null)
                link.Arguments = arguments;

            link.Save(shortcutPath);
            return link;
        }
コード例 #6
0
ファイル: ConsoleProperties.cs プロジェクト: caoxk/coapp
 /// <summary>
 ///   This should be only called by a ShellLink constructor
 /// </summary>
 /// <param name="owner"> </param>
 internal ConsoleProperties(ShellLink owner)
     : this()
 {
     this.owner = owner;
 }