Пример #1
0
        private void OnConditionEntry(string key, string symbol, string value)
        {
            if (blockSource)
            {
                switch (key)
                {
                case "==":
                    _blockProcessorPipelineBuilder.AddElement(
                        new PipelineElement <Block, Block>(
                            condition: (b => b.GetType().GetProperty(key).GetValue(b).ToString() == value),
                            transformData: (b => b)
                            )
                        );
                    return;

                case "!=":
                    _blockProcessorPipelineBuilder.AddElement(
                        new PipelineElement <Block, Block>(
                            condition: (b => b.GetType().GetProperty(key).GetValue(b).ToString() != value),
                            transformData: (b => b)
                            )
                        );
                    return;

                case ">":
                    _blockProcessorPipelineBuilder.AddElement(
                        new PipelineElement <Block, Block>(
                            condition: (b => (UInt256)b.GetType().GetProperty(key).GetValue(b) > UInt256.Parse(value)),
                            transformData: (b => b)
                            )
                        );
                    return;

                case "<":
                    _blockProcessorPipelineBuilder.AddElement(
                        new PipelineElement <Block, Block>(
                            condition: (b => (UInt256)b.GetType().GetProperty(key).GetValue(b) < UInt256.Parse(value)),
                            transformData: (b => b)
                            )
                        );
                    return;

                case ">=":
                    _blockProcessorPipelineBuilder.AddElement(
                        new PipelineElement <Block, Block>(
                            condition: (b => (UInt256)b.GetType().GetProperty(key).GetValue(b) >= UInt256.Parse(value)),
                            transformData: (b => b)
                            )
                        );
                    return;

                case "<=":
                    _blockProcessorPipelineBuilder.AddElement(
                        new PipelineElement <Block, Block>(
                            condition: (b => (UInt256)b.GetType().GetProperty(key).GetValue(b) <= UInt256.Parse(value)),
                            transformData: (b => b)
                            )
                        );
                    return;
                }
            }
        }