Exemple #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;
        }
        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));
        }
        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;
        }
Exemple #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 => { });
            }
        }
Exemple #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;
        }
Exemple #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);
        }
        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 => { });
            }
        }
Exemple #8
0
        protected override Pipe VisitInput(InputSegment input)
        {
            WriteLine(input);

            return(base.VisitInput(input));
        }
Exemple #9
0
 public InputSegmentEditCommand(CoinKernelViewModel coinKernelVm, InputSegment segment)
 {
     this.CoinKernelVm = coinKernelVm;
     this.Segment      = segment;
 }
Exemple #10
0
 static MagnumMessenger()
 {
     myMessageBus        = PipeSegment.Input(PipeSegment.End());
     mySubscriptionScope = myMessageBus.NewSubscriptionScope();
 }
Exemple #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;
 }
 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);
     }
 }
Exemple #13
0
 public MagnumMessenger()
 {
     _messageBus        = PipeSegment.Input(PipeSegment.End());
     _subscriptionScope = _messageBus.NewSubscriptionScope();
 }
Exemple #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);
        }