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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2162 - (show annotations) (download)
Fri May 16 17:57:08 2014 UTC (10 years ago) by torben
File size: 2167 byte(s)
... compiles
1 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 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(FilterMainProgram).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