45 lines
910 B
C#
45 lines
910 B
C#
using System.Configuration.Install;
|
|
using System.Reflection;
|
|
using System.ServiceProcess;
|
|
|
|
namespace smtpproxy.net;
|
|
|
|
internal static class Program
|
|
{
|
|
private static void Main(string[] args)
|
|
{
|
|
SMTPProxy sMTPProxy = new SMTPProxy();
|
|
ServiceBase[] services = new ServiceBase[1] { sMTPProxy };
|
|
if (args.Length != 0)
|
|
{
|
|
switch (args[0])
|
|
{
|
|
case "-install":
|
|
ManagedInstallerClass.InstallHelper(new string[1] { Assembly.GetExecutingAssembly().Location });
|
|
break;
|
|
case "-uninstall":
|
|
ManagedInstallerClass.InstallHelper(new string[2]
|
|
{
|
|
"/u",
|
|
Assembly.GetExecutingAssembly().Location
|
|
});
|
|
break;
|
|
case "-console":
|
|
if (args.Length > 1 && args[1] == "-reload")
|
|
{
|
|
sMTPProxy.Reload(args[2]);
|
|
}
|
|
else
|
|
{
|
|
sMTPProxy.Start();
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ServiceBase.Run(services);
|
|
}
|
|
}
|
|
}
|