protected override void StampChangesOn(IConfigurable dataObject) { TaskLogger.LogEnter(); base.StampChangesOn(dataObject); Server server = (Server)dataObject; MailboxServer instance = this.Instance; if (!server.IsProvisionedServer) { Exception ex = null; if (string.IsNullOrEmpty(server.Fqdn)) { base.WriteError(new InvalidOperationException(Strings.ErrorInvalidObjectMissingCriticalProperty(typeof(Server).Name, server.Identity.ToString(), ServerSchema.Fqdn.Name)), ErrorCategory.ReadError, server.Identity); } if (instance.IsModified(MailboxServerSchema.Locale)) { GetMailboxServer.GetConfigurationFromRegistry(server.Fqdn, out this.oldLocale, out ex); if (ex != null) { base.WriteError(new InvalidOperationException(Strings.ErrorAccessingRegistryRaisesException(server.Fqdn, ex.Message)), ErrorCategory.ReadError, server.Identity); } } else { this.oldLocale = new CultureInfo[0]; } } else if (instance.IsModified(MailboxServerSchema.Locale)) { base.WriteError(new InvalidOperationException(Strings.ErrorInvalidOperationOnProvisionedMailboxServer), ErrorCategory.InvalidArgument, server.Identity); } if (!instance.IsModified(MailboxServerSchema.Locale)) { this.isLocalChanged = false; server.Locale = this.oldLocale; } else { server.Locale = instance.Locale; } TaskLogger.LogExit(); }
protected override void WriteResult(IConfigurable dataObject) { TaskLogger.LogEnter(new object[] { dataObject.Identity, dataObject }); MailboxServer mailboxServer = new MailboxServer((Server)dataObject); string fqdn = ((Server)dataObject).Fqdn; if (this.Status && ((Server)dataObject).IsProvisionedServer) { this.WriteWarning(Strings.StatusSpecifiedForProvisionedServer); } if (this.Status && !mailboxServer.IsReadOnly && !((Server)dataObject).IsProvisionedServer) { if (string.IsNullOrEmpty(fqdn)) { this.WriteWarning(Strings.ErrorInvalidObjectMissingCriticalProperty(typeof(Server).Name, mailboxServer.Identity.ToString(), ServerSchema.Fqdn.Name)); } else { Exception ex = null; CultureInfo[] array; GetMailboxServer.GetConfigurationFromRegistry(fqdn, out array, out ex); if (ex != null) { this.WriteWarning(Strings.ErrorAccessingRegistryRaisesException(fqdn, ex.Message)); } mailboxServer.Locale = array; mailboxServer.ResetChangeTracking(); } } base.WriteResult(mailboxServer); TaskLogger.LogExit(); }