Exemple #1
0
        public override void Execute()
        {
            var p = _inPort.Receive();

            if (p != null)
            {
                if (p.Content is bool b)
                {
                    if (_truePort.IsConnected())
                    {
                        if (b)
                        {
                            _truePort.Send(p);
                        }
                        else
                        {
                            _truePort.Close();
                        }
                    }
                    else if (_falsePort.IsConnected())
                    {
                        if (!b)
                        {
                            _falsePort.Send(p);
                        }
                        else
                        {
                            _falsePort.Close();
                        }
                    }
                    else
                    {
                        Drop(p);
                    }
                }
                else
                {
                    Drop(p);
                    FlowError.Complain("Expected IP to be a boolean value. Got: " + p.Content.GetType());
                }
            }
        }