Exemple #1
0
 protected void Execute(string[] args, StartLocal startDebug, StopLocal stopDebug, Assembly executingAssembly)
 {
     if (args.Length > 0)
     {
         CommandArguments commandArguments = new CommandArguments();
         if (!Parser.ParseArgumentsWithUsage(args, (object)commandArguments) || !commandArguments.DoExtendedValidations())
         {
             return;
         }
         if (commandArguments.ActionType == ActionType.Debug)
         {
             ServiceBase.RunDebug(startDebug, stopDebug);
         }
         else
         {
             this.RunInstallTask(commandArguments, executingAssembly);
         }
     }
     else
     {
         System.ServiceProcess.ServiceBase.Run((System.ServiceProcess.ServiceBase[]) new ServiceBase[1]
         {
             this
         });
     }
 }
Exemple #2
0
 private static void RunDebug(StartLocal startDebug, StopLocal stopDebug)
 {
     try
     {
         if (startDebug == null)
         {
             throw new ArgumentNullException("startDebug");
         }
         if (stopDebug == null)
         {
             throw new ArgumentNullException("stopDebug");
         }
         Trace.Listeners.Add((TraceListener) new TextWriterTraceListener(Console.Out));
         Console.WriteLine("Attempting to start service. Hit Enter to stop the service");
         startDebug(new string[0]);
         Console.ReadKey();
         stopDebug();
         Trace.WriteLine("Debug finishing.");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
Exemple #3
0
 protected void Execute(string[] args, StartLocal startDebug, StopLocal stopDebug)
 {
     this.Execute(args, startDebug, stopDebug, Assembly.GetCallingAssembly());
 }