using System; using System.IO; namespace MediaBrowser.ServerApplication.Native { /// /// Class Autorun /// public static class Autorun { /// /// Configures the specified autorun. /// /// if set to true [autorun]. public static void Configure(bool autorun) { var shortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Media Browser 3", "Media Browser Server.lnk"); if (autorun) { //Copy our shortut into the startup folder for this user File.Copy(shortcutPath, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), Path.GetFileName(shortcutPath) ?? "MBstartup.lnk"), true); } else { //Remove our shortcut from the startup folder for this user File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), Path.GetFileName(shortcutPath) ?? "MBstartup.lnk")); } } } }