netmonitor/NetMonitorServer/Program.cs

51 lines
1.5 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Configuration.Install;
using System.ComponentModel;
2015-11-16 01:10:59 +01:00
namespace NetMonitorServer {
[RunInstaller(true)]
public class TestWinInstaller : Installer {
private ServiceInstaller m_ThisService;
private ServiceProcessInstaller m_ThisServiceProcess;
2015-11-16 01:10:59 +01:00
public TestWinInstaller() {
m_ThisService = new ServiceInstaller();
m_ThisServiceProcess = new ServiceProcessInstaller();
2015-11-16 01:10:59 +01:00
m_ThisServiceProcess.Account = ServiceAccount.LocalSystem;
m_ThisService.ServiceName = "NetMonitorServer";
m_ThisService.StartType = ServiceStartMode.Automatic;
m_ThisService.Description = "Teil von NetMonitor der die Systemnahen Befele ausführt";
m_ThisService.DisplayName = "Netzwerk Settings Tool";
2015-11-16 01:10:59 +01:00
Installers.Add(m_ThisService);
Installers.Add(m_ThisServiceProcess);
}
}
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args) {
if(args.Length == 0) {
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new MainService()
};
ServiceBase.Run(ServicesToRun);
} else if(args.Length == 1 && args[0] == "-r") {
MainService s = new MainService();
s.StartServiceConsole(args);
while(true) {
System.Threading.Thread.Sleep(100);
}
}
}
}
}