public override void Process(ProcessingStage stage) { Debug.Assert(stage == ProcessingStage.BeforeProcessingContent); // If we don't have any bundles, early exit if (Plugin.List.Count == 0) { return; } // Collect bundles that are used by pages var bundleUsed = new HashSet <BundleObject>(); foreach (var page in Site.Pages) { // Get the bundle setup for the page, or use the default otherwise var bundleName = page.GetSafeValue <string>("bundle"); var bundle = Plugin.GetOrCreateBundle(bundleName); bundleUsed.Add(bundle); } // Compute a cache of current static files var staticFiles = new Dictionary <UPath, ContentObject>(); foreach (var staticFile in Site.StaticFiles) { staticFiles.Add(staticFile.SourceFile.Path, staticFile); } // Process bundle foreach (var bundle in bundleUsed) { ProcessBundle(bundle, staticFiles); } }
public void RecordProcessingStop(ProcessingStage processingStage) { var now = DateTime.UtcNow; var history = CurrentHistory; District.Touch(); switch (processingStage) { case ProcessingStage.Load: District.ProcessingStatus = ProcessingStatus.LoadingDone; history.LoadCompleted = now; break; case ProcessingStage.Analyze: District.ProcessingStatus = ProcessingStatus.AnalyzingDone; history.AnalyzeCompleted = now; break; case ProcessingStage.Apply: District.ProcessingStatus = ProcessingStatus.ApplyingDone; history.ApplyCompleted = now; break; default: Logger.Here().LogError($"Unexpected Processing Stage: {processingStage}"); break; } }
private void SetPresentation() { int received = OperationResults.Value[OperationResultKeys.Received].Value; int parentId = OperationResults.Value[OperationResultKeys.ParentId].Value; ProcessingStage processingStage = OperationResults.Value[OperationResultKeys.ProcessingStage].Value; switch (processingStage) { case ProcessingStage.Init: PresentationParameters[PresentationParameterKeys.Foreground].Value = KnownColor.Black; break; case ProcessingStage.WaitingForNeighbours: PresentationParameters[PresentationParameterKeys.Foreground].Value = KnownColor.DarkGreen; break; case ProcessingStage.Finished: PresentationParameters[PresentationParameterKeys.Foreground].Value = KnownColor.Blue; break; } string presenationString = ElementAttributes.Value[NetworkElement.ElementAttributeKeys.Id].Value.ToString() + "\n" + "Received : " + received.ToString() + "\n" + "Parent : " + parentId.ToString(); PresentationParameters[PresentationParameterKeys.Text].Value = presenationString; }
public string Process(string content, ProcessingStage stage, object context) { if (content == null) { return content; } string c = content; var inbound = Filters.FindAll(x => (stage & x.ProcessingStage) > 0).OrderByDescending(x => x.Priority).ToList(); inbound.ForEach(y => c = y.Process(c, context)); return c; }
public override void Process(ProcessingStage stage) { Debug.Assert(stage == ProcessingStage.BeforeProcessingContent); foreach (var menu in _menus) { if (menu.Path != null) { if (!_pages.TryGetValue(menu.Path, out ContentObject page)) { Site.Error($"Cannot find menu path {menu.Path}."); continue; } menu.Page = page; SetPageMenu(page, menu); if (!menu.Folder) { continue; } var thisDirectory = ((UPath)menu.Path).GetDirectory(); foreach (var otherMenu in _menus) { if (otherMenu == menu || otherMenu.Path == null) { continue; } var menuPath = (UPath)otherMenu.Path; if (menuPath.GetDirectory() == thisDirectory && menuPath.GetName() == MenuFileName) { otherMenu.Path = menu.Path; otherMenu.Page = page; if (menu.Parent != null) { var parentMenu = menu.Parent; var indexInParent = parentMenu.Children.IndexOf(menu); if (indexInParent >= 0 && otherMenu != parentMenu) { parentMenu.Children[indexInParent] = otherMenu; otherMenu.Parent = parentMenu; } } break; } } } } // No need to keep the list after the processing _menus.Clear(); }
private void SaveContext(ProcessingContext context) { Stage = context.Stage; ClientStream = context.ClientStream; ServerStream = context.ServerStream; RequestHeader = context.RequestHeader; ResponseHeader = context.ResponseHeader; ServerEndPoint = context.ServerEndPoint; _callbackWaitHandle.Set(); }
public string Process(string content, ProcessingStage stage, object context) { if (content == null) { return(content); } string c = content; var inbound = Filters.FindAll(x => (stage & x.ProcessingStage) > 0).OrderByDescending(x => x.Priority).ToList(); inbound.ForEach(y => c = y.Process(c, context)); return(c); }
public void DetachHandlers() { HttpProxyServer.Proxy.OnProcessingComplete = null; HttpProxyServer.Proxy.OnRequestReceived = null; HttpProxyServer.Proxy.OnResponseReceived = null; HttpProxyServer.Proxy.OnResponseSent = null; HttpProxyServer.Proxy.OnServerConnected = null; Stage = 0; ClientStream = null; ServerStream = null; RequestHeader = null; ResponseHeader = null; ServerEndPoint = null; }
public void DetachHandlers() { HttpProxyServer.Proxy.OnProcessingComplete = null; HttpProxyServer.Proxy.OnRequestReceived = null; HttpProxyServer.Proxy.OnResponseReceived = null; HttpProxyServer.Proxy.OnResponseSent = null; HttpProxyServer.Proxy.OnServerConnected = null; Stage = 0; ClientStream = null; ServerStream = null; RequestHeader = null; ResponseHeader = null; ServerEndPoint = null; }
private void Init() { InitializeComponent(); Log.InitLog(textBox, label_Cycle); // Initialize images _processingStage = new ProcessingStage(label_Status, new BitmapImage(new Uri("pack://application:,,,/3DReconstructionWPF;component/Assets/Images/icons8-crossmark.png")), new BitmapImage(new Uri("pack://application:,,,/3DReconstructionWPF;component/Assets/Images/icons8-checkmark.png")), image_trackedFeature, image_rgbColor, image_depth); _renderer = new Renderer(group); _pcv = new PointCloudView(_renderer); _sensor = KinectSensor.GetDefault(); _initialTransformation = new pointmatcher.net.EuclideanTransform { translation = System.Numerics.Vector3.Zero, rotation = System.Numerics.Quaternion.Normalize(System.Numerics.Quaternion.CreateFromRotationMatrix(new System.Numerics.Matrix4x4( 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ))) }; _icpData = new ICP.ICPData(null, _initialTransformation); _icp = new ICP(); label_Cycle.Content = "cycle: " + _cycleRuns; if (_sensor != null) { if (_sensor.IsOpen && _sensor.IsAvailable) { Log.WriteLog("Kinect capture data available!"); } } // Init filters FilterGroup.InitFilters(); }
public void RecordProcessingStart(ProcessingStage processingStage) { var now = DateTime.UtcNow; var history = CurrentHistory ?? PushHistory(); District.Touch(); switch (processingStage) { case ProcessingStage.Load: if (history.LoadStarted.HasValue || history.AnalyzeStarted.HasValue || history.ApplyStarted.HasValue) { history = PushHistory(); } District.ProcessingStatus = ProcessingStatus.Loading; history.LoadStarted = now; break; case ProcessingStage.Analyze: District.ProcessingStatus = ProcessingStatus.Analyzing; if (history.AnalyzeStarted.HasValue) { history = PushHistory(); } history.AnalyzeStarted = now; break; case ProcessingStage.Apply: District.ProcessingStatus = ProcessingStatus.Applying; if (history.ApplyStarted.HasValue) { history = PushHistory(); } history.ApplyStarted = now; break; default: Logger.Here().LogError($"Unexpected Processing Stage: {processingStage}"); break; } }
public override void Process(ProcessingStage stage) { if (stage == ProcessingStage.BeforeLoadingContent) { if (!Plugin.Enable) { return; } if (Plugin.Url == null || !UPath.TryParse(Plugin.Url, out _outputUrl) || !_outputUrl.IsAbsolute) { Site.Error($"Invalid url `{Plugin.Url}` declared for search. Search will not be generated."); return; } _excludes.Clear(); // Exclude any files that are globally excluded foreach (var excludeItem in Plugin.Excludes) { if (excludeItem is string str && UPath.TryParse(str, out var excludePath) && excludePath.IsAbsolute) { var searchPattern = excludePath.SearchPattern(); _excludes.Add(searchPattern); } } try { Initialize(); _isInitialized = true; } catch (Exception ex) { Site.Error($"Unable to initialize search processor `{Name}`. Reason: {ex.Message}"); } } else if (stage == ProcessingStage.BeforeProcessingContent) { Terminate(); } }
public override void Process(ProcessingStage stage) { Debug.Assert(stage == ProcessingStage.BeforeInitializing); // We first pre-load all data object into the site.data object var dataFolder = new DirectoryEntry(Site.MetaFileSystem, DataFolder); if (dataFolder.Exists) { foreach (var fileInfo in dataFolder.EnumerateFiles("*", SearchOption.AllDirectories)) { var dataObject = GetDataObject(fileInfo.Directory, dataFolder); foreach (var loader in Plugin.DataLoaders) { if (loader.CanHandle(fileInfo.ExtensionWithDot)) { try { object result = loader.Load(fileInfo); var nameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.Name); // If a datafile has been already loaded, we have probably something wrong // (Typically a folder or file loaded with the same name without the extension) if (dataObject.ContainsKey(nameWithoutExtension)) { Site.Warning($"Cannot load the data file [{fileInfo}] as there is already an entry with the same name [{nameWithoutExtension}]"); } else { dataObject[nameWithoutExtension] = result; } } catch (Exception ex) { Site.Error(ex, $"Error while loading data file [{fileInfo}]. Reason: {ex.GetReason()}"); } } } } } }
private bool TryRunProcess(IEnumerable <ISiteProcessor> processors, ProcessingStage stage) { var statistics = Site.Statistics; // Callback plugins once files have been initialized but not yet processed int i = 0; var clock = Stopwatch.StartNew(); foreach (var processor in processors) { var stat = statistics.GetPluginStat(processor); stat.Order = i; clock.Restart(); try { processor.Process(stage); } catch (Exception exception) { if (exception is LunetException) { Site.Error($"Unexpected error in processor {processor.Name}. Reason: {exception.Message}"); } else { Site.Error(exception, $"Unexpected error in processor {processor.Name}. Reason: {exception.Message}"); } return(false); } finally { clock.Stop(); stat.BeginProcessTime = clock.Elapsed; } i++; } return(true); }
public override void Process(ProcessingStage stage) { if (!Plugin.Enable) { return; } if (stage == ProcessingStage.BeforeLoadingContent) { _urlSet = new SitemapUrlSet(); } else if (stage == ProcessingStage.BeforeProcessingContent) { const string ns = "http://www.sitemaps.org/schemas/sitemap/0.9"; var xmlSerializer = new XmlSerializer(typeof(SitemapUrlSet), ns); var namespaces = new XmlSerializerNamespaces(); namespaces.Add("", ns); var sitemap = new Utf8StringWriter(); xmlSerializer.Serialize(sitemap, _urlSet, namespaces); // Generate sitemap.xml var content = new DynamicContentObject(Site, "/sitemap.xml") { ContentType = ContentType.Xml, Content = sitemap.ToString() }; Site.DynamicPages.Add(content); // Generate robots.txt var robotsContent = new DynamicContentObject(Site, "/robots.txt") { ContentType = ContentType.Txt, Content = $"Sitemap: {Site.Builtins.UrlRef((ContentObject)null, content.Url)}" }; Site.DynamicPages.Add(robotsContent); } }
public void RecordProcessingError(string message, ProcessingStage processingStage) { DataSyncHistory history = CurrentHistory; if (history == null) { Logger.Here().LogError($"No current history. Developer: create History record before Processing."); return; } switch (processingStage) { case ProcessingStage.Load: CurrentHistory.LoadError = message; break; case ProcessingStage.Analyze: CurrentHistory.AnalyzeError = message; break; case ProcessingStage.Apply: CurrentHistory.ApplyError = message; break; default: Logger.Here().LogError($"Unexpected Processing Stage in exception: {processingStage}"); break; } }
/// <summary> /// Process the specific stage and handle the errors /// </summary> /// <param name="processingStage">Stage to process</param> /// <returns>true iff successfully processed with error causing process to stop</returns> private async Task <bool> ProcessStage(ProcessingStage processingStage) { try { Repo.RecordProcessingStart(processingStage); await Repo.Committer.Invoke(); switch (processingStage) { case ProcessingStage.Load: await Load(); return(true); case ProcessingStage.Analyze: await Analyze(); return(true); case ProcessingStage.Apply: await Apply(); return(true); default: return(false); } } catch (Exception ex) { RefreshContext(); var pe = (ex as ProcessingException) ?? new ProcessingException(Logger.Here(), $"Unhandled processing error. {ex.Message}", ex); Repo.RecordProcessingError(pe.Message, processingStage); await Repo.Committer.Invoke(); return(false); } finally { RefreshContext(); Repo.RecordProcessingStop(processingStage); await Repo.Committer.Invoke(); } }
public override void Process(ProcessingStage stage) { Debug.Assert(stage == ProcessingStage.BeforeProcessingContent); foreach (var taxonomy in List.ScriptObject) { var name = taxonomy.Key; var value = taxonomy.Value; string singular = null; string url = null; ScriptObject map = null; switch (value) { case string valueAsStr: singular = valueAsStr; break; case ScriptObject valueAsObj: singular = valueAsObj.GetSafeValue <string>("singular"); url = valueAsObj.GetSafeValue <string>("url"); map = valueAsObj.GetSafeValue <ScriptObject>("map"); break; case IScriptCustomFunction _: // Skip functions (clear...etc.) continue; } if (string.IsNullOrWhiteSpace(singular)) { // Don't log an error, as we just want to Site.Error($"Invalid singular form [{singular}] of taxonomy [{name}]. Expecting a non empty string"); continue; } // TODO: verify that plural is a valid identifier var tax = Find(name); if (tax != null) { continue; } List.Add(new Taxonomy(this, name, singular, url, map)); } // Convert taxonomies to readonly after initialization List.ScriptObject.Clear(); foreach (var taxonomy in List) { List.ScriptObject.SetValue(taxonomy.Name, taxonomy, true); } foreach (var page in Site.Pages) { var dyn = (DynamicObject)page; foreach (var tax in List) { var termsObj = dyn[tax.Name]; var terms = termsObj as ScriptArray; if (termsObj == null) { continue; } if (terms == null) { Site.Error("Invalid type"); continue; } foreach (var termNameObj in terms) { var termName = termNameObj as string; if (termName == null) { Site.Error("// TODO ERROR ON TERM"); continue; } object termObj; TaxonomyTerm term; if (!tax.Terms.TryGetValue(termName, out termObj)) { termObj = term = new TaxonomyTerm(tax, termName); tax.Terms[termName] = termObj; } else { term = (TaxonomyTerm)termObj; } term.Pages.Add(page); } } } // Update taxonomy computed foreach (var tax in List) { tax.Update(); } // Generate taxonomy pages foreach (var tax in List) { UPath.TryParse(tax.Url, out var taxPath); var section = taxPath.GetFirstDirectory(out var pathInSection); bool hasTerms = false; // Generate a term page for each term in the current taxonomy foreach (var term in tax.Terms.Values.OfType <TaxonomyTerm>()) { // term.Url var content = new DynamicContentObject(Site, term.Url, section) { ScriptObjectLocal = new ScriptObject(), // only used to let layout processor running Layout = tax.Name, LayoutType = "term", ContentType = ContentType.Html }; content.ScriptObjectLocal.SetValue("pages", term.Pages, true); content.ScriptObjectLocal.SetValue("taxonomy", tax, true); content.ScriptObjectLocal.SetValue("term", term, true); foreach (var page in term.Pages) { content.Dependencies.Add(new PageContentDependency(page)); } content.Initialize(); Site.DynamicPages.Add(content); hasTerms = true; } // Generate a terms page for the current taxonomy if (hasTerms) { var content = new DynamicContentObject(Site, tax.Url, section) { ScriptObjectLocal = new ScriptObject(), // only used to let layout processor running Layout = tax.Name, LayoutType = "terms", ContentType = ContentType.Html }; content.ScriptObjectLocal.SetValue("taxonomy", tax, true); content.Initialize(); // TODO: Add dependencies Site.DynamicPages.Add(content); } } }
public bool HasStage(ProcessingStage stage) { return Filters.Exists(x => (stage & x.ProcessingStage) > 0); }
public override void ReportExcludedObject(PropertyBag propertyBag, DirectoryObjectErrorCode errorCode, ProcessingStage processingStage) { base.ReportExcludedObject(propertyBag, errorCode, processingStage); DirectoryObjectClass directoryObjectClass = DirectoryObjectClass.Account; if (propertyBag.Contains(ADObjectSchema.ObjectClass)) { directoryObjectClass = SyncRecipient.GetRecipientType(propertyBag); } ADObjectId adObjectId = (ADObjectId)propertyBag[ADObjectSchema.Id]; string objectId = (string)propertyBag[SyncObjectSchema.ObjectId]; this.verboseLoggingDelegate(Strings.BackSyncObjectExcludedExtended(directoryObjectClass, objectId, adObjectId, errorCode, processingStage)); }
public override void ReportExcludedObject(SyncObjectId objectId, DirectoryObjectErrorCode errorCode, ProcessingStage processingStage) { base.ReportExcludedObject(objectId, errorCode, processingStage); this.verboseLoggingDelegate(Strings.BackSyncObjectExcluded(objectId.ToString(), errorCode, processingStage)); }
public PonyTextException(ProcessingStage stage, string cause) { this.stage = stage; this.cause = cause; }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// \fn public override void ReceiveHandling(EchoImprovedMessage message) /// /// \brief Receive handling. /// /// \brief #### Description. /// -# This method is activated when a new message arrived to the process /// -# The method processing is done according to theire arrival order /// -# If you want to change the order of processing save the messages In an OperationResult attribute /// and then when you want to activate it process it befor procesing the message that is given /// to this method as a parameter /// /// \brief #### Algorithm. /// /// \brief #### Usage Notes. /// Usually the algorithm of this method is: /// -# if message type is ... perform ... /// -# if message type is ... perform ... /// /// \author Ilan Hindy /// \date 26/01/2017 /// /// \param message The message. //////////////////////////////////////////////////////////////////////////////////////////////////// public override void ReceiveHandling(BaseMessage message) { //base.ReceiveHandling(message); // Get the values from the attributes int received = OperationResults.Value[OperationResultKeys.Received].Value; int parentId = OperationResults.Value[OperationResultKeys.ParentId].Value; bool initiator = ElementAttributes.Value[BaseProcess.ElementAttributeKeys.Initiator].Value; ProcessingStage processingStage = OperationResults.Value[OperationResultKeys.ProcessingStage].Value; // Get the values from the message int senderId = message[ElementDictionaries.ElementAttributes].Value[EchoImprovedMessage.HeaderFieldKeys.SourceProcess].Value; // Implement the algorithm received++; // Handle initializing of none initiator if (parentId == -1 && initiator == false) { parentId = senderId; // If the process is a leaf send return message // Else send message to all neighbours if (received < OutGoingChannels.Count) { SendToNeighbours(message, new List <int>() { parentId }); processingStage = ProcessingStage.WaitingForNeighbours; } else { SendMessage(parentId); processingStage = ProcessingStage.Finished; } } // Handle end algorithm detection and processing else { if (received == OutGoingChannels.Count - 1) { if (initiator == false) { SendMessage(parentId); processingStage = ProcessingStage.Finished; } else { Terminate(); processingStage = ProcessingStage.Finished; } } } // Setting the attributes OperationResults.Value[OperationResultKeys.Received].Value = received; OperationResults.Value[OperationResultKeys.ParentId].Value = parentId; OperationResults.Value[OperationResultKeys.ProcessingStage].Value = processingStage; SetPresentation(); }
abstract public void SetProcessingStage(ProcessingStage processingStage);
private static void LogExcludedObject(string objectId, DirectoryObjectErrorCode errorCode, ProcessingStage processingStage) { ExTraceGlobals.BackSyncTracer.TraceDebug <string, DirectoryObjectErrorCode, ProcessingStage>((long)Thread.CurrentThread.ManagedThreadId, "Object '{0}' excluded from backsyc stream. Reason: {1}. Stage: {2}", objectId, errorCode, processingStage); }
public bool HasStage(ProcessingStage stage) { return(Filters.Exists(x => (stage & x.ProcessingStage) > 0)); }
public override void ReportExcludedObject(PropertyBag propertyBag, DirectoryObjectErrorCode errorCode, ProcessingStage processingStage) { SyncObjectId syncObjectId = FullSyncObjectErrorReporter.GetSyncObjectId(propertyBag); if (syncObjectId != null) { this.ReportExcludedObject(syncObjectId, errorCode, processingStage); return; } base.ReportExcludedObject(propertyBag, errorCode, processingStage); DirectoryObjectError directoryObjectError = new DirectoryObjectError(); directoryObjectError.ErrorCode = errorCode; directoryObjectError.ObjectId = (string)propertyBag[SyncObjectSchema.ObjectId]; if (propertyBag.Contains(ADObjectSchema.ObjectClass)) { directoryObjectError.ObjectClass = SyncRecipient.GetRecipientType(propertyBag); } if (propertyBag.Contains(SyncObjectSchema.ContextId)) { directoryObjectError.ContextId = (string)propertyBag[SyncObjectSchema.ContextId]; } this.errors.Add(directoryObjectError); if (this.performanceCounterSession != null) { this.performanceCounterSession.IncrementUserError(); } }
public UploadingResponseModel GenerateResponse(XmlDocument xml) { UploadingResponseModel model = new UploadingResponseModel(); XmlElement root = xml?.DocumentElement; XmlNode userInfoNode = root?.SelectSingleNode("user-info"); if (userInfoNode != null) { model.UserInfo = new UserInfo { UserId = Convert.ToInt32(userInfoNode?.Attributes["user-id"]?.Value), UserName = userInfoNode?.Attributes["user-name"]?.Value, ClientId = Convert.ToInt32(userInfoNode?.Attributes["client-id"]?.Value), ClientName = userInfoNode?.Attributes["client-name"]?.Value, CertificateId = userInfoNode?.Attributes["certificate-id"]?.Value, RemoteAdress = userInfoNode?.Attributes["remote-address"]?.Value }; } XmlNode packageInfoNode = root?.SelectSingleNode("package-info"); if (packageInfoNode != null) { model.PackageInfo = new PackageInfo { PackageType = Convert.ToInt32(packageInfoNode?.Attributes["package-type"]?.Value), PackageFileSize = Convert.ToInt32(packageInfoNode?.Attributes["package-file-size"]?.Value), PackageDocumentCount = Convert.ToInt32(packageInfoNode?.Attributes["package-document-count"]?.Value), ProcessingId = Convert.ToInt32(packageInfoNode?.Attributes["processing-id"]?.Value), ProcessingStatus = Convert.ToInt32(packageInfoNode?.Attributes["processing-status"]?.Value), UploadId = packageInfoNode?.Attributes["upload-id"]?.Value, UploadStartDateTime = packageInfoNode?.Attributes["upload-start-datetime"]?.Value, UploadFinishDateTime = packageInfoNode?.Attributes["upload-finish-datetime"]?.Value, SourceFileName = packageInfoNode?.Attributes["source-file-name"]?.Value, ProcessingStartDateTime = packageInfoNode?.Attributes["processing-start-datetime"]?.Value, ProcessingFinishDateTime = packageInfoNode?.Attributes["processing-finish-datetime"]?.Value, }; } model.Documents = new List <Document>(); foreach (XmlNode documentNode in root?.SelectNodes("document")) { Document doc = new Document { PropcessingStatus = Convert.ToInt32(documentNode?.Attributes["processing-status"]?.Value), FileSize = Convert.ToInt32(documentNode?.Attributes["file-size"]?.Value), FormatType = documentNode?.Attributes["format-type"]?.Value, FormatVersion = documentNode?.Attributes["format-version"]?.Value, FileName = documentNode?.Attributes["file-name"]?.Value, }; doc.ProcessingStages = new List <ProcessingStage>(); foreach (XmlNode stageNode in documentNode?.SelectNodes("processing-stage")) { ProcessingStage processingStage = new ProcessingStage { Id = Convert.ToInt32(stageNode?.Attributes["id"]?.Value), Description = stageNode?.Attributes["description"]?.Value, ProcessingStatus = Convert.ToInt32(stageNode?.Attributes["processing-status"]?.Value), Summaries = new List <Summary>(), Errors = new List <Error>(), Warnings = new List <Warning>() }; foreach (XmlNode summaryNode in stageNode.SelectNodes("summary")) { Summary summary = new Summary { WarningCounts = new List <SummaryCount>(), ErorCounts = new List <SummaryCount>(), ForElementType = summaryNode?.Attributes["for-element-type"]?.Value, TotalElementCount = Convert.ToInt32(summaryNode?.Attributes["total-elements-count"]?.Value), ProcessedElementsCount = Convert.ToInt32(summaryNode?.Attributes["processed-elements-count"]?.Value) }; foreach (XmlNode errorNode in summaryNode?.SelectNodes("error-count")) { summary.ErorCounts.Add(new SummaryCount { Code = Convert.ToInt32(errorNode?.Attributes["code"]?.Value), Count = Convert.ToInt32(errorNode?.Attributes["count"]?.Value) }); } foreach (XmlNode errorNode in summaryNode?.SelectNodes("warning-count")) { summary.WarningCounts.Add(new SummaryCount { Code = Convert.ToInt32(errorNode?.Attributes["code"]?.Value), Count = Convert.ToInt32(errorNode?.Attributes["count"]?.Value) }); } processingStage.Summaries.Add(summary); } foreach (XmlNode errorNode in stageNode.SelectNodes("error")) { processingStage.Errors.Add(new Error { Code = Convert.ToInt32(errorNode?.Attributes["code"]?.Value), SourceDataId = errorNode?.Attributes["source-data-id"]?.Value }); } foreach (XmlNode warningNode in stageNode.SelectNodes("warning")) { processingStage.Warnings.Add(new Warning { Code = Convert.ToInt32(warningNode?.Attributes["code"]?.Value), SourceDataId = warningNode?.Attributes["source-data-id"]?.Value }); } doc.ProcessingStages.Add(processingStage); } model.Documents.Add(doc); } return(model); }
private void SaveContext(ProcessingContext context) { Stage = context.Stage; ClientStream = context.ClientStream; ServerStream = context.ServerStream; RequestHeader = context.RequestHeader; ResponseHeader = context.ResponseHeader; ServerEndPoint = context.ServerEndPoint; _callbackWaitHandle.Set(); }
public virtual void Process(ProcessingStage stage) { }
public virtual void ReportExcludedObject(PropertyBag propertyBag, DirectoryObjectErrorCode errorCode, ProcessingStage processingStage) { ExcludedObjectReporter.LogExcludedObject(ExcludedObjectReporter.GetId(propertyBag), errorCode, processingStage); }
public override void SetProcessingStage(ProcessingStage processingStage) { _processingStage = processingStage; }
public virtual void ReportExcludedObject(SyncObjectId objectId, DirectoryObjectErrorCode errorCode, ProcessingStage processingStage) { ExcludedObjectReporter.LogExcludedObject(objectId.ToString(), errorCode, processingStage); }
protected ProcessingStepBase(ProcessingStage stage) { this.Stage = stage; }
/// <summary> /// Interrupt processing current request /// </summary> public void StopProcessing() { Stage = ProcessingStage.Completed; }
private void setProcessingStageState(ProcessingStage processingStage, CheckState checkState) { //If we're currently in a worker thread, call this method on the GUI thread if(checkListProcessingStages.InvokeRequired) { setProcessingStageStateCallback callback = new setProcessingStageStateCallback(setProcessingStageState); //Run the function again (passed as a delegate) on the GUI using the Invoke method this.Invoke(callback, new object[] { processingStage, checkState }); } else //Otherwise we're on a thread in charge of the Form, manipulate it { //If this is an actually Processing Stage (not All), update the CheckList if(processingStage != ProcessingStage.All) { //Get what the Item text should be for this ProcessingStage string strProcessingStage = PROCESSING_STAGE_NAMES[processingStage]; //Find the Item specified by it's name for (int i = 0; i < checkListProcessingStages.Items.Count; i++) { object item = checkListProcessingStages.Items[i]; string itemText = checkListProcessingStages.GetItemText(item); //If this is the item we're looking for if (itemText == strProcessingStage) { //Set this item to the state specified checkListProcessingStages.SetItemCheckState(i, checkState); //Look no further break; } } } //Handle timing for each stage //Get the Stopwatch for this Processing stage Stopwatch stopwatch = processingStageStopwatches[processingStage]; //If the stage has finished if(checkState == CheckState.Checked) { stopwatch.Stop(); //Display the time taken for this stage log(String.Format("{0} took {1}ms to complete", PROCESSING_STAGE_NAMES[processingStage], stopwatch.ElapsedMilliseconds)); //If we were timing all of the processing, put the time in the status bar if(processingStage == ProcessingStage.All) { setProcessingTimeLabel(stopwatch.ElapsedMilliseconds); } } else //Otherwise the stage is starting, start timing { stopwatch.Restart(); } } }