/
diev
/
RobThree-DebuggableSelfInstallingService
Обзор
Документация
Войти
/
diev
/
RobThree-DebuggableSelfInstallingService
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
DebuggableService/Program.cs
52 строки
2 KB
RobThree
Initial commit
20 апр 2016, 20:20
20 апр 2016, 20:20
6a7e6f5
Код
Авторство
О чём код?
using System; using System.Linq; using System.ServiceProcess; using $safeprojectname$.Framework; namespace $safeprojectname$ { static class Program { // The main entry point for the windows service application. static void Main(string[] args) { try { // If install was a command line flag, then run the installer at runtime. if (args.Contains("-install", StringComparer.InvariantCultureIgnoreCase)) { WindowsServiceInstaller.RuntimeInstall<ServiceImplementation>(); } // If uninstall was a command line flag, run uninstaller at runtime. else if (args.Contains("-uninstall", StringComparer.InvariantCultureIgnoreCase)) { WindowsServiceInstaller.RuntimeUnInstall<ServiceImplementation>(); } // Otherwise, fire up the service as either console or windows service based on UserInteractive property. else { var implementation = new ServiceImplementation(); // If started from console, file explorer, etc, run as console app. if (Environment.UserInteractive) { ConsoleHarness.Run(args, implementation); } // Otherwise run as a windows service else { ServiceBase.Run(new WindowsServiceHarness(implementation)); } } } catch (Exception ex) { ConsoleHarness.WriteToConsole(ConsoleColor.Red, "An exception occurred in Main(): {0}", ex); } } } }