private void WriteProgress(LocalizedString activity, LocalizedString statusDescription, int percentCompleted) { ExProgressRecord exProgressRecord = new ExProgressRecord(0, activity, statusDescription); exProgressRecord.PercentComplete = percentCompleted; this.task.WriteProgress(exProgressRecord); }
private void ProcessGetContext() { TenantSyncSummary tenantSyncSummary = new TenantSyncSummary(); List <IEnumerable <TenantSyncBatchResults> > list = tenantSyncSummary.Samples as List <IEnumerable <TenantSyncBatchResults> >; this.FindTheRightCookie(); ExProgressRecord exProgressRecord = new ExProgressRecord(1, new LocalizedString("Tenant Sync"), new LocalizedString("Sync Call")); ExProgressRecord exProgressRecord2 = new ExProgressRecord(2, new LocalizedString("Sync Call"), new LocalizedString("GetContext")); 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; byte[] lastPageToken = this.PageToken; string contextId = this.ExternalDirectoryOrganizationId; List <TenantSyncBatchResults> list2 = new List <TenantSyncBatchResults>(); 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; GetContextResponse context = this.MsoSyncService.SyncProxy.GetContext(new GetContextRequest(lastCookie, contextId, lastPageToken)); TimeSpan responseTime = ExDateTime.Now - now; DirectoryObjectsAndLinks getContextResult = context.GetContextResult; if (getContextResult != null) { TenantSyncBatchResults tenantSyncBatchResults = new TenantSyncBatchResults(getContextResult); tenantSyncBatchResults.Stats.ResponseTime = responseTime; tenantSyncBatchResults.RawResponse = this.MsoSyncService.RawResponse; tenantSyncBatchResults.LastPageToken = lastPageToken; tenantSyncBatchResults.CalculateStats(); list2.Add(tenantSyncBatchResults); contextId = null; lastCookie = null; lastPageToken = getContextResult.NextPageToken; } if (getContextResult == null || !getContextResult.More) { break; } } if (list2.Last <TenantSyncBatchResults>().More) { this.WriteWarning(Strings.GetMsoDiagnosticsMoreDataIsAvailable); } exProgressRecord2.RecordType = ProgressRecordType.Completed; base.WriteProgress(exProgressRecord2); } exProgressRecord.RecordType = ProgressRecordType.Completed; base.WriteProgress(exProgressRecord); tenantSyncSummary.CalculateStats(); base.WriteObject(tenantSyncSummary); }
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); }
private void ProcessEstimateBacklog() { BacklogSummary backlogSummary = new BacklogSummary(); List <BacklogEstimateResults> list = backlogSummary.Batches as List <BacklogEstimateResults>; this.FindTheRightCookie(); ExProgressRecord exProgressRecord = new ExProgressRecord(1, new LocalizedString("Estimate Backlog"), new LocalizedString("Calling EstimateBacklog API")); byte[] latestGetChangesCookie = this.Cookie; byte[] lastPageToken = this.PageToken; for (int i = 0; i < this.MaxNumberOfBatches; i++) { exProgressRecord.CurrentOperation = Strings.GetMsoDiagnosticsProgressBatch(i + 1, this.MaxNumberOfBatches); exProgressRecord.PercentComplete = i * 100 / this.MaxNumberOfBatches; exProgressRecord.RecordType = ProgressRecordType.Processing; base.WriteProgress(exProgressRecord); ExDateTime now = ExDateTime.Now; EstimateBacklogResponse estimateBacklogResponse = this.MsoSyncService.SyncProxy.EstimateBacklog(new EstimateBacklogRequest(latestGetChangesCookie, lastPageToken)); TimeSpan responseTime = ExDateTime.Now - now; BacklogEstimateBatch estimateBacklogResult = estimateBacklogResponse.EstimateBacklogResult; if (estimateBacklogResult != null) { BacklogEstimateResults backlogEstimateResults = new BacklogEstimateResults(estimateBacklogResult); list.Add(backlogEstimateResults); backlogEstimateResults.ResponseTime = responseTime; backlogEstimateResults.RawResponse = this.MsoSyncService.RawResponse; latestGetChangesCookie = null; lastPageToken = estimateBacklogResult.NextPageToken; } if (estimateBacklogResult == null || estimateBacklogResult.StatusCode != 1) { break; } } if (list.Last <BacklogEstimateResults>().StatusCode == 1) { this.WriteWarning(Strings.GetMsoDiagnosticsMoreDataIsAvailable); } exProgressRecord.RecordType = ProgressRecordType.Completed; base.WriteProgress(exProgressRecord); backlogSummary.CalculateStats(); base.WriteObject(backlogSummary); }
internal void UpdateProgress(int progress) { TaskLogger.LogEnter(); ExProgressRecord exProgressRecord = new ExProgressRecord(0, this.Activity, Strings.MsiProgressStatus); exProgressRecord.RecordType = ProgressRecordType.Processing; exProgressRecord.PercentComplete = progress; if (!base.Stopping) { try { base.WriteProgress(exProgressRecord); } catch (PipelineStoppedException) { this.Canceled = true; } } TaskLogger.LogExit(); }
protected override IConfigurable PrepareDataObject() { CommonLoggingHelper.SyncLogSession.SetBlackBoxCapacity(NewSubscription.IncreasedBlackBoxCapacity); AutoProvisionProgress autoProvisionProgress = delegate(LocalizedString activity, LocalizedString statusDescription) { if (base.IsVerboseOn) { base.WriteVerbose(Strings.AutoProvisionDebug(activity, statusDescription)); } ExProgressRecord record = new ExProgressRecord(0, activity, statusDescription); base.WriteProgress(record); CommonLoggingHelper.SyncLogSession.LogVerbose((TSLID)1271UL, Strings.AutoProvisionDebug(activity, statusDescription), new object[0]); }; IAutoProvision[] array = this.ClientsToUse(); if (array.Length == 0) { base.WriteDebugInfoAndError(new LocalizedException(Strings.AutoProvisionNoProtocols), ErrorCategory.InvalidArgument, null); } Dictionary <Authority, bool> connectiveAuthority = NewSubscription.CheckConnectivity(array, autoProvisionProgress); PimSubscriptionProxy pimSubscriptionProxy; DiscoverSettingsResult discoverSettingsResult = NewSubscription.DiscoverSettings(array, false, connectiveAuthority, autoProvisionProgress, CommonLoggingHelper.SyncLogSession, out pimSubscriptionProxy); if (pimSubscriptionProxy == null && discoverSettingsResult != DiscoverSettingsResult.AuthenticationError && (this.Force == true || base.ShouldContinue(Strings.InsecureConfirmation))) { CommonLoggingHelper.SyncLogSession.LogVerbose((TSLID)1272UL, "Checking for in-secure option.", new object[0]); NewSubscription.DiscoverSettings(array, true, connectiveAuthority, autoProvisionProgress, CommonLoggingHelper.SyncLogSession, out pimSubscriptionProxy); } if (pimSubscriptionProxy == null) { base.WriteDebugInfoAndError(new AutoProvisionFailedException(), ErrorCategory.InvalidArgument, null); } pimSubscriptionProxy.CreationType = SubscriptionCreationType.Auto; this.DataObject = pimSubscriptionProxy; autoProvisionProgress(Strings.AutoProvisionComplete, Strings.AutoProvisionCreate); base.WriteDebugInfo(); return(base.PrepareDataObject()); }
private void ProgressUpdate(LocalizedString title, LocalizedString updateDescription) { ExProgressRecord record = new ExProgressRecord(0, title, updateDescription); base.WriteProgress(record); }
public bool WriteProgress(ExProgressRecord input, out ExProgressRecord output) { output = input; return(false); }