import java.io.BufferedReader; import java.util.StringTokenizer; import java.io.FileReader; import java.io.IOException; public class CClientManager { public static boolean setupClient(CClientEngine client) { try { BufferedReader file = new BufferedReader(new FileReader("client.dat")); String lineContent = file.readLine(); StringTokenizer strToken = new StringTokenizer(lineContent); boolean isClientOnUse = strToken.nextToken().equalsIgnoreCase("1"); // if the user is in user.. if (isClientOnUse) { //throw IOException(errorMessage); return false; } client.setName(strToken.nextToken()); client.setId( Integer.parseInt(strToken.nextToken()) ); client.setPassword(strToken.nextToken()); lineContent = file.readLine(); CClientSideUser cu = null; while (lineContent != null) { strToken = new StringTokenizer(lineContent); cu = new CClientSideUser( Integer.parseInt(strToken.nextToken()), strToken.nextToken() ); CClientFriendsManager.getInstance().addKnownUser(cu); lineContent = file.readLine(); } } catch (IOException ex) { System.out.println("----ClientManager could not read Client Configurations----"); } return true; } public static void setClientOnUse(boolean flag) { return ; } }