Ignore:
Timestamp:
01/13/15 13:33:12 (6 years ago)
Author:
ascheibe
Message:

#2244 merged r11364,r11365,r11366,r11599,r11652 into stable

Location:
stable
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Services.Hive.JanitorService/3.3/HeuristicLab.Services.Hive.JanitorService-3.3.csproj

    r8600 r11749  
    135135    </EmbeddedResource>
    136136  </ItemGroup>
     137  <ItemGroup>
     138    <Content Include="ICSharpCode.SharpZipLib License.txt">
     139      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     140    </Content>
     141  </ItemGroup>
    137142  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    138143  <PropertyGroup>
    139    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     144    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    140145set ProjectDir=$(ProjectDir)
    141146set SolutionDir=$(SolutionDir)
     
    143148
    144149call PreBuildEvent.cmd</PreBuildEvent>
    145 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     150    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
    146151export ProjectDir=$(ProjectDir)
    147152export SolutionDir=$(SolutionDir)
  • stable/HeuristicLab.Services.Hive.JanitorService/3.3/Program.cs

    r11170 r11749  
    2020#endregion
    2121
     22using System;
     23using System.Configuration.Install;
     24using System.Reflection;
    2225using System.ServiceProcess;
    2326
    2427namespace HeuristicLab.Services.Hive.JanitorService {
    2528  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 JanitorService()
    34       };
    35       ServiceBase.Run(ServicesToRun);
     29    private static void Main(string[] args) {
     30      // Install as service, see http://stackoverflow.com/a/12703878
     31      if (Environment.UserInteractive) {
     32        try {
     33          string parameter = string.Concat(args);
     34          switch (parameter) {
     35            case "--install":
     36              ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location });
     37              break;
     38            case "--uninstall":
     39              ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location });
     40              break;
     41          }
     42        }
     43        catch (Exception ex) {
     44          Console.WriteLine("Error on (un)install of Hive Slave service: " + Environment.NewLine + ex);
     45        }
     46      } else {
     47        ServiceBase[] ServicesToRun;
     48        ServicesToRun = new ServiceBase[]
     49        {
     50          new JanitorService()
     51        };
     52        ServiceBase.Run(ServicesToRun);
     53      }
    3654    }
    3755  }
Note: See TracChangeset for help on using the changeset viewer.