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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.2160  
changed lines
  Added in v.2175

  ViewVC Help
Powered by ViewVC 1.1.20