public Dictionary <ShortcutLocation, ShellLink> GetShortcutsForExecutable(string exeName, ShortcutLocation locations, string programArguments)
            {
                Log.InfoFormat("About to create shortcuts for {0}, rootAppDir {1}", exeName, rootAppDirectory);

                var releases    = Utility.LoadLocalReleases(Utility.LocalReleaseFileForAppDir(rootAppDirectory));
                var thisRelease = Utility.FindCurrentVersion(releases);

                var zf = new ZipPackage(
                    Path.Combine(
                        Utility.PackageDirectoryForAppDir(rootAppDirectory),
                        thisRelease.Filename));

                var exePath     = Path.Combine(Utility.AppDirForRelease(rootAppDirectory, thisRelease), exeName);
                var fileVerInfo = FileVersionInfo.GetVersionInfo(exePath);

                var ret = new Dictionary <ShortcutLocation, ShellLink>();

                foreach (var f in (ShortcutLocation[])Enum.GetValues(typeof(ShortcutLocation)))
                {
                    if (!locations.HasFlag(f))
                    {
                        continue;
                    }

                    var file                 = LinkTargetForVersionInfo(f, zf, fileVerInfo);
                    var appUserModelId       = $"com.squirrel.{zf.Id.Replace(" ", "")}.{exeName.Replace(".exe", "").Replace(" ", "")}";
                    var toastActivatorClsdid = Utility.CreateGuidFromHash(appUserModelId).ToString();

                    Log.InfoFormat("Creating shortcut for {0} => {1}", exeName, file);
                    Log.InfoFormat("appUserModelId: {0} | toastActivatorCLSID: {1}", appUserModelId, toastActivatorClsdid);

                    var target = Path.Combine(rootAppDirectory, exeName);
                    var sl     = new ShellLink
                    {
                        Target           = target,
                        IconPath         = target,
                        IconIndex        = 0,
                        WorkingDirectory = Path.GetDirectoryName(exePath),
                        Description      = zf.Description
                    };

                    if (!string.IsNullOrWhiteSpace(programArguments))
                    {
                        sl.Arguments += $" -a \"{programArguments}\"";
                    }

                    sl.SetAppUserModelId(appUserModelId);
                    sl.SetToastActivatorCLSID(toastActivatorClsdid);

                    ret.Add(f, sl);
                }

                return(ret);
            }
            public void CreateShortcutsForExecutable(string exeName, ShortcutLocation locations, bool updateOnly, string programArguments, string icon)
            {
                Log.InfoFormat("About to create shortcuts for {0}, rootAppDir {1}", exeName, rootAppDirectory);

                var releases    = Utility.LoadLocalReleases(Utility.LocalReleaseFileForAppDir(rootAppDirectory));
                var thisRelease = Utility.FindCurrentVersion(releases);

                var zf = new ZipPackage(
                    Path.Combine(
                        Utility.PackageDirectoryForAppDir(rootAppDirectory),
                        thisRelease.Filename));

                var exePath     = Path.Combine(Utility.AppDirForRelease(rootAppDirectory, thisRelease), exeName);
                var fileVerInfo = FileVersionInfo.GetVersionInfo(exePath);

                foreach (var f in (ShortcutLocation[])Enum.GetValues(typeof(ShortcutLocation)))
                {
                    if (!locations.HasFlag(f))
                    {
                        continue;
                    }

                    var file       = LinkTargetForVersionInfo(f, zf, fileVerInfo);
                    var fileExists = File.Exists(file);

                    // NB: If we've already installed the app, but the shortcut
                    // is no longer there, we have to assume that the user didn't
                    // want it there and explicitly deleted it, so we shouldn't
                    // annoy them by recreating it.
                    if (!fileExists && updateOnly)
                    {
                        Log.WarnFormat("Wanted to update shortcut {0} but it appears user deleted it", file);
                        continue;
                    }

                    Log.InfoFormat("Creating shortcut for {0} => {1}", exeName, file);

                    ShellLink sl;
                    Log.ErrorIfThrows(
                        () => Utility.Retry(
                            () =>
                    {
                        File.Delete(file);

                        var target = Path.Combine(rootAppDirectory, exeName);
                        sl         = new ShellLink
                        {
                            Target           = target,
                            IconPath         = icon ?? target,
                            IconIndex        = 0,
                            WorkingDirectory = Path.GetDirectoryName(exePath),
                            Description      = zf.Description
                        };

                        if (!string.IsNullOrWhiteSpace(programArguments))
                        {
                            sl.Arguments += $" -a \"{programArguments}\"";
                        }

                        var appUserModelId      = $"com.squirrel.{zf.Id.Replace(" ", "")}.{exeName.Replace(".exe", "").Replace(" ", "")}";
                        var toastActivatorClsid = Utility.CreateGuidFromHash(appUserModelId).ToString();

                        sl.SetAppUserModelId(appUserModelId);
                        sl.SetToastActivatorCLSID(toastActivatorClsid);

                        Log.InfoFormat(
                            "About to save shortcut: {0} (target {1}, workingDir {2}, args {3}, toastActivatorCSLID {4})",
                            file,
                            sl.Target,
                            sl.WorkingDirectory,
                            sl.Arguments,
                            toastActivatorClsid);
                        if (ModeDetector.InUnitTestRunner() == false)
                        {
                            sl.Save(file);
                        }
                    },
                            4),
                        "Can't write shortcut: " + file);
                }

                FixPinnedExecutables(zf.Version);
            }