예제 #1
0
        public static int CheckUsernameExistCommand(ref ServerConnection connection, string username)
        {
            string command = CreateClientMessage((int)Options.CHECK_USER_NAME, username);

            connection.SendMessage(command);
            string[] args = GetArgArrayFromResponse(connection.ReadMessage());
            return(Int32.Parse(args[0]));
        }
예제 #2
0
        public static int SearchMatchCommand(ref ServerConnection connection, string sessionID)
        {
            string command = CreateClientMessage((int)Options.SEARCH_GAME, sessionID);

            connection.SendMessage(command);
            string[] args = GetArgArrayFromResponse(connection.ReadMessage());
            return(Int32.Parse(args[0]));
        }
예제 #3
0
        public static int RegisterUser(ref ServerConnection connection, string username, string password)
        {
            string command = CreateClientMessage((int)Options.CREATE_USER, username, password);

            connection.SendMessage(command);
            string[] args = GetArgArrayFromResponse(connection.ReadMessage());
            return(Int32.Parse(args[0]));
        }
예제 #4
0
        //******************** COMMANDS ********************

        public static int DisconnectCommand(ref ServerConnection connection)
        {
            string command = CreateClientMessage((int)Options.DISCONNECT);

            connection.SendMessage(command);
            string[] args = GetArgArrayFromResponse(connection.ReadMessage());
            return(Int32.Parse(args[0]));
        }
예제 #5
0
 public static GetFoundMatchResponse GetFoundMatchCommand_responseOnly(ref ServerConnection connection)
 {
     string[] args = GetArgArrayFromResponse(connection.ReadMessage());
     if (Int32.Parse(args[0]) != (int)ErrorCodes.NO_ERROR)
     {
         return(new GetFoundMatchResponse(Int32.Parse(args[0]), "", 0));
     }
     return(new GetFoundMatchResponse(Int32.Parse(args[0]), args[1], Int32.Parse(args[2])));
 }
예제 #6
0
        public static string Communicate(ref ServerConnection connection, string command)
        {
            string response = "";

            lock (comunicateLock) {
                connection.SendMessage(command);
                response = connection.ReadMessage();
            }
            return(response);
        }
예제 #7
0
        public static GetMatchHistoryCommandResponse GetMatchHistoryCommand(ref ServerConnection connection, string sessionID)
        {
            string command = CreateClientMessage((int)Options.MATCH_HISTORY, sessionID);

            connection.SendMessage(command);
            string[] args = GetArgArrayFromResponse(connection.ReadMessage());
            if (Int32.Parse(args[0]) != (int)ErrorCodes.NO_ERROR)
            {
                return(new GetMatchHistoryCommandResponse(Int32.Parse(args[0]), ""));
            }
            return(new GetMatchHistoryCommandResponse(Int32.Parse(args[0]), args[1]));
        }
예제 #8
0
        public static LoginCommandResponse LoginCommand(ref ServerConnection connection, string username, string password)
        {
            string command = CreateClientMessage((int)Options.LOGIN, username, password);

            connection.SendMessage(command);
            string[] args = GetArgArrayFromResponse(connection.ReadMessage());
            if (Int32.Parse(args[0]) != (int)ErrorCodes.NO_ERROR)
            {
                return(new LoginCommandResponse(Int32.Parse(args[0]), "", 0));
            }
            return(new LoginCommandResponse(Int32.Parse(args[0]), args[1], Int32.Parse(args[2])));
        }