Cleaned & Updated ProjectInstaller.cs

This commit is contained in:
2026-08-17 10:30:32 +10:00
parent 1d6e8e23a8
commit 44e40c7846

View File

@@ -2,47 +2,31 @@ using System.ComponentModel;
using System.Configuration.Install; using System.Configuration.Install;
using System.ServiceProcess; using System.ServiceProcess;
namespace smtpproxy.net; namespace smtpproxy.net
[RunInstaller(true)]
public class ProjectInstaller : Installer
{ {
private ServiceInstaller smtpproxyInstaller; [RunInstaller(true)]
public class ProjectInstaller : Installer
private ServiceProcessInstaller processInstaller; {
private readonly ServiceProcessInstaller processInstaller;
private IContainer components; private readonly ServiceInstaller smtpproxyInstaller;
public ProjectInstaller() public ProjectInstaller()
{ {
processInstaller = new ServiceProcessInstaller(); processInstaller = new ServiceProcessInstaller
InitializeComponent(); {
smtpproxyInstaller = new ServiceInstaller(); Account = ServiceAccount.NetworkService
processInstaller.Account = ServiceAccount.NetworkService; };
smtpproxyInstaller.StartType = ServiceStartMode.Automatic;
smtpproxyInstaller.ServiceName = "SMTPProxy.NET";
base.Installers.Add(processInstaller);
base.Installers.Add(smtpproxyInstaller);
}
private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e) smtpproxyInstaller = new ServiceInstaller
{ {
} StartType = ServiceStartMode.Automatic,
ServiceName = "SMTPProxy.NET",
DisplayName = "SBC SMTP Proxy Service",
Description = "Intercepts, logs, filters, and relays local SMTP traffic based on JSON profile rules."
};
private void serviceProcessInstaller1_AfterInstall(object sender, InstallEventArgs e) Installers.Add(processInstaller);
{ Installers.Add(smtpproxyInstaller);
} }
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
} }
} }