static void Adapter_OnUdpReceivedPacketEvent(Packet packet)
 {
     if (packet.Socket.RemotePort == 123)
     {
         var transitTime = Utility.ExtractRangeFromArray(packet.Content, 40, 8);
         Microsoft.SPOT.Trace.Print("Current UTC Date/Time is " + transitTime.ToDateTime());
     }
 }
Esempio n. 2
0
        public bool transmit(Packet p, Point point)
        {
            if ((p != null) && !transmitting)
            {
                intransit = p;
                p.position = new Vector2(point.X, point.Y);

                return true;
            }
            else
                return false;
        }
Esempio n. 3
0
 public bool transmit(Packet packet)
 {
     if ((packet != null) && !transmitting)
     {
         intransit = packet;
         packet.position = startPosition;
         return true;
     }
     else
         return false;
 }
Esempio n. 4
0
 void _con_OnConnectionPacketReceived(Packet packet)
 {
     _responseToSend = new HttpResponse(packet.Content, omitContent);
     responseWaitHandle.Set();
 }
Esempio n. 5
0
 internal void FireOnConnectionPacketReceived(Packet packet)
 {
     if (OnConnectionPacketReceived != null) OnConnectionPacketReceived(packet);
 }
Esempio n. 6
0
        public void send(Packet p, GraphNode startNode)
        {
            if (startNode.Equals(NeighborOne))
            {
                p.OnLine = true;
                outgoing.transmit(p);
                outgoing.finished = false;

            }
            else
            {
                p.OnLine = true;
                ingoing.transmit(p);
                ingoing.finished = false;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            font = this.Content.Load<SpriteFont>("Arial");
            fields = new Fields(spriteBatch, graphics);
            int[] a = new int[] { 1, 2, 3 };
            int[] b = new int[] { 4, 5, 6 };
            int[] c = new int[] { 7, 8, 9 };
            int[] d = new int[] { 10, 11, 12 };
            int[] e = new int[] { 13, 14, 15 };
            int[] f = new int[] { 16, 17, 18 };
            node = new GraphNode(fields, a);
            node2 = new GraphNode(fields, b);
            node3 = new GraphNode(fields, c);
            node4 = new GraphNode(fields, d);
            node5 = new GraphNode(fields, f);
            nodeImage = this.Content.Load<Texture2D>("Node");
            node.addText(font, "1");
            node.loadImage(nodeImage, new Rectangle(100, 100, 50, 50));

            node2.loadImage(nodeImage, new Rectangle(640, 200, 50, 50));
            node2.addText(font, "2");
            node3.loadImage(nodeImage, new Rectangle(500, 101, 50, 50));
            node3.addText(font, "3");
            node4.loadImage(nodeImage, new Rectangle(60, 300, 50, 50));
            node4.addText(font, "4");
            node5.loadImage(nodeImage, new Rectangle(501, 301, 50, 50));
            node5.addText(font, "5");

            // TODO: use this.Content to load your game content here

            graphNetwork = new Network(fields);
            graphNetwork.addNode(null, node, 200, 150);
            graphNetwork.addNode(node, node3, 200, 150);
            graphNetwork.addNode(node3, node5, 200, 150);
            graphNetwork.addNode(node, node4, 200, 150);

            graphNetwork.addNode(node3, node2, 200, 150);

            graphNetwork.addEdge(node5, node2, 200, 150);
            graphNetwork.addEdge(node5, node4, 200, 150);
            graphNetwork.addEdge(node5, node, 200, 150);
            for (int i = 0; i < 19; i++)
            {
                graphNetwork.findNode(node5).outgoing.Enqueue(new Packet(123, node.IP, node4.IP, this.Content.Load<Texture2D>("Packet"))

                {
                });

            }
            ap = new Packet(123, node.IP, node4.IP, this.Content.Load<Texture2D>("Packet"));
             ap.packetParticle = this.Content.Load<Texture2D>("Packet");
             graphNetwork.findNode(node).outgoing.Enqueue(ap);
             graphNetwork.createLabel(font, spriteBatch);
             IsMouseVisible = true;
        }