diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-05-23 16:44:15 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-05-23 16:44:15 -0400 |
| commit | d0c9273d679cfec73c10e6f863c5cf9012a3aa2f (patch) | |
| tree | 6c6b595c169911e981ea43882dbcc864f1678d50 /MediaBrowser.ServerApplication/BackgroundService.cs | |
| parent | 25e325481db84629fa5b42a4bf8b1cf6f1761057 (diff) | |
install service with Emby name
Diffstat (limited to 'MediaBrowser.ServerApplication/BackgroundService.cs')
| -rw-r--r-- | MediaBrowser.ServerApplication/BackgroundService.cs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/MediaBrowser.ServerApplication/BackgroundService.cs b/MediaBrowser.ServerApplication/BackgroundService.cs index 019a11e1c..da7537cd7 100644 --- a/MediaBrowser.ServerApplication/BackgroundService.cs +++ b/MediaBrowser.ServerApplication/BackgroundService.cs @@ -1,4 +1,5 @@ using MediaBrowser.Model.Logging; +using System.Linq; using System.ServiceProcess; namespace MediaBrowser.ServerApplication @@ -8,8 +9,25 @@ namespace MediaBrowser.ServerApplication /// </summary> public class BackgroundService : ServiceBase { - public static string Name = "MediaBrowser"; - public static string DisplayName = "Media Browser"; + public static string Name = "Emby"; + public static string DisplayName = "Emby Server"; + + public static string GetExistingServiceName() + { + try + { + if (ServiceController.GetServices().Any(s => s.ServiceName == "MediaBrowser")) + { + return "MediaBrowser"; + } + } + catch + { + return "MediaBrowser"; + } + + return Name; + } private readonly ILogger _logger; @@ -24,7 +42,7 @@ namespace MediaBrowser.ServerApplication CanStop = true; - ServiceName = Name; + ServiceName = GetExistingServiceName(); } /// <summary> |
