diff options
| author | Tavares André <tavares_and@hotmail.com> | 2015-05-26 18:31:47 +0200 |
|---|---|---|
| committer | Tavares André <tavares_and@hotmail.com> | 2015-05-26 18:31:47 +0200 |
| commit | fb597815483c470b8f5218b4e2324bdf930df7ad (patch) | |
| tree | 291d325783a8d491079479590d467183de175a64 /MediaBrowser.ServerApplication/BackgroundService.cs | |
| parent | 428dfd183d224b9ec1e85828319399d80e1876e0 (diff) | |
| parent | 217c5fbe749d39554f23c1d9701d7260c1c5b0d0 (diff) | |
Merge branch 'dev' of https://github.com/MediaBrowser/MediaBrowser into dev
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> |
