Esempio n. 1
0
 public void SendUpdate(GameMessage message, byte[] data)
 {
     try
     {
         LastSendTime = DateTime.Now;
         Trace.WriteLine(string.Format("Send Messsage: {0} - {1} - {2}", this.Device.User, message.ToString(), data.Length));
         SendUpdate(message, _client, _endPoint, data, _identifier++);
     }
     catch (Exception ex)
     {
         Console.WriteLine("ERROR SendUpdate");
         Console.WriteLine(ex.ToString());
         this.Close();
     }
 }
Esempio n. 2
0
            public void ProcessMessage(GameMessage gameMessage, byte[] data)
            {
                Trace.WriteLine(string.Format("Recv Messsage: {0} - {1} - {2}", this.Device.User, gameMessage.ToString(), data.Length));

                LastRecvTime = DateTime.Now;

                Database.GameState state = new Database.GameState();
                state.PkGameState = Guid.NewGuid();
                state.Game        = this.Device.Game;
                state.Master      = false;
                state.Device      = this.Device.Device;

                state.Data     = data;
                state.Date     = DateTime.Now;
                state.Active   = false;
                state.Received = true;

                try
                {
                    lock (_gameDb)
                    {
                        _gameDb.GameStates.InsertOnSubmit(state);
                        _gameDb.SubmitChanges();
                    }
                }
                catch
                {
                }

                // we got our game state
                if (null != GotGameUpdate)
                {
                    GotGameUpdate(this, new GameUpdateEventArgs(gameMessage, data, data.Length));
                }
            }
Esempio n. 3
0
            public void ProcessMessage(GameMessage gameMessage, byte[] data)
            {
                Trace.WriteLine(string.Format("Recv Messsage: {0} - {1} - {2}", this.Device.User, gameMessage.ToString(), data.Length));

                LastRecvTime = DateTime.Now;

                Database.GameState state = new Database.GameState();
                state.PkGameState = Guid.NewGuid();
                state.Game = this.Device.Game;
                state.Master = false;
                state.Device = this.Device.Device;

                state.Data = data;
                state.Date = DateTime.Now;
                state.Active = false;
                state.Received = true;

                try
                {
                    lock (_gameDb)
                    {
                        _gameDb.GameStates.InsertOnSubmit(state);
                        _gameDb.SubmitChanges();
                    }
                }
                catch
                {
                }

                // we got our game state
                if (null != GotGameUpdate)
                {
                    GotGameUpdate(this, new GameUpdateEventArgs(gameMessage, data, data.Length));
                }
            }
Esempio n. 4
0
 public void SendUpdate(GameMessage message, byte[] data)
 {
     try
     {
         LastSendTime = DateTime.Now;
         Trace.WriteLine(string.Format("Send Messsage: {0} - {1} - {2}", this.Device.User, message.ToString(), data.Length));
         SendUpdate(message, _client, _endPoint, data, _identifier++);
     }
     catch (Exception ex)
     {
         Console.WriteLine("ERROR SendUpdate");
         Console.WriteLine(ex.ToString());
         this.Close();
     }
 }