51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.ServiceProcess;
|
|
using System.Text;
|
|
using System.Configuration.Install;
|
|
using System.ComponentModel;
|
|
|
|
namespace NetMonitorServer {
|
|
[RunInstaller(true)]
|
|
public class TestWinInstaller : Installer {
|
|
private ServiceInstaller m_ThisService;
|
|
private ServiceProcessInstaller m_ThisServiceProcess;
|
|
|
|
public TestWinInstaller() {
|
|
m_ThisService = new ServiceInstaller();
|
|
m_ThisServiceProcess = new ServiceProcessInstaller();
|
|
|
|
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";
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|