public override void LoadValidationInfo() { List <string> list = ConfigValidator.CombineAttributes(this.PayloadAttributes, this.ReadAttributes); Connection orgAdConnection = null; try { ADObjectId rootId = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { orgAdConnection = new Connection(this.DataSession.GetReadConnection(null, ref rootId)); }, 3); if (!adoperationResult.Succeeded) { throw new ExDirectoryException("Unable to get read connection", adoperationResult.Exception); } int num = 0; if (base.ProgressMethod != null) { base.ProgressMethod(Strings.LoadingADComparisonList(this.configObjectName), Strings.LoadedADObjectCount(num)); } if (this.UseChangedDate) { list.Add("whenChanged"); } foreach (ExSearchResultEntry exSearchResultEntry in orgAdConnection.PagedScan(this.ADSearchPath, this.ADLdapQuery, this.searchScope, list.ToArray())) { string adrelativePath = this.GetADRelativePath(exSearchResultEntry); this.orgConfigObjectList.Add(adrelativePath, exSearchResultEntry); if (num % 500 == 0 && base.ProgressMethod != null) { base.ProgressMethod(Strings.LoadingADComparisonList(this.configObjectName), Strings.LoadedADObjectCount(num)); } num++; } if (base.ProgressMethod != null) { base.ProgressMethod(Strings.LoadingADComparisonList(this.configObjectName), Strings.LoadedADObjectCount(num)); } } finally { if (orgAdConnection != null) { orgAdConnection.Dispose(); orgAdConnection = null; } } }
public override EdgeConfigStatus Validate(EdgeConnectionInfo subscription) { this.SaveEdgeConnection(subscription); EdgeConfigStatus edgeConfigStatus = new EdgeConfigStatus(); try { List <string> list = ConfigValidator.CombineAttributes(this.PayloadAttributes, this.ReadAttributes); Dictionary <string, ExSearchResultEntry> adentries = this.GetADEntries(); bool flag = true; int num = 0; uint num2 = 0U; this.adamRootPath = DistinguishedName.Concatinate(new string[] { "CN=First Organization,CN=Microsoft Exchange,CN=Services", subscription.EdgeConnection.AdamConfigurationNamingContext }); if (base.ProgressMethod != null) { base.ProgressMethod(Strings.LoadingADAMComparisonList(this.configObjectName, subscription.EdgeServer.Name), Strings.LoadedADAMObjectCount(num)); } foreach (ExSearchResultEntry exSearchResultEntry in subscription.EdgeConnection.PagedScan(this.ADAMSearchPath, this.ADAMLdapQuery, this.searchScope, list.ToArray())) { string adamRelativePath = this.GetAdamRelativePath(exSearchResultEntry); if (adentries.ContainsKey(adamRelativePath)) { if (this.Filter(adentries[adamRelativePath])) { if (!this.CompareAttributes(exSearchResultEntry, adentries[adamRelativePath], this.PayloadAttributes) && !this.IsInChangeWindow(adentries[adamRelativePath])) { if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)edgeConfigStatus.ConflictObjects.Count)) { edgeConfigStatus.ConflictObjects.Add(new ADObjectId(adentries[adamRelativePath].DistinguishedName)); } flag = false; } else { num2 += 1U; } } else if (this.FilterEdge(exSearchResultEntry)) { if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)edgeConfigStatus.EdgeOnlyObjects.Count)) { edgeConfigStatus.EdgeOnlyObjects.Add(new ADObjectId(exSearchResultEntry.DistinguishedName)); } flag = false; } adentries.Remove(adamRelativePath); } else if (this.FilterEdge(exSearchResultEntry)) { if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)edgeConfigStatus.EdgeOnlyObjects.Count)) { edgeConfigStatus.EdgeOnlyObjects.Add(new ADObjectId(exSearchResultEntry.DistinguishedName)); } flag = false; } if (num % 500 == 0 && base.ProgressMethod != null) { base.ProgressMethod(Strings.LoadingADAMComparisonList(this.configObjectName, subscription.EdgeServer.Name), Strings.LoadedADAMObjectCount(num)); } num++; } if (base.ProgressMethod != null) { base.ProgressMethod(Strings.LoadingADAMComparisonList(this.configObjectName, subscription.EdgeServer.Name), Strings.LoadedADAMObjectCount(num)); } foreach (ExSearchResultEntry exSearchResultEntry2 in adentries.Values) { if (this.Filter(exSearchResultEntry2) && !this.IsInChangeWindow(exSearchResultEntry2)) { if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)edgeConfigStatus.OrgOnlyObjects.Count)) { edgeConfigStatus.OrgOnlyObjects.Add(new ADObjectId(exSearchResultEntry2.DistinguishedName)); } flag = false; } } edgeConfigStatus.SyncStatus = (flag ? SyncStatus.Synchronized : SyncStatus.NotSynchronized); edgeConfigStatus.SynchronizedObjects = num2; } catch (ExDirectoryException) { edgeConfigStatus.SyncStatus = SyncStatus.DirectoryError; } return(edgeConfigStatus); }