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])); }
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])); }
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])); }
//******************** 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])); }
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]))); }
public static string Communicate(ref ServerConnection connection, string command) { string response = ""; lock (comunicateLock) { connection.SendMessage(command); response = connection.ReadMessage(); } return(response); }
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])); }
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]))); }