package com.cst242.finalproject.server.model;

/**
 * This class implements the {@code FileIOInterface} refer to that for 
 * documentation.
 * 
 * @author James DeCarlo
 */
public class FileIO implements FileIOInterface{

    @Override
    public boolean register(String loginId, int hashedPassword, String firstName, String lastName, String screenName) {
        return true;
    }

    @Override
    public boolean deregister(int accountNumber) {
        return false;
    }

    @Override
    public User loginUser(String loginId, int hashedPassword) {
        User user = new User(1001, "JohnDoe",6969,"John", "Doe", "SomeGuy");
        
        return user;
    }

    @Override
    public boolean updateUser(int accountNumber, int hashedPassword, String firstName, String lastName, String screenName) {
        return false;
    }
    
}

@@ -42,16 +42,178 @@
 del;%0D%0A%0D%0A
+import java.io.File;%0D%0Aimport java.io.FileInputStream;%0D%0Aimport java.io.FileOutputStream;%0D%0Aimport java.io.ObjectInputStream;%0D%0Aimport java.io.ObjectOutputStream;%0D%0A%0D%0A
 /**%0D%0A * 
@@ -279,17 +279,16 @@
 that for
- 
 %0D%0A * doc
@@ -302,17 +302,16 @@
 ion.%0D%0A *
- 
 %0D%0A * @au
@@ -381,16 +381,17 @@
 nterface
+ 
 %7B%0D%0A%0D%0A   
@@ -515,32 +515,1501 @@
  screenName) %7B%0D%0A
+        File file = new File(%22userlist.dat%22);%0D%0A        if (file.exists()) %7B%0D%0A            try %7B%0D%0A                FileInputStream fileInputStream = new FileInputStream(file);%0D%0A                ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);%0D%0A                %0D%0A                FileOutputStream fileOutputStream = new FileOutputStream(file);%0D%0A                ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);%0D%0A                %0D%0A                %0D%0A                int accountNumber = 1000;%0D%0A                %0D%0A                while (objectInputStream.available() %3E 0) %7B%0D%0A                    User user = (User) objectInputStream.readObject();%0D%0A                    if (user.getAccountNumber() %3E accountNumber) %7B%0D%0A                        accountNumber = user.getAccountNumber();%0D%0A                    %7D  %0D%0A                %7D%0D%0A                %0D%0A                accountNumber++;%0D%0A                User user = new User(accountNumber, loginId, hashedPassword, firstName, lastName, screenName);%0D%0A                %0D%0A                //Writing the User object to the file.%0D%0A                objectOutputStream.writeObject(user);%0D%0A                %0D%0A                fileInputStream.close();%0D%0A                objectInputStream.close();%0D%0A                fileOutputStream.close();%0D%0A                objectOutputStream.close();%0D%0A            %7D%0D%0A            catch(Exception e)%7B%0D%0A                return false;%0D%0A            %7D%0D%0A%0D%0A        %7D%0D%0A%0D%0A
         return t
@@ -2251,13 +2251,15 @@
 oe%22,
+ 
 6969,
+ 
 %22Joh
@@ -2282,24 +2282,16 @@
 Guy%22);%0D%0A
-        
 %0D%0A      
@@ -2486,17 +2486,13 @@
 %0A    %7D%0D%0A
-    
 %0D%0A%7D%0D%0A

test commit made change to the FILE IO