Guest User

Untitled

a guest
Dec 16th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. public static boolean loadAccountValidation(String auser, String apassword) {
  2. System.out.println("READING ACCOUNT...");
  3.  
  4. String line = "";
  5. String token = "";
  6. String token2 = "";
  7. String[] token3 = new String[3];
  8. boolean EndOfFile = false;
  9. BufferedReader characterfile = null;
  10. boolean File1 = false;
  11.  
  12. try {
  13. characterfile = new BufferedReader(new FileReader(
  14. "C:/Users/Dimitri/RPGGAMECACHE/Accounts/" + auser + ".txt"));
  15. } catch (FileNotFoundException fileex1) {
  16. }
  17.  
  18. if (characterfile == null) {
  19. return false;
  20. }
  21.  
  22. try {
  23. line = characterfile.readLine();
  24. } catch (IOException ioexception) {
  25. }
  26. while (EndOfFile == false && line != null) {
  27. System.out.println("READING");
  28. System.out.println(line);
  29. line = line.trim();
  30. int spot = line.indexOf("=");
  31. if (spot > -1) {
  32. token = line.substring(0, spot);
  33. token = token.trim();
  34. token2 = line.substring(spot + 1);
  35. token2 = token2.trim();
  36. token3 = token2.split("\t");
  37. if (token.equals("character-username")) {
  38. readuser = token2;
  39. } else if (token.equals("character-password")) {
  40. readpassword = token2;
  41.  
  42. }
  43. } else if (line.contains("[EOF]")) {
  44. try {
  45. System.out.println("END REACHED");
  46. characterfile.close();
  47. } catch (IOException ioexception) {
  48. }
  49. }
  50. try {
  51. line = characterfile.readLine();
  52. } catch (IOException ioexception1) {
  53. System.out.println("NO NEXT LINE");
  54. EndOfFile = true;
  55. }
  56.  
  57. }
  58. try {
  59. characterfile.close();
  60. } catch (IOException ioexception) {
  61. }
  62.  
  63. System.out.println(readuser + readpassword);
  64. if (readuser.equals(auser) && readpassword.equals(apassword)) {
  65.  
  66. return true;
  67. } else {
  68.  
  69. return false;
  70. }
  71.  
  72. }
Add Comment
Please, Sign In to add comment