private static NetworkEvent ToNetworkEvent(this NodeAddedEventTransport transport)
        {
            switch (transport.NodeType)
            {
            case NODE_TYPE_GATEWAY:
                return(new NetworkEvent.NodeAdded(new Node.Gateway(
                                                      new NodeIdentifier(transport.NodeID),
                                                      new NodePosition(transport.PositionX, transport.PositionY),
                                                      transport.MakeNodeQueue(),
                                                      transport.MakeNodePortSet())));

            case NODE_TYPE_ROUTER:
                return(new NetworkEvent.NodeAdded(new Node.Router(
                                                      new NodeIdentifier(transport.NodeID),
                                                      new NodePosition(transport.PositionX, transport.PositionY),
                                                      transport.MakeNodeQueue(),
                                                      transport.MakeNodePortSet(),
                                                      transport.MakeRouterState())));

            case NODE_TYPE_CONSUMER:
                return(new NetworkEvent.NodeAdded(new Node.Consumer(
                                                      new NodeIdentifier(transport.NodeID),
                                                      new NodePosition(transport.PositionX, transport.PositionY),
                                                      transport.MakeNodeQueue(),
                                                      transport.MakeNodePortSet())));

            default: throw new Exception("NODE TYPE DOES'T EXIST");
            }
        }
 private static NodePortSet MakeNodePortSet(this NodeAddedEventTransport transport)
 {
     return(new NodePortSet(new[]
     {
         MakeNodePort(transport.TopPortDirection, transport.TopPortLinkIdentifier, transport.TopPortConnectionDirection),
         MakeNodePort(transport.BottomPortDirection, transport.BottomPortLinkIdentifier, transport.BottomPortConnectionDirection),
         MakeNodePort(transport.LeftPortDirection, transport.LeftPortLinkIdentifier, transport.LeftPortConnectionDirection),
         MakeNodePort(transport.RightPortDirection, transport.RightPortLinkIdentifier, transport.RightPortConnectionDirection)
     }));
 }
 private static NodeQueue MakeNodeQueue(this NodeAddedEventTransport transport)
 {
     return(new NodeQueue(ImmutableQueue.Create(transport.QueueContent.Select(x => new PacketIdentifier(x)).ToArray()), transport.QueueCapacity));
 }
 private static RouterState MakeRouterState(this NodeAddedEventTransport transport)
 {
     return(new RouterState(transport.RouterState.Select(x => (PortDirection)x).ToArray()));
 }