aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
diff options
context:
space:
mode:
authorEric Reed <ebr@mediabrowser3.com>2013-03-12 15:28:06 -0400
committerEric Reed <ebr@mediabrowser3.com>2013-03-12 15:28:06 -0400
commitcc9f249afe4dd2b0ec96f59a748c67e301baca59 (patch)
treebd03f85c91ac71b0bc3b5895030ef64ff2c52965 /MediaBrowser.Common.Implementations/BaseApplicationHost.cs
parent36e4e8f40235d51c71261585d29d82d9e8ed27c1 (diff)
Implement configureautorun in server #19 need to update nuget to put in mbt
Diffstat (limited to 'MediaBrowser.Common.Implementations/BaseApplicationHost.cs')
-rw-r--r--MediaBrowser.Common.Implementations/BaseApplicationHost.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
index 57bf389fe..817018b49 100644
--- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
+++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
@@ -473,10 +473,32 @@ namespace MediaBrowser.Common.Implementations
}
/// <summary>
+ /// Defines the full path to our shortcut in the start menu
+ /// </summary>
+ protected abstract string ProductShortcutPath { get; }
+
+ /// <summary>
/// Configures the auto run at startup.
/// </summary>
private void ConfigureAutoRunAtStartup()
{
+ if (ConfigurationManager.CommonConfiguration.RunAtStartup)
+ {
+ //Copy our shortut into the startup folder for this user
+ File.Copy(ProductShortcutPath, Environment.GetFolderPath(Environment.SpecialFolder.Startup), true);
+ }
+ else
+ {
+ //Remove our shortcut from the startup folder for this user
+ try
+ {
+ File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), Path.GetFileName(ProductShortcutPath)));
+ }
+ catch (FileNotFoundException)
+ {
+ //This is okay - trying to remove it anyway
+ }
+ }
}
/// <summary>