/[projects]/dao/DaoMqPump2/DaoMqPump2/PumpServiceInstallerProcess.cs
ViewVC logotype

Annotation of /dao/DaoMqPump2/DaoMqPump2/PumpServiceInstallerProcess.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1986 - (hide annotations) (download)
Wed Jul 3 07:56:52 2013 UTC (10 years, 11 months ago) by torben
File size: 2122 byte(s)
Add files
1 torben 1986 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 DaoMqPump2
10     {
11    
12    
13     [RunInstaller(true)]
14     public sealed class PumpServiceInstallerProcess : ServiceProcessInstaller
15     {
16     public PumpServiceInstallerProcess()
17     {
18     this.Account = ServiceAccount.LocalSystem;
19     }
20     }
21     [RunInstaller(true)]
22     public sealed class MyServiceInstaller : ServiceInstaller
23     {
24     public MyServiceInstaller()
25     {
26     this.Description = "DAOs multi-transport MQ<->MySQL data pumpe.";
27     this.DisplayName = "DAO MQ Pump v2";
28     this.ServiceName = "DaoMqPump2";
29     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     using (AssemblyInstaller inst = new AssemblyInstaller(typeof(DaoMqPump2.MainProgram).Assembly, args))
40     {
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