private PinnedApp BuildPinnedApp(string filename, string arguments) { var name = System.Diagnostics.FileVersionInfo.GetVersionInfo(filename).FileDescription; var path = FormatShortcutName(name); if (!Directory.Exists(_userDataPath)) { Directory.CreateDirectory(_userDataPath); } ShortcutUtil.CreateShortcut(filename, arguments, path); return(CreateShortCutAndBuildApp(path)); }
private PinnedApp BuildPinnedApp(Process process) { var fi = new FileInfo(process.MainModule.FileName); var name = System.Diagnostics.FileVersionInfo.GetVersionInfo(process.MainModule.FileName).FileDescription; var path = FormatShortcutName(name); if (!Directory.Exists(_userDataPath)) { Directory.CreateDirectory(_userDataPath); } // try to get full path including arguments string arguments = ProcessUtil.GetCommandLineArguments(process.MainModule.ModuleName); ShortcutUtil.CreateShortcut(process.MainModule.FileName, arguments, path); return(CreateShortCutAndBuildApp(path)); }
private PinnedApp CreateShortCutAndBuildApp(string fullName) { Bitmap icon; string displayName; string targetPath; string arguments; ShortcutUtil.ParseShortcut(fullName, out icon, out displayName, out targetPath, out arguments); return(new PinnedApp { Path = targetPath, Arguments = arguments, Name = displayName, Icon = icon, Shortcut = fullName }); }