Пример #1
0
 // Token: 0x0600003C RID: 60 RVA: 0x00002E94 File Offset: 0x00001094
 protected virtual MigrationAccount[] SelectAccountsToMigrate(long maximumAccounts, long?maximumTotalSize, int?constraintId)
 {
     for (int i = 3; i > 0; i--)
     {
         try
         {
             IMailboxReplicationProxyService mailboxReplicationProxyService = MailboxReplicationProxyClient.CreateForOlcConnection(OlcTopology.Instance.FindServerByLocalDatacenter(), ProxyControlFlags.DoNotApplyProxyThrottling);
             return(mailboxReplicationProxyService.SelectAccountsToMigrate(maximumAccounts, maximumTotalSize, constraintId));
         }
         catch (TimeoutException ex)
         {
             base.Context.Logger.Log(MigrationEventType.Warning, "Encountered timeout error when trying to make wcf call, iteration {0}", new object[]
             {
                 i,
                 ex
             });
             if (i <= 1)
             {
                 throw;
             }
         }
         catch (CommunicationException ex2)
         {
             base.Context.Logger.Log(MigrationEventType.Warning, "Encountered error when trying to make wcf call, iteration {0}", new object[]
             {
                 i,
                 ex2
             });
             if (i <= 1)
             {
                 throw;
             }
         }
     }
     return(null);
 }
