Esempio n. 1
0
        // Token: 0x0600000E RID: 14 RVA: 0x0000251C File Offset: 0x0000071C
        private bool StartServicelet(IServicelet servicelet)
        {
            bool result;

            try
            {
                if (!servicelet.IsEnabled)
                {
                    this.logger.Log(MigrationEventType.Information, "Servicelet {0} is not enabled, skipped.", new object[]
                    {
                        servicelet.Name
                    });
                    result = false;
                }
                else
                {
                    this.logger.Log(MigrationEventType.Information, "Starting servicelet {0}.", new object[]
                    {
                        servicelet.Name
                    });
                    this.logger.Log(MigrationEventType.Verbose, "Initializing servicelet.", new object[0]);
                    if (!servicelet.Initialize())
                    {
                        this.logger.Log(MigrationEventType.Verbose, "Servicelet did not initialize, not starting it.", new object[0]);
                        result = false;
                    }
                    else
                    {
                        this.logger.Log(MigrationEventType.Verbose, "Registering diagnostics interfaces.", new object[0]);
                        foreach (IDiagnosable diagnosable in servicelet.GetDiagnosableComponents())
                        {
                            ProcessAccessManager.RegisterComponent(diagnosable);
                        }
                        MigrationWorkflowServiceHost.StartServiceletThread(servicelet);
                        result = true;
                    }
                }
            }
            catch (Exception ex)
            {
                this.LogEvent(MWSEventLogConstants.Tuple_ServiceletFailedToStart, new object[]
                {
                    servicelet.Name,
                    CommonUtils.FullExceptionMessage(ex, true)
                });
                this.logger.LogError(ex, "Servicelet {0} failed to start.", new object[]
                {
                    servicelet.Name
                });
                if (!(ex is LocalizedException))
                {
                    throw;
                }
                result = false;
            }
            return(result);
        }
Esempio n. 2
0
        // Token: 0x06000008 RID: 8 RVA: 0x00002160 File Offset: 0x00000360
        public static void Main(string[] args)
        {
            MigrationWorkflowServiceHost.runningAsService = !Environment.UserInteractive;
            bool flag  = false;
            bool flag2 = false;

            foreach (string text in args)
            {
                if (text.StartsWith("-?", StringComparison.Ordinal))
                {
                    MigrationWorkflowServiceHost.Usage();
                    Environment.Exit(0);
                }
                else if (text.StartsWith("-console"))
                {
                    flag = true;
                }
                else if (text.StartsWith("-wait"))
                {
                    flag2 = true;
                }
            }
            if (!MigrationWorkflowServiceHost.runningAsService)
            {
                if (!flag)
                {
                    MigrationWorkflowServiceHost.Usage();
                    Environment.Exit(0);
                }
                Console.WriteLine("Starting {0} in console mode.", Assembly.GetExecutingAssembly().GetName().Name);
                if (flag2)
                {
                    Console.WriteLine("Press ENTER to continue.");
                    Console.ReadLine();
                }
            }
            ExWatson.Register();
            Globals.InitializeMultiPerfCounterInstance("MSExchMigWkfl");
            MigrationWorkflowServiceHost.instance = new MigrationWorkflowServiceHost();
            if (!MigrationWorkflowServiceHost.runningAsService)
            {
                ExServiceBase.RunAsConsole(MigrationWorkflowServiceHost.instance);
                return;
            }
            ServiceBase.Run(MigrationWorkflowServiceHost.instance);
        }