private static byte[] ProcessRequest(byte[] data) { short request_value = BitConverter.ToInt16(data, 0); var request_name = Enum.GetName(typeof(ECommands), request_value); if (request_name == null) { //TODO Log. Console.WriteLine("Error"); return(new byte[3]); } //TODO Log. byte[] result = new byte[3]; switch ((ECommands)request_value) { case ECommands.Ping: { break; } case ECommands.Connect: { break; } case ECommands.MakeLobby: { break; } case ECommands.LobbyList: { break; } case ECommands.ConnectToLobby: { break; } case ECommands.GetLobbyInfo: { break; } case ECommands.GetPlayerInfo: { break; } case ECommands.GetGrid: { SGridResponce answer = new SudokuCore.Protocol.SGridResponce(grid); return(ProtocolHelper.GridAnswerToByteArray(answer)); break; } case ECommands.GetMarks: { break; } case ECommands.UpdateGrid: { break; } case ECommands.GetServerTime: { break; } case ECommands.EnterNumber: { break; } case ECommands.EnterMark: { break; } case ECommands.CheckWin: { break; } case ECommands.GiveUp: { break; } } return(result); }