// Token: 0x06000014 RID: 20 RVA: 0x0000236C File Offset: 0x0000056C
        private static int MainInternal(string[] args)
        {
            string userName = Environment.UserName;

            DagMgmtService.Tracer.TraceDebug <string>(0L, "Running as {0}", userName);
            int num = Privileges.RemoveAllExcept(DagMgmtService.requiredPrivileges);

            if (num != 0)
            {
                return(num);
            }
            Globals.InitializeSinglePerfCounterInstance();
            bool flag  = !DagMgmtService.IsRunningAsService();
            bool flag2 = false;
            bool flag3 = false;

            foreach (string text in args)
            {
                if (DagMgmtService.IsArgumentEqual(text, "-wait"))
                {
                    flag3 = true;
                }
                else
                {
                    DagMgmtService.ReportError("Invalid option specified :{0}\n", new object[]
                    {
                        text
                    });
                    flag2 = true;
                }
            }
            if (flag2)
            {
                DagMgmtService.Tracer.TraceError(0L, "Invalid argument specified. Exiting process.");
                return(1);
            }
            if (flag)
            {
                DagMgmtService.Tracer.TraceDebug <string, DateTime>(0L, "{0} Service starting in console mode at {1}", DagMgmtService.serviceName, DateTime.UtcNow);
                Console.WriteLine("Starting {0}, running in console mode.", Assembly.GetExecutingAssembly().GetName().Name);
                if (flag3)
                {
                    Console.WriteLine("Press <ENTER> to continue.");
                    Console.ReadLine();
                }
                ExServiceBase.RunAsConsole(new DagMgmtService(flag));
            }
            else
            {
                ServiceBase.Run(new DagMgmtService(flag));
            }
            return(0);
        }
 // Token: 0x06000015 RID: 21 RVA: 0x0000247C File Offset: 0x0000067C
 private static void StartServiceComponents(ComponentManager componentManager, bool useConsole)
 {
     try
     {
         componentManager.Start();
     }
     catch (ReplayCriticalComponentFailedToStartException ex)
     {
         DagMgmtService.Tracer.TraceError <string>((long)ex.ComponentName.GetHashCode(), "{0} failed to start! Exiting process.", ex.ComponentName);
         ReplayEventLogConstants.Tuple_ServiceFailedToStartComponentFailure.LogEvent(null, new object[]
         {
             ex.ComponentName
         });
         if (useConsole)
         {
             DagMgmtService.ReportError("The {0} failed to start. Please review the Application EventLog for more information. The service will now exit.", new object[]
             {
                 ex.ComponentName
             });
         }
         Environment.Exit(1);
     }
 }