Пример #2
0
 void IMailbox.Connect(MailboxConnectFlags connectFlags)
 {
     if (base.MrsProxy == null)
     {
         MailboxReplicationProxyClient   mailboxReplicationProxyClient = null;
         IMailboxReplicationProxyService iMRPS = null;
         long   handle   = 0L;
         string database = null;
         if (!this.flags.HasFlag(LocalMailboxFlags.PstExport) && (this.mbxType == MailboxType.DestMailboxCrossOrg || this.restoreType != MailboxRestoreType.None))
         {
             database = ((this.mdbGuid != Guid.Empty) ? this.mdbGuid.ToString() : this.mdbName);
         }
         try
         {
             if (this.proxyControlFlags.HasFlag(ProxyControlFlags.Olc))
             {
                 mailboxReplicationProxyClient = MailboxReplicationProxyClient.CreateForOlcConnection(this.serverName, this.proxyControlFlags);
             }
             else
             {
                 mailboxReplicationProxyClient = MailboxReplicationProxyClient.Create(this.serverName, this.remoteOrgName, this.remoteCred, this.physicalMailboxGuid, this.primaryMailboxGuid, this.filePath, database, this.partitionHint, this.useHttps, this.proxyControlFlags, this.longOperationTimeout);
             }
             if (this.requiredCapabilities != null)
             {
                 foreach (MRSProxyCapabilities mrsproxyCapabilities in this.requiredCapabilities)
                 {
                     if (!mailboxReplicationProxyClient.ServerVersion[(int)mrsproxyCapabilities])
                     {
                         MrsTracer.ProxyClient.Error("Talking to downlevel server '{0}': no {1} support", new object[]
                         {
                             mailboxReplicationProxyClient.ServerVersion.ComputerName,
                             mrsproxyCapabilities.ToString()
                         });
                         throw new UnsupportedRemoteServerVersionWithOperationPermanentException(mailboxReplicationProxyClient.ServerVersion.ComputerName, mailboxReplicationProxyClient.ServerVersion.ToString(), mrsproxyCapabilities.ToString());
                     }
                 }
             }
             if (!mailboxReplicationProxyClient.ServerVersion[24])
             {
                 this.flags &= RemoteMailbox.PreE15LocalMailboxFlags;
             }
             if ((this.flags & ~LocalMailboxFlags.StripLargeRulesForDownlevelTargets) != LocalMailboxFlags.None && !mailboxReplicationProxyClient.ServerVersion[24])
             {
                 throw new UnsupportedRemoteServerVersionWithOperationPermanentException(mailboxReplicationProxyClient.ServerName, mailboxReplicationProxyClient.ServerVersion.ToString(), "TenantHint");
             }
             if (this.mailboxContainerGuid != null && !mailboxReplicationProxyClient.ServerVersion[46])
             {
                 throw new UnsupportedRemoteServerVersionWithOperationPermanentException(mailboxReplicationProxyClient.ServerName, mailboxReplicationProxyClient.ServerVersion.ToString(), "ContainerOperations");
             }
             if ((connectFlags & MailboxConnectFlags.DoNotOpenMapiSession) != MailboxConnectFlags.None && !mailboxReplicationProxyClient.ServerVersion[11])
             {
                 throw new UnsupportedRemoteServerVersionWithOperationPermanentException(mailboxReplicationProxyClient.ServerName, mailboxReplicationProxyClient.ServerVersion.ToString(), "PostMoveCleanup");
             }
             if (this.restoreType != MailboxRestoreType.None && !mailboxReplicationProxyClient.ServerVersion[34])
             {
                 throw new UnsupportedRemoteServerVersionWithOperationPermanentException(mailboxReplicationProxyClient.ServerName, mailboxReplicationProxyClient.ServerVersion.ToString(), "IMailbox_ConfigRestore");
             }
             iMRPS = mailboxReplicationProxyClient;
             if (this.flags.HasFlag(LocalMailboxFlags.PstImport) && !mailboxReplicationProxyClient.ServerVersion[39])
             {
                 throw new UnsupportedRemoteServerVersionWithOperationPermanentException(mailboxReplicationProxyClient.ServerName, mailboxReplicationProxyClient.ServerVersion.ToString(), "Pst");
             }
             if (this.flags.HasFlag(LocalMailboxFlags.PstExport) && !mailboxReplicationProxyClient.ServerVersion[57])
             {
                 throw new UnsupportedRemoteServerVersionWithOperationPermanentException(mailboxReplicationProxyClient.ServerName, mailboxReplicationProxyClient.ServerVersion.ToString(), "RemotePstExport");
             }
             if (this.flags.HasFlag(LocalMailboxFlags.EasSync) && !mailboxReplicationProxyClient.ServerVersion[44])
             {
                 throw new UnsupportedRemoteServerVersionWithOperationPermanentException(mailboxReplicationProxyClient.ServerName, mailboxReplicationProxyClient.ServerVersion.ToString(), "Eas");
             }
             if (mailboxReplicationProxyClient.ServerVersion[46])
             {
                 handle = iMRPS.IMailbox_Config7((this.reservation != null) ? this.reservation.Id : Guid.Empty, this.primaryMailboxGuid, this.physicalMailboxGuid, (this.partitionHint != null) ? this.partitionHint.GetPersistablePartitionHint() : null, this.mdbGuid, this.mdbName, this.mbxType, (int)this.proxyControlFlags, (int)this.flags, this.mailboxContainerGuid);
             }
             else if (mailboxReplicationProxyClient.ServerVersion[41])
             {
                 handle = iMRPS.IMailbox_Config5((this.reservation != null) ? this.reservation.Id : Guid.Empty, this.primaryMailboxGuid, this.physicalMailboxGuid, (this.partitionHint != null) ? this.partitionHint.GetPersistablePartitionHint() : null, this.mdbGuid, this.mdbName, this.mbxType, (int)this.proxyControlFlags, (int)this.flags);
             }
             else if (mailboxReplicationProxyClient.ServerVersion[39])
             {
                 handle = iMRPS.IMailbox_Config6((this.reservation != null) ? this.reservation.Id : Guid.Empty, this.primaryMailboxGuid, this.physicalMailboxGuid, this.filePath, (this.partitionHint != null) ? this.partitionHint.GetPersistablePartitionHint() : null, this.mdbGuid, this.mdbName, this.mbxType, (int)this.proxyControlFlags, (int)this.flags);
             }
             else if (mailboxReplicationProxyClient.ServerVersion[37])
             {
                 handle = iMRPS.IMailbox_Config5((this.reservation != null) ? this.reservation.Id : Guid.Empty, this.primaryMailboxGuid, this.physicalMailboxGuid, (this.partitionHint != null) ? this.partitionHint.GetPersistablePartitionHint() : null, this.mdbGuid, this.mdbName, this.mbxType, (int)this.proxyControlFlags, (int)this.flags);
             }
             else
             {
                 RemoteReservation remoteReservation = this.reservation as RemoteReservation;
                 if (remoteReservation != null)
                 {
                     remoteReservation.ConfirmLegacyReservation(mailboxReplicationProxyClient);
                 }
                 if (mailboxReplicationProxyClient.ServerVersion[24])
                 {
                     handle = iMRPS.IMailbox_Config4(this.primaryMailboxGuid, this.physicalMailboxGuid, (this.partitionHint != null) ? this.partitionHint.GetPersistablePartitionHint() : null, this.mdbGuid, this.mdbName, this.mbxType, (int)this.proxyControlFlags, (int)this.flags);
                 }
                 else
                 {
                     ProxyControlFlags proxyControlFlags = this.proxyControlFlags;
                     if ((this.flags & LocalMailboxFlags.StripLargeRulesForDownlevelTargets) != LocalMailboxFlags.None)
                     {
                         proxyControlFlags |= ProxyControlFlags.StripLargeRulesForDownlevelTargets;
                     }
                     handle = iMRPS.IMailbox_Config3(this.primaryMailboxGuid, this.physicalMailboxGuid, this.mdbGuid, this.mdbName, this.mbxType, (int)proxyControlFlags);
                 }
             }
             if (!string.IsNullOrEmpty(this.preferredDomainControllerName))
             {
                 if (mailboxReplicationProxyClient.ServerVersion[48])
                 {
                     iMRPS.IMailbox_ConfigPreferredADConnection(handle, this.preferredDomainControllerName);
                 }
                 else
                 {
                     MrsTracer.ProxyClient.Warning("IMailbox_ConfigPreferredADConnection not expected to be called for server:{0} version:{1}", new object[]
                     {
                         mailboxReplicationProxyClient.ServerName,
                         mailboxReplicationProxyClient.ServerVersion.ToString()
                     });
                 }
             }
             if ((this.flags.HasFlag(LocalMailboxFlags.PstImport) || this.flags.HasFlag(LocalMailboxFlags.PstExport)) && mailboxReplicationProxyClient.ServerVersion[41])
             {
                 iMRPS.IMailbox_ConfigPst(handle, this.filePath, this.contentCodePage);
             }
             if (this.flags.HasFlag(LocalMailboxFlags.EasSync))
             {
                 if (mailboxReplicationProxyClient.ServerVersion[53])
                 {
                     iMRPS.IMailbox_ConfigEas2(handle, this.easConfiguration.UserCred.Password, this.easConfiguration.SmtpAddress, this.primaryMailboxGuid, this.easConfiguration.RemoteHostName);
                 }
                 else
                 {
                     iMRPS.IMailbox_ConfigEas(handle, this.easConfiguration.UserCred.Password, this.easConfiguration.SmtpAddress);
                 }
             }
             if (this.proxyControlFlags.HasFlag(ProxyControlFlags.Olc))
             {
                 if (!mailboxReplicationProxyClient.ServerVersion[55])
                 {
                     throw new UnsupportedRemoteServerVersionWithOperationPermanentException(mailboxReplicationProxyClient.ServerName, mailboxReplicationProxyClient.ServerVersion.ToString(), "IMailbox_ConfigOlc");
                 }
                 iMRPS.IMailbox_ConfigOlc(handle, this.olcConfig);
             }
             if (mailboxReplicationProxyClient.ServerVersion[42])
             {
                 iMRPS.IMailbox_ConfigureProxyService(new ProxyConfiguration());
             }
             if (this.restoreType != MailboxRestoreType.None)
             {
                 iMRPS.IMailbox_ConfigRestore(handle, (int)this.restoreType);
             }
             if (mailboxReplicationProxyClient.ServerVersion[11])
             {
                 iMRPS.IMailbox_Connect2(handle, (int)connectFlags);
             }
             else
             {
                 iMRPS.IMailbox_Connect(handle);
             }
             base.MrsProxy = mailboxReplicationProxyClient;
             base.Handle   = handle;
             mailboxReplicationProxyClient = null;
             handle = 0L;
         }
         finally
         {
             if (handle != 0L)
             {
                 CommonUtils.CatchKnownExceptions(delegate
                 {
                     iMRPS.CloseHandle(handle);
                 }, null);
             }
             if (mailboxReplicationProxyClient != null)
             {
                 mailboxReplicationProxyClient.Dispose();
             }
         }
     }
 }