public DeltaSyncBatchResults(DirectoryChanges Changes) : this() { base.NextCookie = Changes.NextCookie; base.Objects = Changes.Objects; base.Links = Changes.Links; base.Contexts = Changes.Contexts; base.More = Changes.More; base.OperationResultCode = Changes.OperationResultCode; }
private void ProcessGetChanges() { DeltaSyncSummary deltaSyncSummary = new DeltaSyncSummary(); List <IEnumerable <DeltaSyncBatchResults> > list = deltaSyncSummary.Samples as List <IEnumerable <DeltaSyncBatchResults> >; this.FindTheRightCookie(); ExProgressRecord exProgressRecord = new ExProgressRecord(1, new LocalizedString("Delta Sync"), new LocalizedString("Sync Call")); ExProgressRecord exProgressRecord2 = new ExProgressRecord(2, new LocalizedString("Sync Call"), new LocalizedString("GetChanges")); exProgressRecord2.ParentActivityId = exProgressRecord.ActivityId; for (int i = 0; i < this.SampleCountForStatistics; i++) { exProgressRecord.CurrentOperation = Strings.GetMsoDiagnosticsProgressIteration(i + 1, this.SampleCountForStatistics); exProgressRecord.PercentComplete = i * 100 / this.SampleCountForStatistics; exProgressRecord.RecordType = ProgressRecordType.Processing; base.WriteProgress(exProgressRecord); byte[] lastCookie = this.Cookie; List <DeltaSyncBatchResults> list2 = new List <DeltaSyncBatchResults>(); list.Add(list2); for (int j = 0; j < this.MaxNumberOfBatches; j++) { exProgressRecord2.CurrentOperation = Strings.GetMsoDiagnosticsProgressBatch(j + 1, this.MaxNumberOfBatches); exProgressRecord2.PercentComplete = j * 100 / this.MaxNumberOfBatches; exProgressRecord2.RecordType = ProgressRecordType.Processing; base.WriteProgress(exProgressRecord2); ExDateTime now = ExDateTime.Now; GetChangesResponse changes = this.MsoSyncService.SyncProxy.GetChanges(new GetChangesRequest(lastCookie)); TimeSpan responseTime = ExDateTime.Now - now; DirectoryChanges getChangesResult = changes.GetChangesResult; if (getChangesResult != null) { DeltaSyncBatchResults deltaSyncBatchResults = new DeltaSyncBatchResults(getChangesResult); deltaSyncBatchResults.Stats.ResponseTime = responseTime; deltaSyncBatchResults.LastCookie = lastCookie; deltaSyncBatchResults.RawResponse = this.MsoSyncService.RawResponse; deltaSyncBatchResults.CalculateStats(); list2.Add(deltaSyncBatchResults); lastCookie = getChangesResult.NextCookie; } if (getChangesResult == null || !getChangesResult.More) { break; } } if (list2.Last <DeltaSyncBatchResults>().More) { this.WriteWarning(Strings.GetMsoDiagnosticsMoreDataIsAvailable); } exProgressRecord2.RecordType = ProgressRecordType.Completed; base.WriteProgress(exProgressRecord2); } exProgressRecord.RecordType = ProgressRecordType.Completed; base.WriteProgress(exProgressRecord); deltaSyncSummary.CalculateStats(); base.WriteObject(deltaSyncSummary); }
public void Append(string executingUser, byte[] cookie, NameValueCollection parameters, object response, Dictionary <SyncObject, Exception> errors) { string responseIdentity = Guid.NewGuid().ToString("N"); this.Append(BackSyncAuditLog.CreateLogRowForFirstLine(executingUser, cookie, parameters, responseIdentity)); if (response is GetChangesResponse) { DirectoryChanges getChangesResult = ((GetChangesResponse)response).GetChangesResult; this.Append <DirectoryObject>(responseIdentity, getChangesResult.Objects); this.Append <DirectoryLink>(responseIdentity, getChangesResult.Links); } else { if (!(response is GetDirectoryObjectsResponse)) { throw new NotImplementedException("Need implement writing audit log for response type: " + response.GetType().Name); } DirectoryObjectsAndLinks getDirectoryObjectsResult = ((GetDirectoryObjectsResponse)response).GetDirectoryObjectsResult; this.Append <DirectoryObject>(responseIdentity, getDirectoryObjectsResult.Objects); this.Append <DirectoryLink>(responseIdentity, getDirectoryObjectsResult.Links); this.Append <DirectoryObjectError>(responseIdentity, getDirectoryObjectsResult.Errors); } this.Append(responseIdentity, errors); }