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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2161 - (hide annotations) (download)
Fri May 16 16:05:47 2014 UTC (10 years ago) by torben
File size: 2649 byte(s)
Codesync

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    
13 torben 2160 namespace MQFilter
14     {
15     class FilterMainProgram
16     {
17     static void Main(string[] args)
18     {
19 torben 2161
20     if (args.Length == 1)
21     {
22     if (args[0] == "--debug")
23     {
24     try
25     {
26    
27    
28     TransportController controller = TransportController.getInstance();
29    
30     ElapsedTimer timer = new ElapsedTimer();
31     controller.transportAllMessages();
32    
33     timer.stopAndPrint("debug run");
34    
35     }
36     catch (Exception e)
37     {
38     Console.WriteLine("Error: " + e.Message);
39     }
40    
41    
42    
43    
44    
45     Console.WriteLine("Press any key to continue");
46     Console.ReadKey(); //wait for user input
47     }
48     else if (args[0] == "/i" || args[0] == "/u")
49     {
50    
51     bool undo;
52     if (args[0] == "/i")
53     {
54     undo = false;
55     }
56     else
57     {
58     undo = true;
59     }
60     MyServiceInstaller.DoInstall(undo, new string[] { });
61     }
62     else
63     {
64     Console.WriteLine("MQFilter by THN");
65     Console.WriteLine("Options:");
66     Console.WriteLine(" --debug start a single run debug session");
67     Console.WriteLine(" /i install as a service");
68     Console.WriteLine(" /u un-install service");
69     }
70    
71     }
72     else
73     {
74     PumpService service = new PumpService();
75    
76    
77     // now run all the service that we have created.
78     // This doesn't actually cause the services
79     // to run but it registers the services with the
80     // Service Control Manager so that it can
81     // when you start the service the SCM will call
82     // the OnStart method of the service.
83    
84     ServiceBase.Run(service);
85     }
86    
87 torben 2160 }
88 torben 2161
89 torben 2160 }
90     }

  ViewVC Help
Powered by ViewVC 1.1.20