From d0c9273d679cfec73c10e6f863c5cf9012a3aa2f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 23 May 2015 16:44:15 -0400 Subject: install service with Emby name --- .../BackgroundService.cs | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'MediaBrowser.ServerApplication/BackgroundService.cs') 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 /// 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(); } /// -- cgit v1.2.3