// Token: 0x06000011 RID: 17 RVA: 0x000022AC File Offset: 0x000004AC
        public static void Main(string[] args)
        {
            ExWatson.Register();
            int num = DagMgmtService.MainInternal(args);

            if (num != 0)
            {
                DagMgmtService.Tracer.TraceError <int>(0L, "Exiting process with error code {0}", num);
                Environment.Exit(num);
            }
        }
        // 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);
     }
 }
 // Token: 0x06000012 RID: 18 RVA: 0x000022E0 File Offset: 0x000004E0
 protected override void OnStartInternal(string[] args)
 {
     DagMgmtService.Tracer.TraceDebug <string>((long)this.GetHashCode(), "{0} service is starting up: OnStartInternal() called", base.ServiceName);
     base.ExRequestAdditionalTime(120000);
     DagMgmtService.StartServiceComponents(DagComponentManager.Instance, this.runFromConsole);
 }