aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication/Native/Autorun.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-24 20:54:51 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-24 20:54:51 -0400
commitfe5a9232c84cea113336005b3c7cbd7fe77a2d80 (patch)
tree9fb1412f4a8ca4303ec276b6ab6e096f98eed58d /MediaBrowser.ServerApplication/Native/Autorun.cs
parent0ab379e271afe69372806ab0e24a874d3f085456 (diff)
moved a few things for mono
Diffstat (limited to 'MediaBrowser.ServerApplication/Native/Autorun.cs')
-rw-r--r--MediaBrowser.ServerApplication/Native/Autorun.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/MediaBrowser.ServerApplication/Native/Autorun.cs b/MediaBrowser.ServerApplication/Native/Autorun.cs
new file mode 100644
index 000000000..d1c02db84
--- /dev/null
+++ b/MediaBrowser.ServerApplication/Native/Autorun.cs
@@ -0,0 +1,31 @@
+using System;
+using System.IO;
+
+namespace MediaBrowser.ServerApplication.Native
+{
+ /// <summary>
+ /// Class Autorun
+ /// </summary>
+ public static class Autorun
+ {
+ /// <summary>
+ /// Configures the specified autorun.
+ /// </summary>
+ /// <param name="autorun">if set to <c>true</c> [autorun].</param>
+ 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"));
+ }
+ }
+ }
+}