void InitializeConfig() { try { previousConfig = new WsatConfiguration(machineName, virtualServer, null, false); previousConfig.LoadFromRegistry(); config = new WsatConfiguration(machineName, virtualServer, previousConfig, false); msdtc = config.GetMsdtcWrapper(); ConfigurationToUI(); } catch (WsatAdminException e) { HandleException(e); } }
// Execute the user's command void Run() { switch (operation) { case Operations.Change: newConfig.ValidateThrow(); if (restartRequired) { Console.WriteLine(SR.GetString(SR.InfoRestartingMSDTC)); } newConfig.Save(restartRequired); if (restartRequired) { Console.WriteLine(SR.GetString(SR.InfoRestartedMSDTC)); } if (newConfig.IsClustered) { Console.WriteLine(SR.GetString(SR.ClusterConfigUpdatedSuccessfully)); } else { Console.WriteLine(SR.GetString(SR.ConfigUpdatedSuccessfully)); } break; case Operations.None: // does nothing break; case Operations.Help: // fall through default: PrintUsage(); break; } if (operation != Operations.Change && restartRequired) { try { MsdtcWrapper msdtc = newConfig.GetMsdtcWrapper(); Console.WriteLine(SR.GetString(SR.InfoRestartingMSDTC)); msdtc.RestartDtcService(); Console.WriteLine(SR.GetString(SR.InfoRestartedMSDTC)); } catch (WsatAdminException) { throw; } #pragma warning suppress 56500 catch (Exception e) { if (Utilities.IsCriticalException(e)) { throw; } throw new WsatAdminException(WsatAdminErrorCode.DTC_RESTART_ERROR, SR.GetString(SR.ErrorRestartMSDTC), e); } } if (this.showRequired) { Console.WriteLine(); Console.WriteLine(SR.GetString(SR.ConsoleShowInformation)); Console.WriteLine(operation == Operations.Change ? this.newConfig.ToString() : this.previousConfig.ToString()); } }