Exemplo n.º 1
0
        protected override Pipe VisitInput(InputSegment input)
        {
            if (input == null)
                return null;

            var output = input.Output;
            if (output.MessageType == _messageType && !_found)
            {
                _found = true;

                Pipe newOutput = _buildSegment(Visit(output));

                input.ReplaceOutput(output, newOutput);

                return input;
            }

            Pipe pipe = Visit(output);
            if (pipe != output)
            {
                input.ReplaceOutput(output, pipe);
            }

            return input;
        }
Exemplo n.º 2
0
        protected override Pipe VisitInput(InputSegment input)
        {
            _lastNodeVertex = GetSink(input.GetHashCode(), () => "Input", typeof(InputSegment), input.MessageType);

            if (_stack.Count > 0)
                _edges.Add(new Edge(_stack.Peek(), _lastNodeVertex, _lastNodeVertex.TargetType.Name));

            return Recurse(() => base.VisitInput(input));
        }
Exemplo n.º 3
0
        protected virtual Pipe VisitInput(InputSegment input)
        {
            if (input == null)
                return null;

            Pipe output = input.Output;

            Pipe pipe = Visit(output);
            if (pipe != output)
                input.ReplaceOutput(output, pipe);

            return input;
        }
Exemplo n.º 4
0
        public void Setup()
        {
            _addCalled = new Future<bool>();
            _removeCalled = new Future<bool>();

            _input = PipeSegment.Input(PipeSegment.End());

            _subscriberScope = _input.NewSubscriptionScope();
            _subscriberScope.Subscribe<SubscriberAdded>(x => _addCalled.Complete(true));
            _subscriberScope.Subscribe<SubscriberRemoved>(x => _removeCalled.Complete(true));

            using (var scope = _input.NewSubscriptionScope())
            {
                scope.Subscribe<ClaimModified>(x => { });
            }
        }
Exemplo n.º 5
0
        protected override Pipe VisitInput(InputSegment input)
        {
            Pipe pipe = base.VisitInput(input);

            if (pipe != input)
                throw new InvalidOperationException("The input should never change");

            if (!_bound && input.MessageType == _messageType)
            {
                CreateRecipientList(input, _messageType);
            }

            if (!_bound && input.MessageType == typeof (object))
            {
                CreateRecipientList(input, typeof (object));
            }

            return input;
        }
Exemplo n.º 6
0
        protected override Pipe VisitInput(InputSegment input)
        {
            Pipe pipe = base.VisitInput(input);

            if (pipe != input)
            {
                throw new InvalidOperationException("The input should never change");
            }

            if (!_bound && input.MessageType == _messageType)
            {
                CreateRecipientList(input, _messageType);
            }

            if (!_bound && input.MessageType == typeof(object))
            {
                CreateRecipientList(input, typeof(object));
            }

            return(input);
        }
Exemplo n.º 7
0
        public void Setup()
        {
            _addCalled = new Future<bool>();
            _removeCalled = new Future<bool>();

            _input = PipeSegment.Input(PipeSegment.End());

            _subscriberScope = _input.NewSubscriptionScope();
            _subscriberScope.Subscribe<SubscriberAdded>(x =>
                {
                    if(x.MessageType == typeof(ClaimModified))
                        _addCalled.Complete(true);
                });
            _subscriberScope.Subscribe<SubscriberRemoved>(x =>
                {
                    if (x.MessageType == typeof(ClaimModified))
                        _removeCalled.Complete(true);
                });

            using (ISubscriptionScope scope = _input.NewSubscriptionScope())
            {
                scope.Subscribe<ClaimModified>(x => { });
            }
        }
Exemplo n.º 8
0
        protected override Pipe VisitInput(InputSegment input)
        {
            WriteLine(input);

            return(base.VisitInput(input));
        }
Exemplo n.º 9
0
 public InputSegmentEditCommand(CoinKernelViewModel coinKernelVm, InputSegment segment)
 {
     this.CoinKernelVm = coinKernelVm;
     this.Segment      = segment;
 }
Exemplo n.º 10
0
 static MagnumMessenger()
 {
     myMessageBus        = PipeSegment.Input(PipeSegment.End());
     mySubscriptionScope = myMessageBus.NewSubscriptionScope();
 }
Exemplo n.º 11
0
 /// <summary>
 /// This should only be used by the local player.
 /// It assumes this input is for the latest frame.
 /// </summary>
 /// <param name="pnum">Player index</param>
 /// <param name="segment">Input data</param>
 /// <returns></returns>
 public int SaveInput(int pnum, InputSegment segment)
 {
     int frame = frames[pnum].Count;
     frames[pnum].Add(segment);
     return frame;
 }
Exemplo n.º 12
0
 public void SendGameMessage(InputSegment segment)
 {
     int frame = inputTracker.SaveInput(localPlayerNum, segment);
     byte[] data = inputTracker.GetData(localPlayerNum, frame);
     for (int i = 0; i < UDP_SEND_COUNT; ++i)
     {
         udp.SendData(data);
     }
 }
Exemplo n.º 13
0
 public MagnumMessenger()
 {
     _messageBus        = PipeSegment.Input(PipeSegment.End());
     _subscriptionScope = _messageBus.NewSubscriptionScope();
 }
Exemplo n.º 14
0
        private void CreateRecipientList(InputSegment input, Type messageType)
        {
            var recipients = input.Output.SegmentType == PipeSegmentType.End ? new Pipe[] {} : new[] {input.Output};

            Pipe list = PipeSegment.RecipientList(messageType, recipients);
            Pipe result = Visit(list);

            input.ReplaceOutput(input.Output, result);
        }