mirror of
https://github.com/donavon04/MPELicenseAgent.git
synced 2025-01-18 00:50:57 -07:00
65 lines
2.4 KiB
C#
65 lines
2.4 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: LicenseTrackerService.ProjectInstaller
|
|
// Assembly: LicenseTrackerService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
|
// MVID: 190801E4-3027-41A4-B03A-CBAE9DAB23BA
|
|
// Assembly location: C:\MPE\MPELicenseTracker\LicenseTrackerService.exe
|
|
|
|
using System.ComponentModel;
|
|
using System.Configuration.Install;
|
|
using System.ServiceProcess;
|
|
|
|
#nullable disable
|
|
namespace LicenseTrackerService
|
|
{
|
|
[RunInstaller(true)]
|
|
public class ProjectInstaller : Installer
|
|
{
|
|
private IContainer components = (IContainer) null;
|
|
private ServiceProcessInstaller serviceProcessInstaller1;
|
|
private ServiceInstaller serviceInstaller1;
|
|
|
|
public ProjectInstaller()
|
|
{
|
|
this.InitializeComponent();
|
|
this.serviceInstaller1.StartType = ServiceStartMode.Automatic;
|
|
this.AfterInstall += new InstallEventHandler(this.serviceInstaller1_AfterInstall);
|
|
}
|
|
|
|
private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)
|
|
{
|
|
using (ServiceController serviceController = new ServiceController(this.serviceInstaller1.ServiceName))
|
|
{
|
|
if (serviceController.Status.Equals((object) ServiceControllerStatus.Running) || serviceController.Status.Equals((object) ServiceControllerStatus.StartPending))
|
|
serviceController.Stop();
|
|
serviceController.WaitForStatus(ServiceControllerStatus.Stopped);
|
|
serviceController.Start();
|
|
serviceController.WaitForStatus(ServiceControllerStatus.Running);
|
|
}
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing && this.components != null)
|
|
this.components.Dispose();
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
this.serviceProcessInstaller1 = new ServiceProcessInstaller();
|
|
this.serviceInstaller1 = new ServiceInstaller();
|
|
this.serviceProcessInstaller1.Account = ServiceAccount.LocalSystem;
|
|
this.serviceProcessInstaller1.Password = (string) null;
|
|
this.serviceProcessInstaller1.Username = (string) null;
|
|
this.serviceInstaller1.Description = "Used to track license usage";
|
|
this.serviceInstaller1.DisplayName = "MPE License Tracker";
|
|
this.serviceInstaller1.ServiceName = "MPELicenseTracker";
|
|
this.Installers.AddRange(new Installer[2]
|
|
{
|
|
(Installer) this.serviceProcessInstaller1,
|
|
(Installer) this.serviceInstaller1
|
|
});
|
|
}
|
|
}
|
|
}
|