Пример #1
0
        /// <summary>
        /// Iterate on childrens and apply the specified transform function.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="nodeProcessor">The process.</param>
        /// <param name="listProcessor">The list processor. Default is null using default implementation.</param>
        /// <returns>The source node</returns>
        public static Node Childrens(this Node node, NodeProcessor nodeProcessor, NodeListProcessor listProcessor = null)
        {
            if (node == null)
            {
                return(null);
            }

            var type    = node.GetType();
            var process = RegisteredProcessors.GetOrAdd(type, BuildChildrensIterator);

            if (listProcessor == null)
            {
                listProcessor = DefaultListProcessor;
            }
            var context = new NodeProcessorContext(nodeProcessor, listProcessor);

            return(process(node, ref context));
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NodeProcessorContext"/> class.
 /// </summary>
 /// <param name="nodeProcessor">The node processor.</param>
 /// <param name="listProcessor">The list processor.</param>
 public NodeProcessorContext(NodeProcessor nodeProcessor, NodeListProcessor listProcessor)
 {
     NodeProcessor = nodeProcessor;
     ListProcessor = listProcessor;
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NodeProcessorContext"/> class.
 /// </summary>
 /// <param name="nodeProcessor">The node processor.</param>
 /// <param name="listProcessor">The list processor.</param>
 public NodeProcessorContext(NodeProcessor nodeProcessor, NodeListProcessor listProcessor)
 {
     NodeProcessor = nodeProcessor;
     ListProcessor = listProcessor;
 }