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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2178 - (hide annotations) (download)
Tue May 20 20:00:10 2014 UTC (10 years ago) by torben
File size: 2669 byte(s)
Test time + Timestamp
1 torben 2160 using System;
2     using System.Collections.Generic;
3     using System.Text;
4    
5 torben 2161 using System.ServiceProcess;
6     using System.Diagnostics;
7    
8     using System.Configuration.Install;
9     using System.Collections.Specialized;
10     using System.Runtime.InteropServices;
11    
12 torben 2162 using DaoCommon;
13 torben 2175 using IBM.WMQ;
14 torben 2161
15 torben 2162
16 torben 2160 namespace MQFilter
17     {
18     class FilterMainProgram
19     {
20     static void Main(string[] args)
21     {
22 torben 2161
23 torben 2178
24     if (args.Length == 1)
25 torben 2161 {
26     if (args[0] == "--debug")
27 torben 2178 {
28 torben 2161 try
29     {
30    
31 torben 2178
32 torben 2162 FilterController controller = FilterController.getInstance();
33 torben 2161
34     ElapsedTimer timer = new ElapsedTimer();
35     controller.transportAllMessages();
36    
37     timer.stopAndPrint("debug run");
38    
39     }
40     catch (Exception e)
41     {
42 torben 2175
43 torben 2161 Console.WriteLine("Error: " + e.Message);
44 torben 2175 Console.WriteLine(e.StackTrace);
45 torben 2161 }
46    
47    
48    
49    
50 torben 2178
51 torben 2161 Console.WriteLine("Press any key to continue");
52     Console.ReadKey(); //wait for user input
53 torben 2178 }
54 torben 2161 else if (args[0] == "/i" || args[0] == "/u")
55     {
56    
57     bool undo;
58     if (args[0] == "/i")
59     {
60     undo = false;
61     }
62     else
63     {
64     undo = true;
65     }
66 torben 2178 MyServiceInstaller.DoInstall(undo, new string[] { });
67 torben 2161 }
68     else
69     {
70     Console.WriteLine("MQFilter by THN");
71     Console.WriteLine("Options:");
72     Console.WriteLine(" --debug start a single run debug session");
73     Console.WriteLine(" /i install as a service");
74     Console.WriteLine(" /u un-install service");
75     }
76    
77     }
78     else
79     {
80     PumpService service = new PumpService();
81    
82    
83     // now run all the service that we have created.
84     // This doesn't actually cause the services
85     // to run but it registers the services with the
86     // Service Control Manager so that it can
87     // when you start the service the SCM will call
88     // the OnStart method of the service.
89    
90     ServiceBase.Run(service);
91     }
92    
93 torben 2160 }
94 torben 2161
95 torben 2160 }
96     }

  ViewVC Help
Powered by ViewVC 1.1.20