My New Year's resolution is to stop making commits like these

This commit is contained in:
John Gross
2017-01-01 16:37:30 -08:00
parent 81037b502a
commit 6e0922b805
33 changed files with 780 additions and 249 deletions

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace Torch.Server
{
[RunInstaller(true)]
class TorchServiceInstaller : Installer
{
private ServiceInstaller _serviceInstaller;
public TorchServiceInstaller()
{
var serviceProcessInstaller = new ServiceProcessInstaller();
_serviceInstaller = new ServiceInstaller();
serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
serviceProcessInstaller.Username = null;
serviceProcessInstaller.Password = null;
_serviceInstaller.DisplayName = "Torch (SEDS)";
_serviceInstaller.Description = "Service for Torch (SE Dedicated Server)";
_serviceInstaller.StartType = ServiceStartMode.Manual;
_serviceInstaller.ServiceName = TorchService.Name;
Installers.Add(serviceProcessInstaller);
Installers.Add(_serviceInstaller);
}
/// <inheritdoc />
public override void Install(IDictionary stateSaver)
{
GetServiceName();
base.Install(stateSaver);
}
/// <inheritdoc />
public override void Uninstall(IDictionary savedState)
{
GetServiceName();
base.Uninstall(savedState);
}
private void GetServiceName()
{
var name = Context.Parameters["name"];
if (string.IsNullOrEmpty(name))
return;
_serviceInstaller.DisplayName = name;
_serviceInstaller.ServiceName = name;
}
}
}