示例#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();
     }
 }
示例#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));
                }
            }
示例#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));
                }
            }
示例#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();
     }
 }