Changeset 12694 for branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Clients.Hive.Slave.WindowsService/3.3/Program.cs
- Timestamp:
- 07/09/15 13:07:30 (9 years ago)
- Location:
- branches/HeuristicLab.Problems.Orienteering
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.Orienteering
- Property svn:mergeinfo changed
-
Property
svn:global-ignores
set to
*.nuget
packages
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Clients.Hive.Slave.WindowsService/3.3/Program.cs
r11185 r12694 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 23 using System.Configuration.Install; 24 using System.Reflection; 22 25 using System.ServiceProcess; 23 26 24 27 namespace HeuristicLab.Clients.Hive.SlaveCore.WindowsService { 25 28 static class Program { 26 /// <summary> 27 /// The main entry point for the application. 28 /// </summary> 29 static void Main() { 30 ServiceBase[] ServicesToRun; 31 ServicesToRun = new ServiceBase[] 32 { 33 new SlaveWindowsService() 34 }; 35 ServiceBase.Run(ServicesToRun); 29 private static void Main(string[] args) { 30 // Install as service, see http://stackoverflow.com/a/12703878 31 bool installDone = false; 32 try { 33 string parameter = string.Concat(args); 34 switch (parameter) { 35 case "--install": 36 installDone = true; 37 ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location }); 38 break; 39 case "--uninstall": 40 installDone = true; 41 ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location }); 42 break; 43 } 44 } 45 catch (Exception ex) { 46 Console.WriteLine("Error on (un)install of Hive Slave service: " + Environment.NewLine + ex); 47 } 48 49 if (!installDone) { 50 ServiceBase[] ServicesToRun; 51 ServicesToRun = new ServiceBase[] 52 { 53 new SlaveWindowsService() 54 }; 55 ServiceBase.Run(ServicesToRun); 56 } 36 57 } 37 58 }
Note: See TracChangeset
for help on using the changeset viewer.