public static string Path(this BadgerFolder This) { var ret = default(string); switch (This) { case BadgerFolder.StartMenuPrograms: ret = System.Environment.SpecialFolder.DesktopDirectory.Path("Programs"); break; case BadgerFolder.TaskBarPins: ret = System.Environment.SpecialFolder.ApplicationData.Path("Microsoft", "Internet Explorer", "Quick Launch", "User Pinned", "TaskBar"); break; case BadgerFolder.AppVersionFolder: ret = Badger.Deployment.Location.Current.VersionFolder.FullPath; break; case BadgerFolder.AppInstallFolder: ret = Badger.Deployment.Location.Current.InstallFolder; break; default: break; } return(ret); }
public static string Path(this BadgerFolder This, params string[] SubFolders) { var ret = Path(This); foreach (var item in SubFolders) { ret = System.IO.Path.Combine(ret, item); } return(ret); }
/// <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, BadgerFolder 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)); }