Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static boolean loadAccountValidation(String auser, String apassword) {
- System.out.println("READING ACCOUNT...");
- String line = "";
- String token = "";
- String token2 = "";
- String[] token3 = new String[3];
- boolean EndOfFile = false;
- BufferedReader characterfile = null;
- boolean File1 = false;
- try {
- characterfile = new BufferedReader(new FileReader(
- "C:/Users/Dimitri/RPGGAMECACHE/Accounts/" + auser + ".txt"));
- } catch (FileNotFoundException fileex1) {
- }
- if (characterfile == null) {
- return false;
- }
- try {
- line = characterfile.readLine();
- } catch (IOException ioexception) {
- }
- while (EndOfFile == false && line != null) {
- System.out.println("READING");
- System.out.println(line);
- line = line.trim();
- int spot = line.indexOf("=");
- if (spot > -1) {
- token = line.substring(0, spot);
- token = token.trim();
- token2 = line.substring(spot + 1);
- token2 = token2.trim();
- token3 = token2.split("\t");
- if (token.equals("character-username")) {
- readuser = token2;
- } else if (token.equals("character-password")) {
- readpassword = token2;
- }
- } else if (line.contains("[EOF]")) {
- try {
- System.out.println("END REACHED");
- characterfile.close();
- } catch (IOException ioexception) {
- }
- }
- try {
- line = characterfile.readLine();
- } catch (IOException ioexception1) {
- System.out.println("NO NEXT LINE");
- EndOfFile = true;
- }
- }
- try {
- characterfile.close();
- } catch (IOException ioexception) {
- }
- System.out.println(readuser + readpassword);
- if (readuser.equals(auser) && readpassword.equals(apassword)) {
- return true;
- } else {
- return false;
- }
- }
Add Comment
Please, Sign In to add comment