private void Run()
            {
                //bool debugging = false;
                //while (!debugging)
                //    Thread.Sleep(100);

                var wtr = new EventLogWriter(ServiceName);

                try
                {
                    wtr.WriteLine("Service initializing...");
                    _ci.Run(_arguments, wtr, wtr, new BlockingReader(_shutdown));
                }
                catch (Exception e)
                {
                    try
                    {
                        wtr.WriteLine(e.ToString());
                    }
                    catch
                    {
                    }
                }
                finally
                {
                    if (_shutdown.WaitOne(0, false) == false)
                    {
                        wtr.WriteLine("The command unexpectedly terminated.");
                        Environment.Exit(1);
                    }
                }
            }
Beispiel #2
0
 [AliasName("")]             // <= ignored if null or empty
 public void Hidden(ICommandInterpreter ci, [AllArguments] string[] args)
 {
     Console.WriteLine("Hidden Runs: {0}", String.Join(" ", args));
     ci.Run(args);
 }