/[projects]/dao/DaoMqPump2/MQFilter/FilterServiceInstallerProcess.cs
ViewVC logotype

Annotation of /dao/DaoMqPump2/MQFilter/FilterServiceInstallerProcess.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2179 - (hide annotations) (download)
Tue May 20 20:05:16 2014 UTC (10 years ago) by torben
File size: 2151 byte(s)
Pump -> Filter
1 torben 2160 using System;
2     using System.Collections;
3     using System.Text;
4     using System.ServiceProcess;
5     using System.ComponentModel;
6    
7     using System.Configuration.Install;
8    
9     namespace MQFilter
10     {
11    
12     [System.ComponentModel.DesignerCategory("Code")]
13     [RunInstaller(true)]
14 torben 2179 public sealed class FilterServiceInstallerProcess : ServiceProcessInstaller
15 torben 2160 {
16 torben 2179 public FilterServiceInstallerProcess()
17 torben 2160 {
18     this.Account = ServiceAccount.LocalSystem;
19     }
20     }
21     [RunInstaller(true)]
22     public sealed class MyServiceInstaller : ServiceInstaller
23     {
24     public MyServiceInstaller()
25     {
26 torben 2179 this.Description = "DAOs MQ Filter Transport";
27     this.DisplayName = "DAO MQFilter";
28     this.ServiceName = "DaoMqFilter";
29 torben 2160 this.StartType = System.ServiceProcess.ServiceStartMode.Manual;
30     }
31    
32    
33     public static void DoInstall(bool undo, string[] args)
34     {
35     try
36     {
37     Console.WriteLine(undo ? "uninstalling" : "installing");
38    
39 torben 2162 using (AssemblyInstaller inst = new AssemblyInstaller(typeof(FilterMainProgram).Assembly, args))
40 torben 2160 {
41     IDictionary state = new Hashtable();
42     inst.UseNewContext = true;
43     try
44     {
45     if (undo)
46     {
47     inst.Uninstall(state);
48     }
49     else
50     {
51     inst.Install(state);
52     inst.Commit(state);
53     }
54     }
55     catch
56     {
57     try
58     {
59     inst.Rollback(state);
60     }
61     catch { }
62     throw;
63     }
64     }
65     }
66     catch (Exception ex)
67     {
68     Console.Error.WriteLine(ex.Message);
69     }
70     }
71     }
72     }

  ViewVC Help
Powered by ViewVC 1.1.20